zhoupeng 1 year ago
parent
commit
d4af249fc9

+ 4 - 0
industry-system/industry-da/src/main/java/com/example/opc_da/config/InterceptorConfig.java

@@ -48,6 +48,10 @@ public class InterceptorConfig implements WebMvcConfigurer {
                 .excludePathPatterns("/trafficChart/getTrafficChartById")
                 .excludePathPatterns("/deviceLedger/getDeviceDirectoryLevel")
                 .excludePathPatterns("/deviceLedger/getDeviceDirectoryAlarm")
+                .excludePathPatterns("/deviceLedger/getLedgerItemList")
+                .excludePathPatterns("/deviceLedger/getLedgerByDirectoryId")
+                .excludePathPatterns("/deviceLedger/getItemByLedgerId")
+                .excludePathPatterns("/deviceLedger/getDeviceLedgerAll")
                 //针对的后台系统放行的拦截
                 .excludePathPatterns("/")
                 .excludePathPatterns("/page/index.html")

+ 14 - 3
industry-system/industry-da/src/main/java/com/example/opc_da/controller/DeviceLedgerController.java

@@ -265,13 +265,24 @@ public class DeviceLedgerController {
 
     /**
      * 通过设备台账id,获取所有的设备关联的数据项
-     * @param ledgerId
+     * @param deviceLedgerId
      * @return
      */
     @RequestMapping(value = "/getItemByLedgerId", method = RequestMethod.GET)
     @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.DEVICELEDGER, OperationEnum = OperationEnum.SELECT)
-    public Result getItemByLedgerId(@RequestParam Integer ledgerId) {
-        return deviceLedgerService.getItemByLedgerId(ledgerId);
+    public Result getItemByLedgerId(@RequestParam Integer deviceLedgerId) {
+        return deviceLedgerService.getItemByLedgerId(deviceLedgerId);
+    }
+
+    /**
+     * 通过设备目录id,获取所有的信息
+     * @param directoryId
+     * @return
+     */
+    @RequestMapping(value = "/getDeviceLedgerAll", method = RequestMethod.GET)
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.DEVICELEDGER, OperationEnum = OperationEnum.SELECT)
+    public Result getDeviceLedgerAll(@RequestParam Integer directoryId) {
+        return deviceLedgerService.getDeviceLedgerAll(directoryId);
     }
 
 }

+ 3 - 1
industry-system/industry-da/src/main/java/com/example/opc_da/dao/DeviceLedgerDao.java

@@ -75,5 +75,7 @@ public interface DeviceLedgerDao {
 
     List<DeviceLedger> getLedgerByDirectoryId(Integer directoryId);
 
-    List<Item> getItemByLedgerId(Integer ledgerId);
+    List<Item> getItemByLedgerId(Integer deviceLedgerId);
+
+    Integer delLedgerItemByLedgerId(Integer deviceLedgerId);
 }

+ 3 - 1
industry-system/industry-da/src/main/java/com/example/opc_da/service/DeviceLedgerService.java

@@ -45,5 +45,7 @@ public interface DeviceLedgerService {
 
     Result getLedgerByDirectoryId(Integer directoryId);
 
-    Result getItemByLedgerId(Integer ledgerId);
+    Result getItemByLedgerId(Integer deviceLedgerId);
+
+    Result getDeviceLedgerAll(Integer directoryId);
 }

+ 9 - 2
industry-system/industry-da/src/main/java/com/example/opc_da/service/impl/DeviceLedgerServiceImpl.java

@@ -256,6 +256,7 @@ public class DeviceLedgerServiceImpl implements DeviceLedgerService {
         if (deviceLedgerDao.delDeviceLedgerById(id) <= 0) {
             return Result.no(ResultEnum.SERVER_ERROR.getRespCode(), "删除设备台账失败");
         }
+        deviceLedgerDao.delLedgerItemByLedgerId(id);
         List<TechnicalData> technicalDataList = deviceLedgerDao.getTechnicalByLedgerId(id);
         List<DevicePicture> pictureList = deviceLedgerDao.getPictureByLedgerId(id);
         deviceLedgerDao.delTechnicalByLedgerId(id);
@@ -384,7 +385,13 @@ public class DeviceLedgerServiceImpl implements DeviceLedgerService {
     }
 
     @Override
-    public Result getItemByLedgerId(Integer ledgerId) {
-        return Result.ok(deviceLedgerDao.getItemByLedgerId(ledgerId));
+    public Result getItemByLedgerId(Integer deviceLedgerId) {
+        return Result.ok(deviceLedgerDao.getItemByLedgerId(deviceLedgerId));
+    }
+
+    @Override
+    public Result getDeviceLedgerAll(Integer directoryId) {
+        List<DeviceLedger> deviceLedgerList = deviceLedgerDao.getLedgerByDirectoryId(directoryId);
+        return null;
     }
 }

+ 6 - 0
industry-system/industry-da/src/main/resources/mapper/DeviceLedgerDao.xml

@@ -168,6 +168,12 @@
         </if>
     </delete>
 
+    <delete id="delLedgerItemByLedgerId">
+        delete
+        from t_device_ledger_item
+        where device_ledger_id = #{deviceLedgerId}
+    </delete>
+
     <select id="getDeviceDirectoryByName" resultType="com.example.opc_common.entity.DeviceDirectory">
         select
         <include refid="deviceDirectory"/>