员工加角色修正

This commit is contained in:
xiao-fajia 2024-08-14 20:31:15 +08:00
parent f0206a1cb2
commit 3addbe0b9b
3 changed files with 8 additions and 10 deletions

View File

@ -137,8 +137,12 @@ public class CompanyStaffController {
@PreAuthorize("@ss.hasPermission('company:staff:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportCompanyStaffExcel(CompanyStaffReqVO pageReqVO,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletResponse response) throws IOException {
List<CompanyStaff> list = staffService.list();
Page<CompanyStaff> page = new Page<>(pageNo, pageSize);
IPage<CompanyStaff> staffIPage = staffService.queryListPage(pageReqVO, page);
List<CompanyStaff> list = staffIPage.getRecords();
// 导出 Excel
Map<Integer, Integer> columnWidthMap = new HashMap<>();
// 第一列的索引是0宽度设置为20个字符宽

View File

@ -107,11 +107,8 @@ public class CompanyStaff extends TenantBaseDO {
@TableField(exist = false)
private List<Long> roleIds;
/** 员工角色IDS(,分隔),查询的时候用 */
@TableField(exist = false)
private String roleIdsStr;
/** 员工角色名称们(,分隔) */
@TableField(exist = false)
@ExcelProperty("员工角色")
private String roleNames;
}

View File

@ -23,7 +23,6 @@
<result property="uniqueCode" column="cs_unique_code" jdbcType="VARCHAR"/>
<result property="fileUrls" column="cs_file_urls" jdbcType="VARCHAR"/>
<result property="roleNames" column="role_names"/>
<result property="roleIdsStr" column="role_ids_str"/>
</resultMap>
<sql id="Base_SQL">
@ -44,15 +43,13 @@
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_ids AS role_ids_str
rn.role_names AS role_names
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.id ORDER BY sr.id SEPARATOR ',') AS role_ids
GROUP_CONCAT(DISTINCT sr.name ORDER BY sr.name SEPARATOR ',') AS role_names
FROM company_staff cs
LEFT JOIN
system_user_role sur ON cs.user_id = sur.user_id