解决综合浏览数据资源查询时关键字不为空查询报错的问题

master
guoxin 1 year ago
parent 88c0238889
commit 0af7c58b60
  1. 14
      shandan-system/src/main/java/com/keyware/shandan/bianmu/mapper/DirectoryResourceMapper.java

@ -20,15 +20,15 @@ public interface DirectoryResourceMapper extends BaseMapper<DirectoryResource> {
" SELECT DISTINCT TT.* FROM (" +
" SELECT * FROM V_DIRECTORY_RESOURCE VDR WHERE DIRECTORY_PATH LIKE (#{dirPath} || '%') AND EXISTS(SELECT 1 FROM B_DIRECTORY D1 WHERE D1.ID = VDR.PARENT_ID AND D1.REVIEW_STATUS IN ('PASS','SUBMITTED'))" +
" ) TT " +
" LEFT JOIN (SELECT B2.*, B1.ENTITY_ID FROM B_DATA_LABEL_ENTITY B1 INNER JOIN B_DATA_LABELS B2 ON B1.LABEL_ID = B2.ID) DLN ON DLN.ENTITY_ID = TT.ID " +
" WHERE 1=1 " +
" <when test='labels != null and labels.size > 0'>" +
" LEFT JOIN B_DATA_LABEL_ENTITY DLN ON DLN.ENTITY_ID = TT.ID " +
" WHERE 1=1 " +
" <foreach item=\"label\" collection=\"labels\">" +
" AND (DLN.ID_PATH LIKE (#{label.idPath + label.id + '/'} || '%') OR DLN.ID = #{label.id})" +
" AND (DLN.ID_PATH LIKE (#{label.idPath} || '%') OR DLN.ID = #{label.id})" +
" </foreach>" +
" </when>" +
" <when test=\"ew.sqlSegment != null and ew.sqlSegment != '' and ew.sqlSegment != '()'\">" +
" ${ew.sqlSegment}" +
" AND ${ew.sqlSegment}" +
" </when>" +
"</script>")
@ResultType(DirectoryResource.class)
@ -38,15 +38,15 @@ public interface DirectoryResourceMapper extends BaseMapper<DirectoryResource> {
" SELECT DISTINCT TT.* FROM (" +
" SELECT * FROM V_DIRECTORY_RESOURCE VDR WHERE DIRECTORY_PATH LIKE (#{dirPath} || '%') AND EXISTS(SELECT 1 FROM B_DIRECTORY D1 WHERE D1.ID = VDR.PARENT_ID AND D1.REVIEW_STATUS IN ('PASS','SUBMITTED'))" +
" ) TT " +
" LEFT JOIN (SELECT B2.*, B1.ENTITY_ID FROM B_DATA_LABEL_ENTITY B1 INNER JOIN B_DATA_LABELS B2 ON B1.LABEL_ID = B2.ID) DLN ON DLN.ENTITY_ID = TT.ID " +
" WHERE 1=1 " +
" <when test='labels != null and labels.size > 0'>" +
" LEFT JOIN (SELECT B2.*, B1.ENTITY_ID FROM B_DATA_LABEL_ENTITY B1 INNER JOIN B_DATA_LABELS B2 ON B1.LABEL_ID = B2.ID) DLN ON DLN.ENTITY_ID = TT.ID " +
" WHERE 1=1 " +
" <foreach item=\"label\" collection=\"labels\">" +
" AND (DLN.ID_PATH LIKE (#{label.idPath} || '%') OR DLN.ID = #{label.id})" +
" </foreach>" +
" </when>" +
" <when test=\"ew.sqlSegment != null and ew.sqlSegment != '' and ew.sqlSegment != '()'\">" +
" ${ew.sqlSegment}" +
" AND ${ew.sqlSegment}" +
" </when>" +
"</script>")
@ResultType(DirectoryResource.class)