Explorar el Código

修改获取企业已有用户的角色的请求的实现

suntg hace 7 años
padre
commit
1493297241

+ 10 - 2
src/main/java/com/uas/platform/b2c/common/account/dao/RoleDao.java

@@ -67,7 +67,7 @@ public interface RoleDao extends JpaRepository<Role, Long> {
      * @param useruu
      * @return
      */
-    @Query(value = "select count(1) from sec$roles r left join sec$userrole u on r.role_id = u.role_id where r.role_enuu = :enuu and u.user_uu = :useruu and (r.role_name = 'ROLE_ADMIN' or r.role_name = 'ROLE_SALEMANAGER')",nativeQuery = true)
+    @Query(value = "select count(1) from sec$roles_b2c r left join sec$userrole_b2c u on r.role_id = u.role_id where r.role_enuu = :enuu and u.user_uu = :useruu and (r.role_name = 'ROLE_ADMIN' or r.role_name = 'ROLE_SALEMANAGER')",nativeQuery = true)
     Double findByEnuuAndUseruu(@Param("enuu") Long enuu, @Param("useruu") Long useruu);
 
     /**
@@ -77,6 +77,14 @@ public interface RoleDao extends JpaRepository<Role, Long> {
      * @param useruu
      * @return
      */
-    @Query(value = "select count(1) from sec$roles r left join sec$userrole u on r.role_id = u.role_id where r.role_enuu = :enuu and u.user_uu = :useruu and r.role_name = 'ROLE_ADMIN'",nativeQuery = true)
+    @Query(value = "select count(1) from sec$roles_b2c r left join sec$userrole_b2c u on r.role_id = u.role_id where r.role_enuu = :enuu and u.user_uu = :useruu and r.role_name = 'ROLE_ADMIN'",nativeQuery = true)
     Double findByEnuuAndUserUU(@Param("enuu") Long enuu, @Param("useruu") Long useruu);
+
+    /**
+     * 查找角色对应的用户个数
+     * @param roleId
+     * @return
+     */
+    @Query(nativeQuery = true, value = "select count(1) from sec$userrole_b2c where role_id=:roleId")
+    Long findCountUserByRoleId(@Param("roleId") Long roleId);
 }