wenwj
2025-04-09 9616ac1d0297e009ba662ce061d8d42dc8238978
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
package com.aps.core.service.impl;
 
import java.util.List;
 
import com.aps.common.core.utils.uuid.IdUtils;
import com.aps.core.domain.ApsGasPipingPlanTemp;
import com.aps.core.domain.ApsPartPlan;
import com.aps.core.domain.ApsPartPlanTemp;
import com.aps.core.mapper.ApsGasPipingPlanTempMapper;
import com.aps.core.mapper.ApsPartPlanMapper;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.aps.core.mapper.ApsGasPipingPlanMapper;
import com.aps.core.domain.ApsGasPipingPlan;
import com.aps.core.service.IApsGasPipingPlanService;
 
/**
 * 气体管路计划管理Service业务层处理
 * 
 * @author wwj
 * @date 2025-04-09
 */
@Service
public class ApsGasPipingPlanServiceImpl implements IApsGasPipingPlanService 
{
    @Autowired
    private ApsGasPipingPlanMapper apsGasPipingPlanMapper;
    @Autowired
    private ApsGasPipingPlanTempMapper apsGasPipingPlanTempMapper;
 
    /**
     * 查询气体管路计划管理
     * 
     * @param id 气体管路计划管理主键
     * @return 气体管路计划管理
     */
    @Override
    public ApsGasPipingPlan selectApsGasPipingPlanById(String id)
    {
        return apsGasPipingPlanMapper.selectApsGasPipingPlanById(id);
    }
 
    /**
     * 查询气体管路计划管理列表
     * 
     * @param apsGasPipingPlan 气体管路计划管理
     * @return 气体管路计划管理
     */
    @Override
    public List<ApsGasPipingPlan> selectApsGasPipingPlanList(ApsGasPipingPlan apsGasPipingPlan)
    {
        return apsGasPipingPlanMapper.selectApsGasPipingPlanList(apsGasPipingPlan);
    }
 
    /**
     * 新增气体管路计划管理
     * 
     * @param apsGasPipingPlan 气体管路计划管理
     * @return 结果
     */
    @Override
    public int insertApsGasPipingPlan(ApsGasPipingPlan apsGasPipingPlan)
    {
        apsGasPipingPlan.setId(IdUtils.fastUUID());
        return apsGasPipingPlanMapper.insertApsGasPipingPlan(apsGasPipingPlan);
    }
 
    /**
     * 修改气体管路计划管理
     * 
     * @param apsGasPipingPlan 气体管路计划管理
     * @return 结果
     */
    @Override
    public int updateApsGasPipingPlan(ApsGasPipingPlan apsGasPipingPlan)
    {
        return apsGasPipingPlanMapper.updateApsGasPipingPlan(apsGasPipingPlan);
    }
 
    /**
     * 批量删除气体管路计划管理
     * 
     * @param ids 需要删除的气体管路计划管理主键
     * @return 结果
     */
    @Override
    public int deleteApsGasPipingPlanByIds(String[] ids)
    {
        return apsGasPipingPlanMapper.deleteApsGasPipingPlanByIds(ids);
    }
 
    /**
     * 删除气体管路计划管理信息
     * 
     * @param id 气体管路计划管理主键
     * @return 结果
     */
    @Override
    public int deleteApsGasPipingPlanById(String id)
    {
        return apsGasPipingPlanMapper.deleteApsGasPipingPlanById(id);
    }
 
    @Override
    public int confirmGasPiping(ApsGasPipingPlanTemp apsGasPipingPlanTemp) {
        //查询临时表数据
        List<ApsGasPipingPlanTemp> apsGasPipingPlanTemps=apsGasPipingPlanTempMapper.selectApsGasPipingPlanTempList(apsGasPipingPlanTemp);
        int count=0;
        String[] ids=new String[apsGasPipingPlanTemps.size()];
        for (int i = 0; i <apsGasPipingPlanTemps.size() ; i++) {
            //记录临时表id
            ids[i]=apsGasPipingPlanTemps.get(i).getId();
            ApsGasPipingPlan apsGasPipingPlan=new ApsGasPipingPlan();
            BeanUtils.copyProperties(apsGasPipingPlanTemps.get(i), apsGasPipingPlan);
            apsGasPipingPlan.setId(IdUtils.fastUUID());
            //插入正式表,并记录
            apsGasPipingPlanMapper.insertApsGasPipingPlan(apsGasPipingPlan);
            count++;
        }
        //插入数量与临时表查询一直则删除临时表数据
        if (count==apsGasPipingPlanTemps.size()) {
            apsGasPipingPlanTempMapper.deleteApsGasPipingPlanTempByIds(ids);
        }
        return 0;
    }
}