package org.example.mybatisplus.service.impl;

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

import org.example.mybatisplus.service.ICmsEntRiskInfoDeclService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.example.mybatisplus.tools.ConvertUtil;
import org.example.mybatisplus.mapper.auto.CmsEntRiskInfoDeclMapper;
import org.example.mybatisplus.model.auto.CmsEntRiskInfoDecl;
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:37
 */
@Service
public class CmsEntRiskInfoDeclServiceImpl extends ServiceImpl<CmsEntRiskInfoDeclMapper, CmsEntRiskInfoDecl> implements ICmsEntRiskInfoDeclService {

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

    @Autowired
    private CmsEntRiskInfoDeclMapper cmsEntRiskInfoDeclMapper;
                                                                                                                                                                                                                                                                                                                    /**
     * 查询企业风险信息申报
     *
     * @param id
     * @return CmsEntRiskInfoDecl
     */
    @Override
    public CmsEntRiskInfoDecl selectCmsEntRiskInfoDeclById(Long id) {
        return this.baseMapper.selectById(id);
    }

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

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

    /**
     * 新增企业风险信息申报
     *
     * @param cmsEntRiskInfoDecl
     * @return 结果
     */
    @Override
    public int insertCmsEntRiskInfoDecl(CmsEntRiskInfoDecl cmsEntRiskInfoDecl) {
        return this.baseMapper.insert(cmsEntRiskInfoDecl);
    }

    /**
     * 修改企业风险信息申报
     *
     * @param cmsEntRiskInfoDecl
     * @return 结果
     */
    @Override
    public int updateCmsEntRiskInfoDecl (CmsEntRiskInfoDecl  cmsEntRiskInfoDecl) {
        return this.baseMapper.updateById(cmsEntRiskInfoDecl);
    }

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

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

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