Ver Fonte

元数据

“zhifk” há 2 anos atrás
pai
commit
29fbce8f29

+ 13 - 10
blade-service/blade-business/src/main/java/org/springblade/business/controller/MetadataController.java

@@ -76,16 +76,19 @@ public class MetadataController extends BladeController {
     @ApiOperation(value = "取消捕获", notes = "传入ids")
     public R cancelAllocation(@ApiParam(value = "主键集合", required = true) @RequestParam String ids,@RequestParam String type) {
         MetadataClassification byId = iMetadataClassificationService.getById(Func.toLongList(ids).get(0));
-        String[] split = byId.getFileStorageType().split(",");
-        StringBuffer str = new StringBuffer();
-        for(String s :split){
-            if(s.equals(type)){
-                continue;
-            }
-            str.append(s+",");
-        }
-        String substring = str.toString().substring(0, str.lastIndexOf(","));
-        byId.setFileStorageType(substring);
+//        String[] split = byId.getFileStorageType().split(",");
+//        StringBuffer str = new StringBuffer();
+//        for(String s :split){
+//            if(s.isEmpty()){
+//                continue;
+//            }
+//            if(s.equals(type)){
+//                continue;
+//            }
+//            str.append(s+",");
+//        }
+//        String substring = str.toString().substring(0, str.lastIndexOf(","));
+        byId.setFileStorageType(byId.getFileStorageType().replace(type,""));
         iMetadataClassificationService.updateById(byId);
         return R.status(iMetadataClassificationService.updateById(byId));
     }

+ 2 - 0
blade-service/blade-business/src/main/java/org/springblade/business/mapper/MetadataClassificationMapper.java

@@ -20,4 +20,6 @@ public interface MetadataClassificationMapper extends BaseMapper<MetadataClassif
 
 
     void deleteTableField(@Param("containerInitTabName") String containerInitTabName,@Param("fieldKey") String fieldKey);
+
+    void removeMetadataBytype(@Param("type") String type);
 }

+ 5 - 1
blade-service/blade-business/src/main/java/org/springblade/business/mapper/MetadataClassificationMapper.xml

@@ -77,6 +77,10 @@
         <foreach collection="ids" item="ids" index="ids" open="(" separator="," close=")">
             ${ids}
         </foreach>
-        and locate(#{type},file_storage_type) = 0
+--         and locate(#{type},file_storage_type) = 0
+    </update>
+    <update id="removeMetadataBytype">
+        update u_metadata_classification set file_storage_type = REPLACE(file_storage_type,#{type},'')
+        where  locate(#{type},file_storage_type) = 0
     </update>
 </mapper>

+ 2 - 0
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/MetadataClassificationServiceImpl.java

@@ -91,6 +91,8 @@ public class MetadataClassificationServiceImpl
     @Override
     public boolean updateMetadataBytype(List<Long> ids, String type) {
         try {
+            //先删除在保存
+            baseMapper.removeMetadataBytype(type);
             baseMapper.updateMetadataBytype(ids,type);
         } catch (Exception e) {
             e.printStackTrace();