heheng
22 小时以前 6faa8da685a95b1fce5f432f5bd41a870ccb5ade
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
62
63
64
65
66
package com.gkhy.exam.system.service.impl;
 
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.gkhy.exam.common.api.CommonPage;
import com.gkhy.exam.common.api.CommonResult;
import com.gkhy.exam.common.constant.UserConstant;
import com.gkhy.exam.common.utils.PageUtils;
import com.gkhy.exam.common.utils.SecurityUtils;
import com.gkhy.exam.system.domain.AnnualVerificationPlan;
import com.gkhy.exam.system.domain.CalibrationMonitoringEquipment;
import com.gkhy.exam.system.mapper.CalibrationMonitoringEquipmentMapper;
import com.gkhy.exam.system.service.CalibrationMonitoringEquipmentService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.time.LocalDateTime;
import java.util.List;
 
/**
 * <p>
 * 监测和测量设备校准确认表     服务实现类
 * </p>
 *
 * @author hh
 * @since 2025-08-25 15:01:44
 */
@Service
public class CalibrationMonitoringEquipmentServiceImpl extends ServiceImpl<CalibrationMonitoringEquipmentMapper, CalibrationMonitoringEquipment> implements CalibrationMonitoringEquipmentService {
 
    @Autowired
    private CalibrationMonitoringEquipmentMapper calibrationMonitoringEquipmentMapper;
 
    @Override
    public CommonPage selectCalibrationMonitoringEquipmentList(CalibrationMonitoringEquipment calibrationMonitoringEquipment) {
        PageUtils.startPage();
        List<CalibrationMonitoringEquipment> calibrationMonitoringEquipments = calibrationMonitoringEquipmentMapper.selectCalibrationMonitoringEquipmentList(calibrationMonitoringEquipment);
        return CommonPage.restPage(calibrationMonitoringEquipments);
    }
 
    @Override
    public CommonResult saveCalibrationMonitoringEquipment(CalibrationMonitoringEquipment calibrationMonitoringEquipment) {
        int i = 0;
        if (calibrationMonitoringEquipment.getId() == null){
            calibrationMonitoringEquipment.setCreateBy(SecurityUtils.getUsername());
            calibrationMonitoringEquipment.setCreateTime(LocalDateTime.now());
            i = calibrationMonitoringEquipmentMapper.insert(calibrationMonitoringEquipment);
        }else {
            calibrationMonitoringEquipment.setUpdateTime(LocalDateTime.now());
            calibrationMonitoringEquipment.setUpdateBy(SecurityUtils.getUsername());
            i = calibrationMonitoringEquipmentMapper.updateById(calibrationMonitoringEquipment);
        }
 
        return i > 0 ? CommonResult.success() : CommonResult.failed();
    }
 
    @Override
    public CommonResult deletedCalibrationMonitoringEquipment(Long id) {
        int i = calibrationMonitoringEquipmentMapper.update(new CalibrationMonitoringEquipment(),
                new LambdaUpdateWrapper<CalibrationMonitoringEquipment>().eq(CalibrationMonitoringEquipment::getId, id).set(CalibrationMonitoringEquipment::getDelFlag, UserConstant.DISENABLE)
                        .set(CalibrationMonitoringEquipment::getUpdateTime, LocalDateTime.now()).set(CalibrationMonitoringEquipment::getUpdateBy, SecurityUtils.getUsername())
        );
 
        return CommonResult.success();
    }
}