package com.ruoyi.tcZz.service.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.tcZz.domain.TcAqg;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.tcZz.mapper.TcMapMapper;
import com.ruoyi.tcZz.domain.TcMap;
import com.ruoyi.tcZz.service.ITcMapService;

/**
 * 地图统计Service业务层处理
 *
 * @author ruoyi
 * @date 2023-10-12
 */
@Service
public class TcMapServiceImpl implements ITcMapService {
    @Autowired
    private TcMapMapper tcMapMapper;

    /**
     * 查询地图统计
     *
     * @param id 地图统计主键
     * @return 地图统计
     */
    @Override
    public TcMap selectTcMapById(Long id) {
        return tcMapMapper.selectTcMapById(id);
    }

    /**
     * 查询地图统计列表
     *
     * @param tcMap 地图统计
     * @return 地图统计
     */
    @Override
    public List<TcMap> selectTcMapList(TcMap tcMap) {
        return tcMapMapper.selectTcMapList(tcMap);
    }

    /**
     * 新增地图统计
     *
     * @param tcMap 地图统计
     * @return 结果
     */
    @Override
    public int insertTcMap(TcMap tcMap) {
        tcMap.setCreateTime(DateUtils.getNowDate());
        return tcMapMapper.insertTcMap(tcMap);
    }

    /**
     * 修改地图统计
     *
     * @param tcMap 地图统计
     * @return 结果
     */
    @Override
    public int updateTcMap(TcMap tcMap) {
        tcMap.setUpdateTime(DateUtils.getNowDate());
        return tcMapMapper.updateTcMap(tcMap);
    }

    /**
     * 批量删除地图统计
     *
     * @param ids 需要删除的地图统计主键
     * @return 结果
     */
    @Override
    public int deleteTcMapByIds(Long[] ids) {
        return tcMapMapper.deleteTcMapByIds(ids);
    }

    /**
     * 删除地图统计信息
     *
     * @param id 地图统计主键
     * @return 结果
     */
    @Override
    public int deleteTcMapById(Long id) {
        return tcMapMapper.deleteTcMapById(id);
    }

    @Override
    public String importUser(List<TcMap> tcMapList) {
        StringBuilder successMsg = new StringBuilder();
        if (!tcMapList.isEmpty()) {
            for (TcMap tcMap : tcMapList) {
                tcMapMapper.insertTcMap(tcMap);
            }
            successMsg.append("导入成功");
        }

        return successMsg.toString();
    }

    @Override
    public void updateByisStatus(Integer isStatus,List<String> ids) {
        tcMapMapper.updateByisStatus(isStatus,ids);
    }
}
