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.TcSdtbMapper;
import com.ruoyi.tcZz.domain.TcSdtb;
import com.ruoyi.tcZz.service.ITcSdtbService;

/**
 * 属地通报Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-10-12
 */
@Service
public class TcSdtbServiceImpl implements ITcSdtbService 
{
    @Autowired
    private TcSdtbMapper tcSdtbMapper;

    /**
     * 查询属地通报
     * 
     * @param id 属地通报主键
     * @return 属地通报
     */
    @Override
    public TcSdtb selectTcSdtbById(Long id)
    {
        return tcSdtbMapper.selectTcSdtbById(id);
    }

    /**
     * 查询属地通报列表
     * 
     * @param tcSdtb 属地通报
     * @return 属地通报
     */
    @Override
    public List<TcSdtb> selectTcSdtbList(TcSdtb tcSdtb)
    {
        return tcSdtbMapper.selectTcSdtbList(tcSdtb);
    }

    /**
     * 新增属地通报
     * 
     * @param tcSdtb 属地通报
     * @return 结果
     */
    @Override
    public int insertTcSdtb(TcSdtb tcSdtb)
    {
        tcSdtb.setCreateTime(DateUtils.getNowDate());
        return tcSdtbMapper.insertTcSdtb(tcSdtb);
    }

    /**
     * 修改属地通报
     * 
     * @param tcSdtb 属地通报
     * @return 结果
     */
    @Override
    public int updateTcSdtb(TcSdtb tcSdtb)
    {
        tcSdtb.setUpdateTime(DateUtils.getNowDate());
        return tcSdtbMapper.updateTcSdtb(tcSdtb);
    }

    /**
     * 批量删除属地通报
     * 
     * @param ids 需要删除的属地通报主键
     * @return 结果
     */
    @Override
    public int deleteTcSdtbByIds(Long[] ids)
    {
        return tcSdtbMapper.deleteTcSdtbByIds(ids);
    }

    /**
     * 删除属地通报信息
     * 
     * @param id 属地通报主键
     * @return 结果
     */
    @Override
    public int deleteTcSdtbById(Long id)
    {
        return tcSdtbMapper.deleteTcSdtbById(id);
    }

    @Override
    public String importUser(List<TcSdtb> tcSdtbList) {
        StringBuilder successMsg = new StringBuilder();
        if (!tcSdtbList.isEmpty()) {
            for (TcSdtb tcSdtb : tcSdtbList) {
                tcSdtbMapper.insertTcSdtb(tcSdtb);
            }
            successMsg.append("导入成功");
        }

        return successMsg.toString();
    }

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