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