xieb
2024-01-04 668d99baf96b05d28fd0d25e1c78ede6dee15083
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
package cn.gistack.sm.sjztmd.wrapper;
 
import cn.gistack.sm.sjztmd.entity.AttResBase;
import cn.gistack.sm.sjztmd.service.ITbResGeneralInvestigationService;
import cn.gistack.sm.sjztmd.vo.AttResBaseGeneralInvestigationVO;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.SpringUtil;
 
import java.util.List;
import java.util.Objects;
 
/**
 * @PROJECT_NAME: skjcmanager
 * @DESCRIPTION:
 * @USER: aix
 * @DATE: 2024/1/3 16:00
 */
public class AttResBaseWrapper extends BaseEntityWrapper<AttResBase, AttResBaseGeneralInvestigationVO> {
 
    private static final ITbResGeneralInvestigationService tbResGeneralInvestigationService;
 
    static {
        tbResGeneralInvestigationService = SpringUtil.getBean(ITbResGeneralInvestigationService.class);
    }
 
    public static AttResBaseWrapper build() {
        return new AttResBaseWrapper();
    }
 
    @Override
    public AttResBaseGeneralInvestigationVO entityVO(AttResBase entity) {
        AttResBaseGeneralInvestigationVO vo = Objects.requireNonNull(BeanUtil.copy(entity, AttResBaseGeneralInvestigationVO.class));
        return vo;
    }
 
    public IPage<AttResBaseGeneralInvestigationVO> pageVO(IPage<AttResBase> pages) {
        List<AttResBaseGeneralInvestigationVO> records = listVO(pages.getRecords());
 
        for (AttResBaseGeneralInvestigationVO vo:records) {
            QueryWrapper queryWrapper = new QueryWrapper();
            queryWrapper.eq("\"res_guid\"",vo.getGuid());
            queryWrapper.ne("\"check_state\"", 0);
            long tbCount = tbResGeneralInvestigationService.count(queryWrapper);
            vo.setIsSb(tbCount > 0);
        }
 
        IPage<AttResBaseGeneralInvestigationVO> pageVo = new Page<>(pages.getCurrent(), pages.getSize(), pages.getTotal());
        pageVo.setRecords(records);
        return pageVo;
    }
}