package org.example.mybatisplus.service.impl;

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

import org.example.mybatisplus.service.ICmsEntRiskInfoCktItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.example.mybatisplus.tools.ConvertUtil;
import org.example.mybatisplus.mapper.auto.CmsEntRiskInfoCktItemMapper;
import org.example.mybatisplus.model.auto.CmsEntRiskInfoCktItem;
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:27
 */
@Service
public class CmsEntRiskInfoCktItemServiceImpl extends ServiceImpl<CmsEntRiskInfoCktItemMapper, CmsEntRiskInfoCktItem> implements ICmsEntRiskInfoCktItemService {

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

    @Autowired
    private CmsEntRiskInfoCktItemMapper cmsEntRiskInfoCktItemMapper;
                                                                                                                                                                                                                                                                                                                    /**
     * 查询企业风险检查项
     *
     * @param id
     * @return CmsEntRiskInfoCktItem
     */
    @Override
    public CmsEntRiskInfoCktItem selectCmsEntRiskInfoCktItemById(Long id) {
        return this.baseMapper.selectById(id);
    }

    /**
     * 查询企业风险检查项列表
     *
     * @param queryWrapper
     * @return CmsEntRiskInfoCktItem集合
     */
    @Override
    public List<CmsEntRiskInfoCktItem> selectCmsEntRiskInfoCktItemList(Wrapper<CmsEntRiskInfoCktItem> queryWrapper) {
        return this.baseMapper.selectList(queryWrapper);
    }

    /**
     * 查询企业风险检查项列表
     *
     * @param cmsEntRiskInfoCktItem
     * @return CmsEntRiskInfoCktItem集合
     */
    @Override
    public List<CmsEntRiskInfoCktItem> selectCmsEntRiskInfoCktItemList(CmsEntRiskInfoCktItem cmsEntRiskInfoCktItem) {
		Map<String, Object> map = BeanUtil.beanToMap(cmsEntRiskInfoCktItem, true, true);
		QueryWrapper<CmsEntRiskInfoCktItem> queryWrapper = new QueryWrapper<CmsEntRiskInfoCktItem>();
		queryWrapper.allEq(map,false);
		return this.baseMapper.selectList(queryWrapper);
    }

    /**
     * 新增企业风险检查项
     *
     * @param cmsEntRiskInfoCktItem
     * @return 结果
     */
    @Override
    public int insertCmsEntRiskInfoCktItem(CmsEntRiskInfoCktItem cmsEntRiskInfoCktItem) {
        return this.baseMapper.insert(cmsEntRiskInfoCktItem);
    }

    /**
     * 修改企业风险检查项
     *
     * @param cmsEntRiskInfoCktItem
     * @return 结果
     */
    @Override
    public int updateCmsEntRiskInfoCktItem (CmsEntRiskInfoCktItem  cmsEntRiskInfoCktItem) {
        return this.baseMapper.updateById(cmsEntRiskInfoCktItem);
    }

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

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

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