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
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.SafetyEmergencyResourceMapper;
import com.ruoyi.safety.pojo.SafetyEmergencyResource;
import com.ruoyi.safety.service.SafetyEmergencyResourceService;
import org.springframework.stereotype.Service;
 
@Service
public class SafetyEmergencyResourceServiceImpl
        extends SafetyBaseServiceImpl<SafetyEmergencyResourceMapper, SafetyEmergencyResource>
        implements SafetyEmergencyResourceService {
 
    @Override
    public IPage<SafetyEmergencyResource> queryPage(Page<SafetyEmergencyResource> page,
                                                    SafetyEmergencyResource query) {
        QueryWrapper<SafetyEmergencyResource> wrapper =
                new QueryWrapper<SafetyEmergencyResource>().orderByDesc("create_time");
        if (query != null) {
            if (hasText(query.getName())) {
                wrapper.like("name", query.getName());
            }
            if (hasText(query.getType())) {
                wrapper.like("type", query.getType());
            }
            if (query.getAreaId() != null) {
                wrapper.eq("area_id", query.getAreaId());
            }
            if (query.getStatus() != null) {
                wrapper.eq("status", query.getStatus());
            }
        }
        return page(page, wrapper);
    }
}