wuzeyu
2024-01-18 9281643d18bc2e0aaffed3c5f216d1df12d68424
pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/controller/ControllerSv.java
@@ -1,7 +1,10 @@
package com.dy.pipIrrProject.controller;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.dy.common.webUtil.QueryResultVo;
import com.dy.pipIrrGlobal.daoPr.PrControllerMapper;
import com.dy.pipIrrGlobal.daoPr.PrIntakeMapper;
import com.dy.pipIrrGlobal.pojoPr.PrController;
import com.dy.pipIrrGlobal.voPr.VoController;
import lombok.extern.slf4j.Slf4j;
@@ -12,6 +15,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
/**
 * @author ZhuBaoMin
@@ -25,6 +29,9 @@
public class ControllerSv {
    @Autowired
    private PrControllerMapper prControllerMapper;
    @Autowired
    private PrIntakeMapper prIntakeMapper;
    /**
     * 根据指定获取控制器记录
@@ -94,7 +101,42 @@
        return rsVo ;
    }
    /**
     * 根据控制器编号获取未删除的控制器数量
     * @param controllerId
     * @return
     */
    public Integer getRecordCountOfController(Long controllerId) {
        return prControllerMapper.getRecordCountOfController(controllerId);
    }
    /**
     * 根据控制器编号获取已绑定记录数
     * @param controllerId
     * @return
     */
    public Integer getBindedCount(Long controllerId) {
        return prControllerMapper.getBindedCount(controllerId);
    }
    /**
     * 根据主键删除外键
     * @param controllerId
     * @return
     */
    public Integer deleteIntakeId(Long controllerId) {
        return prControllerMapper.deleteIntakeId(controllerId);
    }
    /**
     * 获取未绑控制器的取水口列表
     * @return
     */
    public JSONArray getNoBindingIntakes() {
        List<Map<String, Object>> list = Optional.ofNullable(prIntakeMapper.getNoBindingIntakes()).orElse(new ArrayList<>());
        JSONArray array= null;
        if(list.size() > 0) {
            array= JSONArray.parseArray(JSON.toJSONString(list));
        }
        return array;
    }
}