diff --git a/dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/entity/CompanyStaff.java b/dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/entity/CompanyStaff.java index 919a8a3f..18c3fd32 100644 --- a/dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/entity/CompanyStaff.java +++ b/dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/entity/CompanyStaff.java @@ -103,10 +103,14 @@ public class CompanyStaff extends TenantBaseDO { /** 附件urls(infra_file表中的url,多个英文逗号拼接) */ private String fileUrls; - /** 员工角色ID集合 */ + /** 员工角色ID集合,新增修改的时候用 */ @TableField(exist = false) private List roleIds; + /** 员工角色IDS(,分隔),查询的时候用 */ + @TableField(exist = false) + private String roleIdsStr; + /** 员工角色名称们(,分隔) */ @TableField(exist = false) private String roleNames; diff --git a/dl-module-company/src/main/resources/mapper/staff/CompanyStaffMapper.xml b/dl-module-company/src/main/resources/mapper/staff/CompanyStaffMapper.xml index 3f201670..faef37cc 100644 --- a/dl-module-company/src/main/resources/mapper/staff/CompanyStaffMapper.xml +++ b/dl-module-company/src/main/resources/mapper/staff/CompanyStaffMapper.xml @@ -22,7 +22,8 @@ - + + @@ -43,19 +44,22 @@ cs.content AS cs_content, cs.unique_code AS cs_unique_code, cs.file_urls AS cs_file_urls, - rn.role_names AS role_names + rn.role_names AS role_names, + rn.role_ids AS role_ids_str FROM company_staff cs LEFT JOIN ( SELECT cs.user_id, sr.id, - GROUP_CONCAT(DISTINCT sr.name ORDER BY sr.name SEPARATOR ',') AS role_names + GROUP_CONCAT(DISTINCT sr.name ORDER BY sr.name SEPARATOR ',') AS role_names, + GROUP_CONCAT(DISTINCT sr.id ORDER BY sr.id SEPARATOR ',') AS role_ids FROM company_staff cs LEFT JOIN system_user_role sur ON cs.user_id = sur.user_id LEFT JOIN system_role sr ON sur.role_id = sr.id - WHERE cs.deleted = '0' AND sur.deleted = '0' + WHERE cs.deleted = '0' + AND sur.deleted = '0' GROUP BY cs.user_id ) rn ON cs.user_id = rn.user_id WHERE cs.deleted = '0'