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.TcDtsxMapper;
import com.ruoyi.tcZz.domain.TcDtsx;
import com.ruoyi.tcZz.service.ITcDtsxService;

/**
 * 动态筛选Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-10-12
 */
@Service
public class TcDtsxServiceImpl implements ITcDtsxService 
{
    @Autowired
    private TcDtsxMapper tcDtsxMapper;

    /**
     * 查询动态筛选
     * 
     * @param id 动态筛选主键
     * @return 动态筛选
     */
    @Override
    public TcDtsx selectTcDtsxById(Long id)
    {
        return tcDtsxMapper.selectTcDtsxById(id);
    }

    /**
     * 查询动态筛选列表
     * 
     * @param tcDtsx 动态筛选
     * @return 动态筛选
     */
    @Override
    public List<TcDtsx> selectTcDtsxList(TcDtsx tcDtsx)
    {
        return tcDtsxMapper.selectTcDtsxList(tcDtsx);
    }

    /**
     * 新增动态筛选
     * 
     * @param tcDtsx 动态筛选
     * @return 结果
     */
    @Override
    public int insertTcDtsx(TcDtsx tcDtsx)
    {
        tcDtsx.setCreateTime(DateUtils.getNowDate());
        return tcDtsxMapper.insertTcDtsx(tcDtsx);
    }

    /**
     * 修改动态筛选
     * 
     * @param tcDtsx 动态筛选
     * @return 结果
     */
    @Override
    public int updateTcDtsx(TcDtsx tcDtsx)
    {
        tcDtsx.setUpdateTime(DateUtils.getNowDate());
        return tcDtsxMapper.updateTcDtsx(tcDtsx);
    }

    /**
     * 批量删除动态筛选
     * 
     * @param ids 需要删除的动态筛选主键
     * @return 结果
     */
    @Override
    public int deleteTcDtsxByIds(Long[] ids)
    {
        return tcDtsxMapper.deleteTcDtsxByIds(ids);
    }

    /**
     * 删除动态筛选信息
     * 
     * @param id 动态筛选主键
     * @return 结果
     */
    @Override
    public int deleteTcDtsxById(Long id)
    {
        return tcDtsxMapper.deleteTcDtsxById(id);
    }

    @Override
    public String importUser(List<TcDtsx> tcDtsxList) {
        StringBuilder successMsg = new StringBuilder();
        if (!tcDtsxList.isEmpty()) {
            for (TcDtsx tcDtsx : tcDtsxList) {
                tcDtsxMapper.insertTcDtsx(tcDtsx);
            }
            successMsg.append("导入成功");
        }

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