Bladeren bron

看板相关接口开发2(查询、修改、新增、删除、下拉框)

jichaobo 3 jaren geleden
bovenliggende
commit
5a2e5f1d9f

+ 57 - 4
fiveep-controller/src/main/java/com/bizmatics/controller/web/BulletinCruxConfigController.java

@@ -4,6 +4,8 @@ package com.bizmatics.controller.web;
 import com.bizmatics.common.core.bean.ApiResult;
 import com.bizmatics.model.BulletinAlarmConfig;
 import com.bizmatics.model.BulletinCruxConfig;
+import com.bizmatics.model.DeviceAnalogVariableList;
+import com.bizmatics.model.DeviceAttribute;
 import com.bizmatics.model.vo.BulletinHistoricalConfigAddVo;
 import com.bizmatics.service.BulletinCruxConfigService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -12,7 +14,7 @@ import org.springframework.web.bind.annotation.*;
 import java.util.List;
 
 /**
- * 数据看板-数据配置1
+ * 数据看板
  *
  * @author ya
  * @since 2022-06-01
@@ -25,8 +27,9 @@ public class BulletinCruxConfigController {
 
     /**
      * 数据看板-数据配置查询
-     * @param siteId 站点ID
-     * @param id 配置id
+     *
+     * @param siteId    站点ID
+     * @param id        配置id
      * @param colorType 类型
      * @return
      */
@@ -34,7 +37,7 @@ public class BulletinCruxConfigController {
     public ApiResult<List<Object>> getBulletinCruxConfigList(@RequestParam(value = "siteId") Integer siteId,
                                                              @RequestParam(value = "id", required = false, defaultValue = "0") Integer id,
                                                              @RequestParam(value = "colorType", required = false) String colorType) {
-        return ApiResult.success(bulletinCruxConfigService.getBulletinCruxConfigList(siteId, id,colorType));
+        return ApiResult.success(bulletinCruxConfigService.getBulletinCruxConfigList(siteId, id, colorType));
     }
 
 
@@ -86,5 +89,55 @@ public class BulletinCruxConfigController {
         return ApiResult.success();
     }
 
+
+    /**
+     * 数据看板-数据配置2删除
+     *
+     * @param id 配置ID
+     * @return
+     */
+    @GetMapping("/delBulletinHistoricalConfig")
+    public ApiResult<Void> delBulletinHistoricalConfig(@RequestParam(value = "id") Integer id) {
+        bulletinCruxConfigService.delBulletinHistoricalConfig(id);
+        return ApiResult.success();
+    }
+
+
+    /**
+     * 数据看板-数据配置3删除
+     *
+     * @param id 配置ID
+     * @return
+     */
+    @GetMapping("/delBulletinAlarmConfig")
+    public ApiResult<Void> delBulletinAlarmConfig(@RequestParam(value = "id") Integer id) {
+        bulletinCruxConfigService.delBulletinAlarmConfig(id);
+        return ApiResult.success();
+    }
+
+
+    /**
+     * 监控设备下拉框
+     *
+     * @param siteId 站点id
+     * @return
+     */
+    @GetMapping("/getDeviceAttribute")
+    public ApiResult<List<DeviceAttribute>> getDeviceAttribute(@RequestParam(value = "siteId") Integer siteId) {
+        return ApiResult.success(bulletinCruxConfigService.getDeviceAttribute(siteId));
+    }
+
+
+    /**
+     * 变量下拉框
+     *
+     * @param monitoringEquipment 监控设备ID
+     * @return
+     */
+    @GetMapping("/getDeviceAnalogVariableList")
+    public ApiResult<List<DeviceAnalogVariableList>> getDeviceAnalogVariableList(@RequestParam(value = "monitoringEquipment") Integer monitoringEquipment) {
+        return ApiResult.success(bulletinCruxConfigService.getDeviceAnalogVariableList(monitoringEquipment));
+    }
+
 }
 

+ 4 - 0
fiveep-persistence/src/main/java/com/bizmatics/persistence/mapper/BulletinCruxConfigMapper.java

@@ -18,6 +18,10 @@ import java.util.List;
 public interface BulletinCruxConfigMapper extends CrudMapper<BulletinCruxConfig> {
     int delBulletinCruxConfig(Integer id);
 
+    int delBulletinHistoricalConfig(Integer id);
+
+    int delBulletinAlarmConfig(Integer id);
+
     int delBulletinHistoricalRelation(Integer historicalId);
 
     List<SiteData> getSiteData(Integer siteId);

+ 8 - 0
fiveep-persistence/src/main/resources/mapper/mysql/BulletinCruxConfigMapper.xml

@@ -31,6 +31,14 @@
         delete from bulletin_crux_config where id=#{id}
     </delete>
 
+    <delete id="delBulletinHistoricalConfig" parameterType="Long">
+        delete from bulletin_historical_config where id=#{id}
+    </delete>
+
+    <delete id="delBulletinAlarmConfig" parameterType="Long">
+        delete from bulletin_alarm_config where id=#{id}
+    </delete>
+
     <delete id="delBulletinHistoricalRelation" parameterType="Integer">
         delete from bulletin_historical_relation where historical_id=#{historicalId}
     </delete>

+ 10 - 0
fiveep-service/src/main/java/com/bizmatics/service/BulletinCruxConfigService.java

@@ -3,6 +3,8 @@ package com.bizmatics.service;
 import com.bizmatics.model.BulletinAlarmConfig;
 import com.bizmatics.model.BulletinCruxConfig;
 import com.bizmatics.common.mvc.base.CrudService;
+import com.bizmatics.model.DeviceAnalogVariableList;
+import com.bizmatics.model.DeviceAttribute;
 import com.bizmatics.model.vo.BulletinCruxConfigVo;
 import com.bizmatics.model.vo.BulletinHistoricalConfigAddVo;
 import com.bizmatics.model.vo.BulletinHistoricalRelationVo;
@@ -29,6 +31,14 @@ public interface BulletinCruxConfigService extends CrudService<BulletinCruxConfi
 
     void delBulletinCruxConfig(Integer id);
 
+    void delBulletinHistoricalConfig(Integer id);
+
+    void delBulletinAlarmConfig(Integer id);
+
+    List<DeviceAttribute> getDeviceAttribute(Integer siteId);
+
+    List<DeviceAnalogVariableList> getDeviceAnalogVariableList(Integer monitoringEquipment);
+
     List<BulletinCruxConfigVo> getBulletinHistoricalConfig(Integer siteId,Integer id);
 
     List<BulletinHistoricalRelationVo> getBulletinHistoricalRelationVo(Integer siteId);

+ 43 - 1
fiveep-service/src/main/java/com/bizmatics/service/impl/BulletinCruxConfigServiceImpl.java

@@ -41,6 +41,8 @@ public class BulletinCruxConfigServiceImpl extends AbstractCrudService<BulletinC
     private BulletinHistoricalRelationService bulletinHistoricalRelationService;
     @Autowired
     private BulletinAlarmConfigService bulletinAlarmConfigService;
+    @Autowired
+    private DeviceAttributeService deviceAttributeService;
 
     /**
      * 数据看板-数据配置查询
@@ -81,6 +83,7 @@ public class BulletinCruxConfigServiceImpl extends AbstractCrudService<BulletinC
                 }
             }
         } else {
+            id = 0;
             //配置数据查询1
             List<BulletinCruxConfigVo> lsit1 = this.getbulletinCruxConfig(siteId, id);
             if (lsit1.size() > 0) {
@@ -473,9 +476,48 @@ public class BulletinCruxConfigServiceImpl extends AbstractCrudService<BulletinC
     /**
      * 数据看板-数据配置1删除
      *
-     * @param id
+     * @param id 配置ID
      */
+    @Override
     public void delBulletinCruxConfig(Integer id) {
         baseMapper.delBulletinCruxConfig(id);
     }
+
+    /**
+     * 数据看板-数据配置2删除
+     * @param id 配置ID
+     */
+    @Transactional
+    @Override
+    public void delBulletinHistoricalConfig(Integer id) {
+        baseMapper.delBulletinHistoricalConfig(id);
+        baseMapper.delBulletinHistoricalRelation(id);
+    }
+
+    /**
+     * 数据看板-数据配置3删除
+     * @param id 配置ID
+     */
+    @Override
+    public void delBulletinAlarmConfig(Integer id) {
+        baseMapper.delBulletinAlarmConfig(id);
+    }
+
+
+
+    @Override
+    public List<DeviceAttribute> getDeviceAttribute(Integer siteId){
+        LambdaQueryWrapper<DeviceAttribute> queryWrapper = Wrappers.lambdaQuery();
+        queryWrapper.eq(DeviceAttribute::getSiteId, siteId);
+        List<DeviceAttribute> list = deviceAttributeService.list(queryWrapper);
+        return list;
+    }
+
+    @Override
+    public List<DeviceAnalogVariableList> getDeviceAnalogVariableList(Integer monitoringEquipment){
+        LambdaQueryWrapper<DeviceAnalogVariableList> queryWrapper = Wrappers.lambdaQuery();
+        queryWrapper.eq(DeviceAnalogVariableList::getMonitoringEquipment, monitoringEquipment);
+        List<DeviceAnalogVariableList> list = deviceAnalogVariableListService.list(queryWrapper);
+        return list;
+    }
 }