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
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.mapper.SafetyTrainingPlanMapper;
import com.ruoyi.safety.pojo.SafetyTrainingPlan;
import com.ruoyi.safety.service.SafetyTrainingPlanService;
import org.springframework.stereotype.Service;
 
@Service
public class SafetyTrainingPlanServiceImpl
        extends SafetyBaseServiceImpl<SafetyTrainingPlanMapper, SafetyTrainingPlan>
        implements SafetyTrainingPlanService {
 
    @Override
    public IPage<SafetyTrainingPlan> queryPage(Page<SafetyTrainingPlan> page, SafetyTrainingPlan query) {
        QueryWrapper<SafetyTrainingPlan> wrapper = new QueryWrapper<SafetyTrainingPlan>().orderByDesc("create_time");
        if (query != null) {
            if (hasText(query.getYear())) {
                wrapper.eq("`year`", query.getYear());
            }
            if (hasText(query.getPost())) {
                wrapper.like("post", query.getPost());
            }
            if (hasText(query.getLevel())) {
                wrapper.eq("`level`", query.getLevel());
            }
            if (query.getStatus() != null) {
                wrapper.eq("status", query.getStatus());
            }
        }
        return page(page, wrapper);
    }
}