Compare commits

...

3 Commits

Author SHA1 Message Date
wangliwen bc238cf39e Merge branch 'master' into docker_package 2022-12-14 11:32:55 +08:00
wangliwen 928237e8e4 Merge branch 'dev' 2022-12-14 11:32:45 +08:00
wangliwen 5dc4b1e482 分页数量不正确 2022-12-14 11:32:34 +08:00
5 changed files with 46 additions and 7 deletions

View File

@ -285,6 +285,6 @@ public class SysUserController {
index.put("auditTeamName", sysAuditTeamDTOList.stream().findFirst().isPresent() ? sysAuditTeamDTOList.stream().findFirst().get().getName() : "");
return index;
}).collect(Collectors.toList());
return new Result<PageData<Map>>().ok(new PageData<>(temp, sysUserService.getUserByRoleListCount(roleId)));
return new Result<PageData<Map>>().ok(new PageData<>(temp, sysUserService.getUserByRoleListCount(roleId, filterAuditTeam)));
}
}

View File

@ -59,5 +59,5 @@ public interface SysUserDao extends BaseDao<SysUserEntity> {
List<Map> getUserByRoleList(@Param("roleIds") List<Long> roleIds, @Param("pageNum") int pageNum, @Param("pageSize") int pageSize, @Param("filter") boolean filter);
Long getUserByRoleListCount(@Param("roleIds") List<Long> roleIds);
Long getUserByRoleListCount(@Param("roleIds") List<Long> roleIds, @Param("filter") boolean filter);
}

View File

@ -74,5 +74,5 @@ public interface SysUserService extends BaseService<SysUserEntity> {
*/
List<Map> getUserByRoleList(List<Long> roleIds, int pageNum, int pageSize, boolean filter);
Long getUserByRoleListCount(List<Long> roleIds);
Long getUserByRoleListCount(List<Long> roleIds, boolean filter);
}

View File

@ -568,7 +568,7 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserDao, SysUserEntit
}
@Override
public Long getUserByRoleListCount(List<Long> roleIds) {
return baseDao.getUserByRoleListCount(roleIds);
public Long getUserByRoleListCount(List<Long> roleIds, boolean filter) {
return baseDao.getUserByRoleListCount(roleIds, filter);
}
}

View File

@ -261,8 +261,32 @@
LIMIT ${pageNum}, ${pageSize}
</select>
<select id="getUserByRoleListCount" resultType="java.lang.Long">
<!-- SELECT-->
<!-- COUNT(DISTINCT sys_user.id )-->
<!-- FROM-->
<!-- sys_role_user-->
<!-- LEFT JOIN sys_user ON sys_user.id = sys_role_user.user_id-->
<!-- LEFT JOIN sys_dept ON sys_dept.id = sys_user.dept_id-->
<!-- WHERE-->
<!-- 1 = 1-->
<!-- AND sys_role_user.del_flag = 0-->
<!-- AND sys_user.id IS NOT NULL-->
<!-- <if test="null != roleIds">-->
<!-- AND sys_role_user.role_id IN-->
<!-- <foreach item="roleId" collection="roleIds" open="(" separator="," close=")">-->
<!-- #{roleId}-->
<!-- </foreach>-->
<!-- </if>-->
SELECT
COUNT(DISTINCT sys_user.id )
COUNT(temp.id)
FROM
(
SELECT DISTINCT
sys_user.id,
sys_user.username,
sys_user.real_name,
sys_dept.`name`
FROM
sys_role_user
LEFT JOIN sys_user ON sys_user.id = sys_role_user.user_id
@ -270,13 +294,28 @@
WHERE
1 = 1
AND sys_role_user.del_flag = 0
AND sys_user.id IS NOT NULL
<if test="null != roleIds">
AND sys_role_user.role_id IN
<foreach item="roleId" collection="roleIds" open="(" separator="," close=")">
#{roleId}
</foreach>
</if>
AND sys_user.id IS NOT NULL
) temp
WHERE
1 = 1
<if test="filter">
AND NOT EXISTS (
SELECT
1
FROM
sys_audit_team
WHERE
JSON_CONTAINS(
sys_audit_team.member,
JSON_OBJECT( "id", temp.id ))
)
</if>
</select>