文档库--验证文档是否被绑定
This commit is contained in:
+16
@@ -408,6 +408,22 @@ public class BussDocumentLibraryEOController extends JeroController<BussDocument
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 验证文档是否被其他的文档绑定
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "验证文档是否被其他的文档绑定")
|
||||
@ApiOperation(value="验证文档是否被其他的文档绑定", notes="验证文档是否被其他的文档绑定")
|
||||
@GetMapping(value = "/verifyBind")
|
||||
public Result<?> verifyBind(@RequestParam(name="ids",required=true) String ids) {
|
||||
String msg = bussDocumentLibraryEOService.verifyBind(Arrays.asList(ids.split(",")));
|
||||
return Result.OK(msg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
+2
@@ -83,5 +83,7 @@ public interface BussDocumentLibraryEOMapper extends BaseMapper<BussDocumentLibr
|
||||
|
||||
List<Map<String,Object>> selectMapsAll(@Param("ids") String ids);
|
||||
|
||||
List<Map<String,Object>> getListInfo(@Param("condition") String condition);
|
||||
|
||||
|
||||
}
|
||||
|
||||
+5
@@ -94,4 +94,9 @@
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getListInfo" resultType="java.util.LinkedHashMap">
|
||||
select * from buss_document_library
|
||||
where ${condition}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
+2
@@ -189,4 +189,6 @@ public interface IBussDocumentLibraryEOService extends IService<BussDocumentLibr
|
||||
|
||||
void importZip(MultipartFile file);
|
||||
|
||||
String verifyBind(List<String> ids);
|
||||
|
||||
}
|
||||
|
||||
+20
@@ -3008,4 +3008,24 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
||||
}
|
||||
}
|
||||
|
||||
public String verifyBind(List<String> ids){
|
||||
//判断删除的数据是否被其他文档引用
|
||||
StringBuilder condition = new StringBuilder();
|
||||
for (String id : ids) {
|
||||
condition.append(" corresponding_standard like concat(concat('%','" + id + "'),'%') or replace_standard like concat(concat('%','" + id + "'),'%') or" );
|
||||
}
|
||||
String conditionStr = condition.substring(0, condition.length() - 2);
|
||||
List<Map<String, Object>> listInfo = bussDocumentLibraryEOMapper.getListInfo(conditionStr);
|
||||
List<String> serialNumbers = new ArrayList<>();
|
||||
if(listInfo.size() != 0){
|
||||
for (Map<String, Object> map : listInfo) {
|
||||
serialNumbers.add((String) map.get("serial_number"));
|
||||
}
|
||||
}
|
||||
if(serialNumbers.size() != 0){
|
||||
return StringUtils.join(serialNumbers,",")+"已被其他文档绑定,是否要删除";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user