6 天以前 0c23c1e9b9e06ffc570edac28ee45555b772b99c
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
package com.ruoyi.safety.service.impl;
 
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.safety.dto.SafetyLearningStatistics;
import com.ruoyi.safety.mapper.SafetyLearningRecordMapper;
import com.ruoyi.safety.pojo.SafetyLearningRecord;
import com.ruoyi.safety.service.SafetyLearningRecordService;
import org.springframework.stereotype.Service;
 
@Service
public class SafetyLearningRecordServiceImpl
        extends SafetyBaseServiceImpl<SafetyLearningRecordMapper, SafetyLearningRecord>
        implements SafetyLearningRecordService {
 
    @Override
    public IPage<SafetyLearningRecord> queryPage(Page<SafetyLearningRecord> page, SafetyLearningRecord query) {
        QueryWrapper<SafetyLearningRecord> wrapper =
                new QueryWrapper<SafetyLearningRecord>().orderByDesc("create_time");
        if (query != null) {
            if (query.getEmployeeId() != null) {
                wrapper.eq("employee_id", query.getEmployeeId());
            }
            if (hasText(query.getEmployeeName())) {
                wrapper.like("employee_name", query.getEmployeeName());
            }
            if (hasText(query.getContent())) {
                wrapper.like("content", query.getContent());
            }
            if (query.getStatus() != null) {
                wrapper.eq("status", query.getStatus());
            }
        }
        return page(page, wrapper);
    }
 
    @Override
    public SafetyLearningStatistics getStatistics() {
        return baseMapper.selectStatistics();
    }
}