package com.ruoyi.tcZz.service.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.tcZz.domain.TcWljg;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.tcZz.mapper.TcBmtbMapper;
import com.ruoyi.tcZz.domain.TcBmtb;
import com.ruoyi.tcZz.service.ITcBmtbService;

/**
 * 部门通报Service业务层处理
 *
 * @author ruoyi
 * @date 2023-10-12
 */
@Service
public class TcBmtbServiceImpl implements ITcBmtbService {
    @Autowired
    private TcBmtbMapper tcBmtbMapper;

    /**
     * 查询部门通报
     *
     * @param id 部门通报主键
     * @return 部门通报
     */
    @Override
    public TcBmtb selectTcBmtbById(Long id) {
        return tcBmtbMapper.selectTcBmtbById(id);
    }

    /**
     * 查询部门通报列表
     *
     * @param tcBmtb 部门通报
     * @return 部门通报
     */
    @Override
    public List<TcBmtb> selectTcBmtbList(TcBmtb tcBmtb) {
        return tcBmtbMapper.selectTcBmtbList(tcBmtb);
    }

    /**
     * 新增部门通报
     *
     * @param tcBmtb 部门通报
     * @return 结果
     */
    @Override
    public int insertTcBmtb(TcBmtb tcBmtb) {
        tcBmtb.setCreateTime(DateUtils.getNowDate());
        return tcBmtbMapper.insertTcBmtb(tcBmtb);
    }

    /**
     * 修改部门通报
     *
     * @param tcBmtb 部门通报
     * @return 结果
     */
    @Override
    public int updateTcBmtb(TcBmtb tcBmtb) {
        tcBmtb.setUpdateTime(DateUtils.getNowDate());
        return tcBmtbMapper.updateTcBmtb(tcBmtb);
    }

    /**
     * 批量删除部门通报
     *
     * @param ids 需要删除的部门通报主键
     * @return 结果
     */
    @Override
    public int deleteTcBmtbByIds(Long[] ids) {
        return tcBmtbMapper.deleteTcBmtbByIds(ids);
    }

    /**
     * 删除部门通报信息
     *
     * @param id 部门通报主键
     * @return 结果
     */
    @Override
    public int deleteTcBmtbById(Long id) {
        return tcBmtbMapper.deleteTcBmtbById(id);
    }

    @Override
    public String importUser(List<TcBmtb> tcBmtbList) {
        StringBuilder successMsg = new StringBuilder();
        if (!tcBmtbList.isEmpty()) {
            for (TcBmtb tcBmtb : tcBmtbList) {
                tcBmtb.setCreateTime(DateUtils.getNowDate());
                tcBmtbMapper.insertTcBmtb(tcBmtb);
            }
            successMsg.append("导入成功");
        }

        return successMsg.toString();
    }
    @Override
    public void updateByisStatus(Integer isStatus,List<String> ids) {
        tcBmtbMapper.updateByisStatus(isStatus,ids);
    }
}
