From 49fdd2904dd59994a51269e1d004c9c54dc7bc5d Mon Sep 17 00:00:00 2001 From: memorylkf <312904636@qq.com> Date: Thu, 5 Feb 2026 14:54:25 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20[=E7=B3=BB=E7=BB=9F=E7=AE=A1=E7=90=86]?= =?UTF-8?q?=20=E5=AF=BC=E5=87=BA=E7=94=A8=E6=88=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/hxhq/system/api/domain/SysRole.java | 10 ++++------ .../business/controller/RoleChangeController.java | 22 +++++++++++++++++---- .../java/com/hxhq/business/domain/RoleChange.java | 23 ++++++++++++++++++++++ .../hxhq/system/controller/SysUserController.java | 2 +- .../java/com/hxhq/system/dto/UserExportDto.java | 12 +++++------ 5 files changed, 52 insertions(+), 17 deletions(-) diff --git a/hxhq-api/hxhq-api-system/src/main/java/com/hxhq/system/api/domain/SysRole.java b/hxhq-api/hxhq-api-system/src/main/java/com/hxhq/system/api/domain/SysRole.java index 0ae342c..d0847b8 100644 --- a/hxhq-api/hxhq-api-system/src/main/java/com/hxhq/system/api/domain/SysRole.java +++ b/hxhq-api/hxhq-api-system/src/main/java/com/hxhq/system/api/domain/SysRole.java @@ -22,25 +22,22 @@ public class SysRole extends BaseEntity private static final long serialVersionUID = 1L; /** 角色ID */ - @Excel(name = "角色序号", cellType = ColumnType.NUMERIC) private Long roleId; /** 角色名称 */ - @Excel(name = "角色名称") + @Excel(name = "角色名称",sort = 1) @Compare(name = "角色名称",nameEn = "Role Name") private String roleName; /** 角色权限 */ - @Excel(name = "角色权限") + @Excel(name = "角色编码",sort = 2) @Compare(name = "角色编码",nameEn = "Role ID") private String roleKey; /** 角色排序 */ - @Excel(name = "角色排序") private Integer roleSort; /** 数据范围(1:所有数据权限;2:自定义数据权限;3:本部门数据权限;4:本部门及以下数据权限;5:仅本人数据权限) */ - @Excel(name = "数据范围", readConverterExp = "1=所有数据权限,2=自定义数据权限,3=本部门数据权限,4=本部门及以下数据权限,5=仅本人数据权限") private String dataScope; /** 菜单树选择项是否关联显示( 0:父子不互相关联显示 1:父子互相关联显示) */ @@ -50,7 +47,7 @@ public class SysRole extends BaseEntity private boolean deptCheckStrictly; /** 角色状态(0正常 1停用) */ - @Excel(name = "角色状态", readConverterExp = "0=正常,1=停用") + @Excel(name = "状态", readConverterExp = "0=启用,1=禁用",sort = 4) private String status; /** 删除标志(0代表存在 2代表删除) */ @@ -69,6 +66,7 @@ public class SysRole extends BaseEntity private Set permissions; /** 备注 */ + @Excel(name = "备注",sort = 3) @Compare(name = "备注",nameEn = "Role Description") private String remark; diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/RoleChangeController.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/RoleChangeController.java index 9a932dd..1e8a75a 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/RoleChangeController.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/RoleChangeController.java @@ -1,9 +1,14 @@ package com.hxhq.business.controller; import java.util.Arrays; +import java.util.Date; import java.util.List; +import com.hxhq.common.core.utils.DateUtils; +import com.hxhq.common.core.utils.poi.ExcelUtil; import com.hxhq.common.security.annotation.RequiresPermissions; +import com.hxhq.system.api.domain.SysUser; +import com.hxhq.system.dto.UserExportDto; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import com.hxhq.business.domain.RoleChange; @@ -12,6 +17,8 @@ import com.hxhq.common.core.web.controller.BaseController; import com.hxhq.common.core.web.domain.AjaxResult; import com.hxhq.common.core.web.page.TableDataInfo; +import javax.servlet.http.HttpServletResponse; + /** * 角色变更历史Controller @@ -39,12 +46,19 @@ public class RoleChangeController extends BaseController } /** - * 新增角色变更历史信息 + * 新增角色变更历史导出 + * @param response + * @param roleChange */ @PostMapping("/export") - @RequiresPermissions("system:user:roleChange") - public AjaxResult save(@RequestBody RoleChange roleChange) + @RequiresPermissions("system:user:roleChange:export") + public void export(HttpServletResponse response, RoleChange roleChange) { - return toAjax(roleChangeService.saveOrUpdate(roleChange)); + List list = roleChangeService.queryList(roleChange); + for(RoleChange l : list){ + l.setCreateTimeText(l.getCreateTime()==null?"":DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,l.getCreateTime())); + } + ExcelUtil util = new ExcelUtil(RoleChange.class); + util.exportExcel(response, list, "角色变更历史"); } } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/RoleChange.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/RoleChange.java index 38daeda..fa2a2ff 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/RoleChange.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/RoleChange.java @@ -1,7 +1,14 @@ package com.hxhq.business.domain; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.hxhq.common.core.annotation.Excel; import com.hxhq.common.core.domain.MpBaseEntity; +import com.hxhq.common.core.utils.DateUtils; + +import java.util.Date; /** @@ -19,6 +26,7 @@ public class RoleChange extends MpBaseEntity private Long userId; /** 操作类型 */ + @Excel(name = "操作类型",sort = 2) private String jcmc; /** 操作类型-英文 */ @@ -28,17 +36,25 @@ public class RoleChange extends MpBaseEntity private Long qmrId; /** 操作人名称 */ + @Excel(name = "签名人",sort = 1) private String qmrMc; /** 操作人名称-英文 */ private String qmrMcEn; /** 变更前角色 */ + @Excel(name = "变更前角色",sort = 4) private String bgq; /** 变更后角色 */ + @Excel(name = "变更后角色",sort = 5) private String bgh; + /** 创建时间 */ + @TableField(exist = false) + @Excel(name = "签名时间",sort = 3) + private String createTimeText; + public void setUserId(Long userId) { @@ -120,4 +136,11 @@ public class RoleChange extends MpBaseEntity return bgh; } + public String getCreateTimeText() { + return createTimeText; + } + + public void setCreateTimeText(String createTimeText) { + this.createTimeText = createTimeText; + } } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/system/controller/SysUserController.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/system/controller/SysUserController.java index ace6ed3..aa11f45 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/system/controller/SysUserController.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/system/controller/SysUserController.java @@ -116,7 +116,7 @@ public class SysUserController extends BaseController UserExportDto exportDto = new UserExportDto(); exportDto.setUserName(u.getUserName()); exportDto.setNickName(u.getNickName()); - exportDto.setPhonenumber(u.getPhonenumber()); + exportDto.setEmail(u.getEmail()); exportDto.setDeptName(u.getDept()==null?"":u.getDept().getDeptName()); exportDto.setRoleName(getRoleName(u.getRoles())); exportDto.setStatus(u.getStatus()); diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/system/dto/UserExportDto.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/system/dto/UserExportDto.java index 1bc79ca..93e961a 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/system/dto/UserExportDto.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/system/dto/UserExportDto.java @@ -19,8 +19,8 @@ public class UserExportDto { /** * 手机 */ - @Excel(name = "手机") - private String phonenumber; + @Excel(name = "邮箱") + private String email; /** * 所属部门/学科 */ @@ -53,12 +53,12 @@ public class UserExportDto { this.nickName = nickName; } - public String getPhonenumber() { - return phonenumber; + public String getEmail() { + return email; } - public void setPhonenumber(String phonenumber) { - this.phonenumber = phonenumber; + public void setEmail(String email) { + this.email = email; } public String getDeptName() {