wuzeyu
2024-02-27 a60332d51fec0ae9f1afecc8c7a018c77e4ac101
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
package com.dy.pipIrrProject.flowMonitoring;
 
import com.dy.common.webUtil.QueryResultVo;
import com.dy.pipIrrGlobal.daoBa.BaDistrictMapper;
import com.dy.pipIrrGlobal.daoPr.PrFlowMonitoringMapper;
import com.dy.pipIrrGlobal.pojoPr.PrFlowMonitoring;
import com.dy.pipIrrGlobal.voPr.VoFlowMonitoring;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.common.utils.PojoUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.util.List;
import java.util.Map;
 
/**
 * @author ZhuBaoMin
 * @date 2024-01-04 16:11
 * @LastEditTime 2024-01-04 16:11
 * @Description
 */
 
@Slf4j
@Service
public class FlowMonitoringSv {
    @Autowired
    private PrFlowMonitoringMapper prFlowMonitoringMapper;
 
    @Autowired
    private BaDistrictMapper baDistrictMapper;
 
    /**
     * 根据村编号获取5级区划信息
     * @param villageId 村编号(主键)
     * @return 5级行政区划信息
     */
    public Map getDistrictsByVillageId(Long villageId) {
        return baDistrictMapper.getDistrictsByVillageId(villageId);
    }
 
    /**
     * 添加管网流量监测站
     * @param prFlowMonitoring 流量监测站实体
     * @return
     */
    public Integer addFlowMonitoring(PrFlowMonitoring prFlowMonitoring) {
        return prFlowMonitoringMapper.insert(prFlowMonitoring);
    }
 
    /**
     * 根据监测站编号删除监测站
     * @param flowMonitoringId
     * @return
     */
    public Integer deleteFlowMonitoring(Long flowMonitoringId) {
        return prFlowMonitoringMapper.deleteFlowMonitoringById(flowMonitoringId);
    }
 
    /**
     * 根据监测站编号获取未删除的监测站数量
     * @param flowMonitoringId 流量监测站编号
     * @return
     */
    public Integer getRecordCountOfFlowMonitoringByFlowMonitoringId(Long flowMonitoringId) {
        return prFlowMonitoringMapper.getRecordCountOfFlowMonitoringByFlowMonitoringId(flowMonitoringId);
    }
 
    /**
     * 得到一个流量监测站
     * @param id 监测站ID
     * @return 监测站实体
     */
    public PrFlowMonitoring selectById(Long id) {
        return prFlowMonitoringMapper.selectByPrimaryKey(id);
    }
 
    /**
     * 得到全部流量监测站
     * @return 监测站实体集合
     */
    public QueryResultVo<List<PrFlowMonitoring>> selectAll(){
        QueryResultVo<List<PrFlowMonitoring>> rsVo = new QueryResultVo<>() ;
        rsVo.obj = this.prFlowMonitoringMapper.selectAll() ;
        return rsVo ;
    }
 
 
    /**
     * 根据指定条件得到流量监测站实体记录
     * @param queryVo 给的条件
     * @return 监测站实体集合
     */
    public QueryResultVo<List<VoFlowMonitoring>> getPrFlowMonitorings(QueryVo queryVo){
        Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo) ;
 
        QueryResultVo<List<VoFlowMonitoring>> rsVo = new QueryResultVo<>() ;
        rsVo.pageSize = queryVo.pageSize ;
        rsVo.pageCurr = queryVo.pageCurr ;
 
        // 计算符合条件的记录数
        Integer itemTotal = prFlowMonitoringMapper.getRecordCountOfFlowMonitoring(params);
        rsVo.calculateAndSet(itemTotal.longValue(), params);
        rsVo.obj = prFlowMonitoringMapper.getPrFlowMonitoring(params);
 
        return rsVo ;
    }
 
    /**
     * 保存修改一个流量监测站实体
     * @param po 修改的内容(id不为空)
     * @return
     */
    public int update (PrFlowMonitoring po){
        return prFlowMonitoringMapper.updateByPrimaryKeySelective(po);
    }
}