package com.fs.watch.service.impl;

import com.fs.common.utils.StringUtils;
import com.fs.watch.domain.WatchMonitorDataType;
import com.fs.watch.mapper.WatchMonitorDataTypeMapper;
import com.fs.watch.service.WatchMonitorDataTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

@Service
public class WatchMonitorDataTypeServiceImpl implements WatchMonitorDataTypeService {
    @Autowired
    private WatchMonitorDataTypeMapper watchMonitorDataTypeMapper;

    /**
     * 查询app-健康监测数据类型
     *
     * @param id app-健康监测数据类型主键
     * @return app-健康监测数据类型
     */
    @Override
    public WatchMonitorDataType selectFsMonitorDataTypeById(String id) {
        return watchMonitorDataTypeMapper.selectWatchMonitorDataTypeById(id);
    }

    /**
     * 查询app-健康监测数据类型列表
     *
     * @param fsMonitorDataType app-健康监测数据类型
     * @return app-健康监测数据类型
     */
    @Override
    public List<WatchMonitorDataType> selectFsMonitorDataTypeList(WatchMonitorDataType fsMonitorDataType) {
        return watchMonitorDataTypeMapper.selectWatchMonitorDataTypeList(fsMonitorDataType);
    }

    @Override
    public List<WatchMonitorDataType> selectFsMonitorDataTypeByIds(String ids) {
        if (StringUtils.isBlank(ids)) {
            return null;
        }
        List<String> idList = Arrays.stream(ids.split(",")).collect(Collectors.toList());
        return watchMonitorDataTypeMapper.selectWatchMonitorDataTypeByIds(idList);
    }
}
