1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
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<CheckRuleMapper, CheckRule> 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<CheckRule> checkRules = checkRuleMapper.selectCheckRuleList(checkRule);
        Map<Short, List<CheckRule>> 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);
    }
}