邱宇豪
2023-11-01 9100d3fa53c50ba5c5ca3972724a9f8ad905eea0
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
package com.thhy.engineering.modules.biz.device.service.impl;
 
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.github.pagehelper.util.StringUtil;
import com.thhy.engineering.modules.biz.device.entity.TBigMaintenance;
import com.thhy.engineering.modules.biz.device.mapper.TBigMaintenanceMapper;
import com.thhy.engineering.modules.biz.device.service.TBigMaintenanceService;
import com.thhy.general.common.BasicResult;
import com.thhy.general.config.SysUserInfo;
import com.thhy.general.utils.UserInfoUtils;
import org.springframework.stereotype.Service;
 
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
 
@Service
public class TBigMaintenanceServiceImpl implements TBigMaintenanceService {
 
    @Resource
    private TBigMaintenanceMapper bigMaintenanceMapper;
 
 
    @Override
    public BasicResult maintenanceInsert(Map<String, Object> values) {
        SysUserInfo sysUserInfo = UserInfoUtils.getInstance().getUserInfo();
        String userId = sysUserInfo.getUserId();
 
        String maintenanceNumber = values.get("maintenanceNumber").toString();
        String bigMaintenanceId = bigMaintenanceMapper.maintenanceByOne(maintenanceNumber);
        if(!StringUtil.isEmpty(bigMaintenanceId)){
            return BasicResult.faild("11111","保养编号重复","error");
        }
        values.put("bigMaintenanceId","");
        values.put("createUser",userId);
        bigMaintenanceMapper.maintenanceInsert(values);
        return BasicResult.success("添加成功");
    }
 
    @Override
    public BasicResult maintenanceList(Map<String, Object> values) {
        SysUserInfo sysUserInfo = UserInfoUtils.getInstance().getUserInfo();
        String companyId = sysUserInfo.getCompanyId();
        values.put("companyId",companyId);
        Integer pageSize = Integer.valueOf(values.get("pageSize").toString());
        Integer pageNum = Integer.valueOf(values.get("pageNum").toString());
        PageHelper.startPage(pageNum,pageSize);
        List<TBigMaintenance> bigMaintenances = bigMaintenanceMapper.maintenanceList(values);
        PageInfo<TBigMaintenance> tBigMaintenancePageInfo = new PageInfo<>(bigMaintenances);
        return BasicResult.success(tBigMaintenancePageInfo);
    }
 
    @Override
    public BasicResult maintenanceInfo(String bigMaintenanceId) {
        TBigMaintenance bigMaintenances = bigMaintenanceMapper.maintenanceInfo(bigMaintenanceId);
        return BasicResult.success(bigMaintenances);
    }
 
    @Override
    public BasicResult maintenanceDel(String bigMaintenanceId) {
 
        bigMaintenanceMapper.maintenanceDel(bigMaintenanceId);
 
        return BasicResult.success("删除成功");
    }
 
    @Override
    public BasicResult maintenanceUpdate(Map<String, Object> values) {
        String bigMaintenanceId1 = values.get("bigMaintenanceId").toString();
 
        String maintenanceNumber = values.get("maintenanceNumber").toString();
        String bigMaintenanceId = bigMaintenanceMapper.maintenanceByOne(maintenanceNumber);
        if(!StringUtil.isEmpty(bigMaintenanceId)&&!bigMaintenanceId1.equals(bigMaintenanceId)){
            return BasicResult.faild("11111","保养编号重复","error");
        }
 
        bigMaintenanceMapper.maintenanceUpdate(values);
        return BasicResult.success("修改成功");
    }
}