package org.example.mybatisplus.service.impl;

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

import org.example.mybatisplus.service.ICmsEntRiskInfoCktRuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.example.mybatisplus.tools.ConvertUtil;
import org.example.mybatisplus.mapper.auto.CmsEntRiskInfoCktRuleMapper;
import org.example.mybatisplus.model.auto.CmsEntRiskInfoCktRule;
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:33
 */
@Service
public class CmsEntRiskInfoCktRuleServiceImpl extends ServiceImpl<CmsEntRiskInfoCktRuleMapper, CmsEntRiskInfoCktRule> implements ICmsEntRiskInfoCktRuleService {

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

    @Autowired
    private CmsEntRiskInfoCktRuleMapper cmsEntRiskInfoCktRuleMapper;
                                                                                                                    /**
     * 查询企业风险信息校验规则
     *
     * @param id
     * @return CmsEntRiskInfoCktRule
     */
    @Override
    public CmsEntRiskInfoCktRule selectCmsEntRiskInfoCktRuleById(Long id) {
        return this.baseMapper.selectById(id);
    }

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

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

    /**
     * 新增企业风险信息校验规则
     *
     * @param cmsEntRiskInfoCktRule
     * @return 结果
     */
    @Override
    public int insertCmsEntRiskInfoCktRule(CmsEntRiskInfoCktRule cmsEntRiskInfoCktRule) {
        return this.baseMapper.insert(cmsEntRiskInfoCktRule);
    }

    /**
     * 修改企业风险信息校验规则
     *
     * @param cmsEntRiskInfoCktRule
     * @return 结果
     */
    @Override
    public int updateCmsEntRiskInfoCktRule (CmsEntRiskInfoCktRule  cmsEntRiskInfoCktRule) {
        return this.baseMapper.updateById(cmsEntRiskInfoCktRule);
    }

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

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

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