工会管理:新增‘导出基层干部’按钮(改成根据真实角色导出,所属工会读用户的);
This commit is contained in:
@@ -507,29 +507,29 @@ public class SysUnionController {
|
||||
public void exportCadre(HttpServletResponse response) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
userInfo.loginname AS loginName,
|
||||
userInfo.username AS userName,
|
||||
branchUnion.`name` AS unionName,
|
||||
userInfo.mobile,
|
||||
GROUP_CONCAT(DISTINCT businessRole.`name` ORDER BY roleDict.location SEPARATOR '、') AS roleName
|
||||
u.loginname AS loginName,
|
||||
u.username AS userName,
|
||||
IFNULL(MAX(branchUnion.`name`), '') AS unionName,
|
||||
u.mobile,
|
||||
GROUP_CONCAT(DISTINCT role.`name` ORDER BY role.sort ASC SEPARATOR '、') AS roleName
|
||||
FROM
|
||||
sys_user_role assignedRole
|
||||
INNER JOIN sys_role businessRole ON businessRole.id = assignedRole.roleId
|
||||
INNER JOIN sys_dict roleParent ON roleParent.`code` = 'BRANCH_UNION_ROLES'
|
||||
INNER JOIN sys_dict roleDict ON roleDict.parentId = roleParent.id
|
||||
AND roleDict.`code` = businessRole.`code`
|
||||
INNER JOIN vw_user userInfo ON userInfo.id = assignedRole.userId
|
||||
INNER JOIN sys_union branchUnion ON branchUnion.id = assignedRole.unionId
|
||||
sys_role role
|
||||
INNER JOIN sys_user_role ur ON role.id = ur.roleId
|
||||
INNER JOIN sys_user u ON u.id = ur.userId
|
||||
LEFT JOIN vw_user currentUser ON currentUser.id = u.id
|
||||
LEFT JOIN sys_union branchUnion ON branchUnion.id = COALESCE(NULLIF(currentUser.unionId, ''), NULLIF(ur.unionId, ''))
|
||||
INNER JOIN sys_dict roleDict ON roleDict.`code` = role.`code`
|
||||
INNER JOIN sys_dict roleParent ON roleParent.id = roleDict.parentId
|
||||
AND roleParent.`code` = 'BRANCH_UNION_ROLES'
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (AuthUtil.hasRole(RoleConstant.BRANCH_UNION_CHAIRMAN.name())) {
|
||||
cnd.and("assignedRole.unionId", "=", SecurityUtil.getUnionId());
|
||||
cnd.and("COALESCE(NULLIF(currentUser.unionId, ''), NULLIF(ur.unionId, ''))", "=", SecurityUtil.getUnionId());
|
||||
}
|
||||
cnd.groupBy("assignedRole.userId");
|
||||
cnd.groupBy("assignedRole.unionId");
|
||||
cnd.asc("branchUnion.unionCode");
|
||||
cnd.asc("userInfo.loginname");
|
||||
cnd.groupBy("ur.userId");
|
||||
cnd.asc("MIN(branchUnion.unionCode)");
|
||||
cnd.asc("u.loginname");
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = sysUnionService.listMap(sql);
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
|
||||
Reference in New Issue
Block a user