heheng
2025-11-28 03a3edee9ff27fa9bb4b32dcda08e279c7c094c8
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
60
61
package com.gkhy.exam.system.service.impl;
 
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gkhy.exam.common.api.CommonPage;
import com.gkhy.exam.common.api.CommonResult;
import com.gkhy.exam.common.utils.SecurityUtils;
import com.gkhy.exam.system.domain.ProcessInspection;
import com.gkhy.exam.system.mapper.ProcessInspectionMapper;
import com.gkhy.exam.system.service.ProcessInspectionService;
import net.sf.jsqlparser.expression.operators.relational.ItemsList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.time.LocalDateTime;
import java.util.List;
 
@Service
public class ProcessInspectionServiceImpl extends ServiceImpl<ProcessInspectionMapper, ProcessInspection> implements ProcessInspectionService {
 
    @Autowired
    private ProcessInspectionMapper processInspectionMapper;
 
    @Override
    public CommonPage selectProcessInspectionList(Integer companyId, Integer templateType,Integer itemId) {
        boolean admin = SecurityUtils.adminUser();
        if (!admin){
            if (companyId==null){
                companyId = SecurityUtils.getCompanyId().intValue();
            }
        }
        List<ProcessInspection> processInspections = processInspectionMapper.selectByCompanyidAndTypeList(companyId, templateType, itemId);
        return CommonPage.restPage(processInspections);
    }
 
    @Override
    public CommonResult insertProcessInspection(ProcessInspection processInspection) {
        processInspection.setCreateTime(LocalDateTime.now());
        processInspection.setCreateBy(SecurityUtils.getUsername());
        processInspectionMapper.insert(processInspection);
        return CommonResult.success();
    }
 
    @Override
    public CommonResult updateProcessInspection(ProcessInspection processInspection) {
        processInspection.setUpdateBy(SecurityUtils.getUsername());
        processInspection.setUpdateTime(LocalDateTime.now());
        int update = processInspectionMapper.updateById(processInspection);
        return CommonResult.success();
    }
 
    @Override
    public CommonResult deletedProcessInspection(Integer inspectionId) {
        ProcessInspection processInspection = new ProcessInspection();
        processInspection.setUpdateBy(SecurityUtils.getUsername());
        processInspection.setUpdateTime(LocalDateTime.now());
        processInspection.setId(inspectionId);
        processInspection.setDelFlag(2);
        processInspectionMapper.updateById(processInspection);
        return CommonResult.success();
    }
}