Explorar o código

用户标签报表

guozhaoshun %!s(int64=6) %!d(string=hai) anos
pai
achega
b9d116a40d

+ 7 - 3
rankin-user-service/src/main/java/cn/rankin/userservice/repository/StmtRepository.java

@@ -16,12 +16,16 @@ public interface StmtRepository extends BasicJpaRepository<UserTag, String> {
      */
     @Query(value = "SELECT COUNT(1) FROM u_terminal_user tu " +
             " WHERE tu.id IN ( SELECT tag.uid FROM u_user_tag tag WHERE tag.status = 0 )" +
-            " AND if(?1 !='',tu.code LIKE CONCAT('%',?1,'%'),1=1) AND if(?2 !='',tu.merchant_id=?2,1=1) AND if(?3 !='',tu.campus_id=?3,1=1) ",nativeQuery = true)
+            " AND if(?1 !='',tu.code LIKE CONCAT('%',?1,'%'),1=1) " +
+            " AND if(?2 !='',tu.merchant_id=?2,1=1) " +
+            " AND if(?3 !='',tu.campus_id=?3,1=1) ",nativeQuery = true)
     int userCount(String code, String merchantId, String campusId);
 
     @Query(value = "SELECT  tu.id  FROM u_terminal_user tu " +
             " WHERE tu.id IN ( SELECT tag.uid FROM u_user_tag tag WHERE tag.status = 0 ) " +
-            " AND if(?1 !='',tu.code LIKE CONCAT('%',?1,'%'),1=1) AND if(?2 !='',tu.merchant_id=?2,1=1) AND if(?3 !='',tu.campus_id=?3,1=1)  " +
-            " ORDER BY tu.gmt_created DESC LIMIT ?4,?5 ",nativeQuery = true)
+            " AND if(?1 !='',tu.code LIKE CONCAT('%',?1,'%'),1=1) " +
+            " AND if(?2 !='',tu.merchant_id=?2,1=1) " +
+            " AND if(?3 !='',tu.campus_id=?3,1=1)  " +
+            " ORDER BY tu.gmt_created DESC if(?5 != null ,LIMIT ?4,?5 ) ",nativeQuery = true)
     List<String> uidList(String code, String merchantId, String campusId, long start, Integer pageSize);
 }