瀏覽代碼

接口制作与完善,前端界面完成

kindring 2 年之前
父節點
當前提交
23893fa484

+ 3 - 4
src/main/java/com/genersoft/iot/vmp/storager/dao/HfyDevAiMapper.java

@@ -106,10 +106,9 @@ public interface HfyDevAiMapper {
     @Update(value = {"<script>" +
             "update ai_library" +
             " set" +
-            " version='${version}'"+
-            " <if test=\"libraryName\">, libraryName='${name}'</if>" +
-            " <if test=\"arithmetic\">, libraryName='${arithmetic}'</if>" +
-            " <if test=\"total\">, total='${total}'</if>" +
+            " version=${version}"+
+            " <if test=\"libraryName != null\">, libraryName='${libraryName}'</if>" +
+            " <if test=\"total != null\">, total='${total}'</if>" +
             " where libraryId = '${libraryId}'" +
             "</script>" })
     int updateAiLibrary(AiLib aiLib);

+ 7 - 1
src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java

@@ -295,6 +295,7 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
 	}
 	public int editLib(int libraryId,AiLib aiLib){
 		List<AiLib> aiLibArr = HfyDevAiMapper.getAiLibraryByLibId(libraryId);
+		logger.info("测试测试测试");
 		if(aiLibArr.isEmpty()){throw new ControllerException(ErrorCode.ERROR400.getCode(),"无法找到lib库");}
 		AiLib libData = aiLibArr.stream().findFirst().get();
 		if(aiLib.getLibraryName() == "" &&
@@ -304,13 +305,18 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
 		}
 		AiLib changeAiLibData = new AiLib();
 		changeAiLibData.setLibraryId(libraryId);
-		if(aiLib.getVersion() != ""){
+		logger.info("测试测试测试2");
+		if(aiLib.getVersion() == "" ){
+			logger.info("设置ai");
 			changeAiLibData.setVersion(aiLib.getVersion());
 		}else{
+			logger.info("设置数据库");
 			changeAiLibData.setVersion(libData.getVersion());
 		}
+		logger.info("测试测试测试3");
 		if(aiLib.getTotal() != 0){changeAiLibData.setTotal(aiLib.getTotal());}
 		if(aiLib.getLibraryName() != ""){changeAiLibData.setLibraryName(aiLib.getLibraryName());}
+		logger.info("测试测试测试4");
 		return HfyDevAiMapper.updateAiLibrary(changeAiLibData);
 	}
 	/**

+ 1 - 1
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceConfig.java

@@ -152,7 +152,7 @@ public class DeviceConfig {
 	@PostMapping("/editLib/{libraryId}")
 	public int editLib(@PathVariable int libraryId,@RequestBody AiLib aiLib){
 		if (logger.isDebugEnabled()) {
-			logger.debug("ai库子项数据查询");
+			logger.debug("编辑ai库");
 		}
 		return storager.editLib(libraryId,aiLib);
 	}

+ 3 - 1
web_src/src/components/editLib.vue

@@ -151,16 +151,18 @@ export default {
       let data = {
         libraryName: this.libraryName,
       }
-      let [err,res] = await handle(this.$axios.post(`/api/device/query/editLib/${this.libraryId}`,data));
+      let [err,res] = await handle(this.$axios.post(`/api/device/config/editLib/${this.libraryId}`,data));
       this.isLoading = false;
       console.log(res);
       if(err){
         console.error(err);
         return this.$message.error(err.message);
       }
+      this.isEdit = false;
       let result = res.data;
       if(result.code === 0){
         this.libData.libraryName = data.libraryName;
+        this.$message.success("修改成功");
       }
     },
     async submitData(){