wuzeyu
2024-06-13 1ec6fc4c9af507b149ca52ccc08fac06437020d5
pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/FlowmeterSv.java
@@ -1,10 +1,16 @@
package com.dy.pipIrrProject.flowMonitoring;
import com.dy.common.webUtil.QueryResultVo;
import com.dy.pipIrrGlobal.daoPr.PrFlowmeterMapper;
import com.dy.pipIrrGlobal.pojoPr.PrFlowmeter;
import com.dy.pipIrrGlobal.voPr.VoFlowMeter;
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
@@ -42,7 +48,45 @@
     * @param flowmeterId
     * @return
     */
    public Integer getRecordCountOfFlowmeter(Long flowmeterId) {
        return prFlowmeterMapper.getRecordCountOfFlowmeter(flowmeterId);
    public Integer getRecordCountOfFlowmeterByCode(Long flowmeterId) {
        return prFlowmeterMapper.getRecordCountOfFlowmeterByCode(flowmeterId);
    }
    /**
     * 根据指定条件得到流量计实体记录
     * @param queryVo 给的条件
     * @return 流量计实体集合
     */
    public QueryResultVo<List<VoFlowMeter>> getFlowMeters(QueryVoFlowMeter queryVo){
        Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo) ;
        Integer itemTotal = prFlowmeterMapper.getRecordCountOfFlowMeterByOthers(params);
        QueryResultVo<List<VoFlowMeter>> rsVo = new QueryResultVo<>() ;
        rsVo.pageSize = queryVo.pageSize ;
        rsVo.pageCurr = queryVo.pageCurr ;
        // 计算符合条件的记录数
        rsVo.calculateAndSet(itemTotal.longValue(), params);
        rsVo.obj = prFlowmeterMapper.getFlowMeters(params);
        return rsVo ;
    }
    /**
     * 得到全部流量计
     * @return
     */
    public List<PrFlowmeter> getFlowMeterAll(){
        List<PrFlowmeter> all = prFlowmeterMapper.selectAll();
        return all;
    }
    /**
     * 给流量计表加监测站ID外键
     * @param
     * @return
     */
    public Integer flowmeterAddMonId(PrFlowmeter record){
        return prFlowmeterMapper.flowmeterAddMonId(record);
    }
}