zhangfeng
2023-07-26 dd59c95e87ba585c4e3e2f059e218853784402e5
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
package com.gk.hotwork.Service.ServiceImpl;
 
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gk.hotwork.Domain.InspectionExpert;
import com.gk.hotwork.Domain.InspectionExpertGroup;
import com.gk.hotwork.Domain.SafetySelfInspection;
import com.gk.hotwork.Domain.UserInfo;
import com.gk.hotwork.Domain.Utils.StringUtils;
import com.gk.hotwork.Mapper.InspectionExpertGroupMapper;
import com.gk.hotwork.Service.InspectionExpertGroupService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.util.Map;
 
/**
 * @email 1603559716@qq.com
 * @author: zf
 * @date: 2023/7/19
 * @time: 17:30
 */
@Service
public class InspectionExpertGroupServiceImpl extends ServiceImpl<InspectionExpertGroupMapper, InspectionExpertGroup> implements InspectionExpertGroupService {
 
    @Autowired
    private InspectionExpertGroupMapper inspectionExpertGroupMapper;
 
 
    @Override
    public IPage selectPage(Page<InspectionExpertGroup> page, Map<String, Object> filter, UserInfo user) {
        Integer type = user.getType();
        //普通用户
        if (type.equals(3)) {
            Long companyid = user.getCompanyid();
            filter.put("checkedCompanyId",companyid);
        }
        //监管用户
        if (type.equals(2)) {
            //获取企业信息
            filter.put("province",user.getProvince());
            filter.put("city",user.getCity());
            filter.put("area",user.getCounty());
        }
        IPage<InspectionExpertGroup> res = inspectionExpertGroupMapper.selectPages(page, filter);
        return res;
    }
 
    @Override
    public InspectionExpertGroup getBySelfInspectionId(Long selfInspectionId) {
 
        return inspectionExpertGroupMapper.selectOne(new LambdaQueryWrapper<InspectionExpertGroup>()
                .eq(InspectionExpertGroup::getValidFlag,true)
                .eq(InspectionExpertGroup::getSelfInspectionId,selfInspectionId)
        );
    }
}