package org.example.mybatisplus.service.impl;

import java.util.List;
import java.util.Arrays;
import java.util.Map;

import org.example.mybatisplus.service.ICmsEntRiskInfoCktService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.example.mybatisplus.tools.ConvertUtil;
import org.example.mybatisplus.mapper.auto.CmsEntRiskInfoCktMapper;
import org.example.mybatisplus.model.auto.CmsEntRiskInfoCkt;
import cn.hutool.core.bean.BeanUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

/**
 * 企业风险信息校验Service业务层处理
 *
 * @author 各类开发联系微信：qiubbstop     fuce
 * @date 2025-03-09 23:36:35
 */
@Service
public class CmsEntRiskInfoCktServiceImpl extends ServiceImpl<CmsEntRiskInfoCktMapper, CmsEntRiskInfoCkt> implements ICmsEntRiskInfoCktService {

    private static final Logger logger = LoggerFactory.getLogger(CmsEntRiskInfoCktServiceImpl.class);

    @Autowired
    private CmsEntRiskInfoCktMapper cmsEntRiskInfoCktMapper;
                                                                                                                                                                                                                                /**
     * 查询企业风险信息校验
     *
     * @param id
     * @return CmsEntRiskInfoCkt
     */
    @Override
    public CmsEntRiskInfoCkt selectCmsEntRiskInfoCktById(Long id) {
        return this.baseMapper.selectById(id);
    }

    /**
     * 查询企业风险信息校验列表
     *
     * @param queryWrapper
     * @return CmsEntRiskInfoCkt集合
     */
    @Override
    public List<CmsEntRiskInfoCkt> selectCmsEntRiskInfoCktList(Wrapper<CmsEntRiskInfoCkt> queryWrapper) {
        return this.baseMapper.selectList(queryWrapper);
    }

    /**
     * 查询企业风险信息校验列表
     *
     * @param cmsEntRiskInfoCkt
     * @return CmsEntRiskInfoCkt集合
     */
    @Override
    public List<CmsEntRiskInfoCkt> selectCmsEntRiskInfoCktList(CmsEntRiskInfoCkt cmsEntRiskInfoCkt) {
		Map<String, Object> map = BeanUtil.beanToMap(cmsEntRiskInfoCkt, true, true);
		QueryWrapper<CmsEntRiskInfoCkt> queryWrapper = new QueryWrapper<CmsEntRiskInfoCkt>();
		queryWrapper.allEq(map,false);
		return this.baseMapper.selectList(queryWrapper);
    }

    /**
     * 新增企业风险信息校验
     *
     * @param cmsEntRiskInfoCkt
     * @return 结果
     */
    @Override
    public int insertCmsEntRiskInfoCkt(CmsEntRiskInfoCkt cmsEntRiskInfoCkt) {
        return this.baseMapper.insert(cmsEntRiskInfoCkt);
    }

    /**
     * 修改企业风险信息校验
     *
     * @param cmsEntRiskInfoCkt
     * @return 结果
     */
    @Override
    public int updateCmsEntRiskInfoCkt (CmsEntRiskInfoCkt  cmsEntRiskInfoCkt) {
        return this.baseMapper.updateById(cmsEntRiskInfoCkt);
    }

    /**
     * 批量删除企业风险信息校验
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteCmsEntRiskInfoCktByIds(String ids) {
        return this.baseMapper.deleteBatchIds(Arrays.asList(ConvertUtil.toStrArray(ids)));
    }

    /**
     * 删除企业风险信息校验信息
     *
     * @param id
     * @return 结果
     */
    @Override
    public int deleteCmsEntRiskInfoCktById(Long id) {
        return this.baseMapper.deleteById(id);
    }

    /**
     * 修改权限状态展示或者不展示
     *
     * @param cmsEntRiskInfoCkt
     * @return
     */
    @Override
    public int updateVisible(CmsEntRiskInfoCkt cmsEntRiskInfoCkt) {
        return this.baseMapper.updateById(cmsEntRiskInfoCkt);
    }
}
