package com.ycl.platform.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ycl.platform.domain.entity.CheckRule; import com.ycl.platform.domain.vo.CheckRuleVO; import com.ycl.platform.mapper.CheckRuleMapper; import com.ycl.platform.service.ICheckRuleService; import constant.CheckConstants; import org.hibernate.annotations.Check; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import utils.DateUtils; import java.util.Date; import java.util.List; import java.util.Map; import java.util.stream.Collectors; /** * 考核规则Service业务层处理 * * @author ruoyi * @date 2024-04-15 */ @Service public class CheckRuleServiceImpl extends ServiceImpl implements ICheckRuleService { @Autowired private CheckRuleMapper checkRuleMapper; /** * 查询考核规则 * @param id 考核规则主键 * @return 考核规则 */ @Override public CheckRule selectCheckRuleById(Long id) { return checkRuleMapper.selectCheckRuleById(id); } /** * 查询考核规则列表 * * @param checkRule 考核规则 * @return 考核规则 */ @Override public CheckRuleVO selectCheckRuleList(CheckRule checkRule) { List checkRules = checkRuleMapper.selectCheckRuleList(checkRule); Map> map = checkRules.stream().collect(Collectors.groupingBy(CheckRule::getRuleCategory)); CheckRuleVO checkRuleVO = new CheckRuleVO() .setCarRules(map.get(CheckConstants.Rule_Category_Car)) .setFaceRules(map.get(CheckConstants.Rule_Category_Face)) .setVideoRules(map.get(CheckConstants.Rule_Category_Video)); return checkRuleVO; } /** * 新增考核规则 * * @param checkRule 考核规则 * @return 结果 */ @Override public int insertCheckRule(CheckRule checkRule) { return checkRuleMapper.insertCheckRule(checkRule); } /** * 修改考核规则 * @param checkRule 考核规则 * @return 结果 */ @Override public int updateCheckRule(CheckRule checkRule) { return checkRuleMapper.updateCheckRule(checkRule); } /** * 批量删除考核规则 * * @param ids 需要删除的考核规则主键 * @return 结果 */ @Override public int deleteCheckRuleByIds(Long[] ids) { return checkRuleMapper.deleteCheckRuleByIds(ids); } /** * 删除考核规则信息 * * @param id 考核规则主键 * @return 结果 */ @Override public int deleteCheckRuleById(Long id) { return checkRuleMapper.deleteCheckRuleById(id); } }