package org.example.mybatisplus.service.impl;

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

import org.example.mybatisplus.service.ICmsEntRiskQxbInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.example.mybatisplus.tools.ConvertUtil;
import org.example.mybatisplus.mapper.auto.CmsEntRiskQxbInfoMapper;
import org.example.mybatisplus.model.auto.CmsEntRiskQxbInfo;
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:12
 */
@Service
public class CmsEntRiskQxbInfoServiceImpl extends ServiceImpl<CmsEntRiskQxbInfoMapper, CmsEntRiskQxbInfo> implements ICmsEntRiskQxbInfoService {

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

    @Autowired
    private CmsEntRiskQxbInfoMapper cmsEntRiskQxbInfoMapper;
                                                                                                                                                                                                                                                                                            /**
     * 查询企业风险信息-基于启信宝
     *
     * @param id
     * @return CmsEntRiskQxbInfo
     */
    @Override
    public CmsEntRiskQxbInfo selectCmsEntRiskQxbInfoById(Long id) {
        return this.baseMapper.selectById(id);
    }

    /**
     * 查询企业风险信息-基于启信宝列表
     *
     * @param queryWrapper
     * @return CmsEntRiskQxbInfo集合
     */
    @Override
    public List<CmsEntRiskQxbInfo> selectCmsEntRiskQxbInfoList(Wrapper<CmsEntRiskQxbInfo> queryWrapper) {
        return this.baseMapper.selectList(queryWrapper);
    }

    /**
     * 查询企业风险信息-基于启信宝列表
     *
     * @param cmsEntRiskQxbInfo
     * @return CmsEntRiskQxbInfo集合
     */
    @Override
    public List<CmsEntRiskQxbInfo> selectCmsEntRiskQxbInfoList(CmsEntRiskQxbInfo cmsEntRiskQxbInfo) {
		Map<String, Object> map = BeanUtil.beanToMap(cmsEntRiskQxbInfo, true, true);
		QueryWrapper<CmsEntRiskQxbInfo> queryWrapper = new QueryWrapper<CmsEntRiskQxbInfo>();
		queryWrapper.allEq(map,false);
		return this.baseMapper.selectList(queryWrapper);
    }

    /**
     * 新增企业风险信息-基于启信宝
     *
     * @param cmsEntRiskQxbInfo
     * @return 结果
     */
    @Override
    public int insertCmsEntRiskQxbInfo(CmsEntRiskQxbInfo cmsEntRiskQxbInfo) {
        return this.baseMapper.insert(cmsEntRiskQxbInfo);
    }

    /**
     * 修改企业风险信息-基于启信宝
     *
     * @param cmsEntRiskQxbInfo
     * @return 结果
     */
    @Override
    public int updateCmsEntRiskQxbInfo (CmsEntRiskQxbInfo  cmsEntRiskQxbInfo) {
        return this.baseMapper.updateById(cmsEntRiskQxbInfo);
    }

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

    /**
     * 删除企业风险信息-基于启信宝信息
     *
     * @param id
     * @return 结果
     */
    @Override
    public int deleteCmsEntRiskQxbInfoById(Long id) {
        return this.baseMapper.deleteById(id);
    }

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