From 3addbe0b9b2bc8f91ffdacf070eef6072e664cd5 Mon Sep 17 00:00:00 2001 From: xiao-fajia <1665375861@qq.com> Date: Wed, 14 Aug 2024 20:31:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=91=98=E5=B7=A5=E5=8A=A0=E8=A7=92=E8=89=B2?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../staff/controller/admin/CompanyStaffController.java | 6 +++++- .../cn/iocoder/yudao/module/staff/entity/CompanyStaff.java | 5 +---- .../src/main/resources/mapper/staff/CompanyStaffMapper.xml | 7 ++----- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/controller/admin/CompanyStaffController.java b/dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/controller/admin/CompanyStaffController.java index 934379f1..8b93f7cf 100644 --- a/dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/controller/admin/CompanyStaffController.java +++ b/dl-module-company/src/main/java/cn/iocoder/yudao/module/staff/controller/admin/CompanyStaffController.java @@ -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 list = staffService.list(); + Page page = new Page<>(pageNo, pageSize); + IPage staffIPage = staffService.queryListPage(pageReqVO, page); + List list = staffIPage.getRecords(); // 导出 Excel Map columnWidthMap = new HashMap<>(); // 第一列的索引是0,宽度设置为20个字符宽 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 18c3fd32..03f8f1c7 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 @@ -107,11 +107,8 @@ public class CompanyStaff extends TenantBaseDO { @TableField(exist = false) private List roleIds; - /** 员工角色IDS(,分隔),查询的时候用 */ - @TableField(exist = false) - private String roleIdsStr; - /** 员工角色名称们(,分隔) */ @TableField(exist = false) + @ExcelProperty("员工角色") 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 faef37cc..4aed5a24 100644 --- a/dl-module-company/src/main/resources/mapper/staff/CompanyStaffMapper.xml +++ b/dl-module-company/src/main/resources/mapper/staff/CompanyStaffMapper.xml @@ -23,7 +23,6 @@ - @@ -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