update 重写系统部分业务导出

This commit is contained in:
疯狂的狮子li 2021-08-04 11:46:55 +08:00
parent 80067d32fc
commit 0539c2f927
33 changed files with 698 additions and 629 deletions

View File

@ -5,13 +5,14 @@ import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtils;
import com.ruoyi.system.domain.SysLogininfor; import com.ruoyi.system.domain.SysLogininfor;
import com.ruoyi.system.service.ISysLogininforService; import com.ruoyi.system.service.ISysLogininforService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List; import java.util.List;
/** /**
@ -36,11 +37,10 @@ public class SysLogininforController extends BaseController
@Log(title = "登录日志", businessType = BusinessType.EXPORT) @Log(title = "登录日志", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('monitor:logininfor:export')") @PreAuthorize("@ss.hasPermi('monitor:logininfor:export')")
@GetMapping("/export") @GetMapping("/export")
public AjaxResult export(SysLogininfor logininfor) public void export(SysLogininfor logininfor, HttpServletResponse response)
{ {
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor); List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class); ExcelUtils.exportExcel(list, "登录日志", SysLogininfor.class, response);
return util.exportExcel(list, "登录日志");
} }
@PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')") @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")

View File

@ -41,8 +41,6 @@ public class SysOperlogController extends BaseController
{ {
List<SysOperLog> list = operLogService.selectOperLogList(operLog); List<SysOperLog> list = operLogService.selectOperLogList(operLog);
ExcelUtils.exportExcel(list, "操作日志", SysOperLog.class, response); ExcelUtils.exportExcel(list, "操作日志", SysOperLog.class, response);
// ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
// return util.exportEasyExcel(list, "操作日志");
} }
@Log(title = "操作日志", businessType = BusinessType.DELETE) @Log(title = "操作日志", businessType = BusinessType.DELETE)

View File

@ -8,7 +8,7 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtils;
import com.ruoyi.system.domain.SysConfig; import com.ruoyi.system.domain.SysConfig;
import com.ruoyi.system.service.ISysConfigService; import com.ruoyi.system.service.ISysConfigService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -16,6 +16,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List; import java.util.List;
/** /**
@ -43,11 +44,10 @@ public class SysConfigController extends BaseController
@Log(title = "参数管理", businessType = BusinessType.EXPORT) @Log(title = "参数管理", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:config:export')") @PreAuthorize("@ss.hasPermi('system:config:export')")
@GetMapping("/export") @GetMapping("/export")
public AjaxResult export(SysConfig config) public void export(SysConfig config, HttpServletResponse response)
{ {
List<SysConfig> list = configService.selectConfigList(config); List<SysConfig> list = configService.selectConfigList(config);
ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class); ExcelUtils.exportExcel(list, "参数数据", SysConfig.class, response);
return util.exportExcel(list, "参数数据");
} }
/** /**

View File

@ -8,7 +8,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtils;
import com.ruoyi.system.service.ISysDictDataService; import com.ruoyi.system.service.ISysDictDataService;
import com.ruoyi.system.service.ISysDictTypeService; import com.ruoyi.system.service.ISysDictTypeService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -16,6 +16,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -44,11 +45,10 @@ public class SysDictDataController extends BaseController
@Log(title = "字典数据", businessType = BusinessType.EXPORT) @Log(title = "字典数据", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:dict:export')") @PreAuthorize("@ss.hasPermi('system:dict:export')")
@GetMapping("/export") @GetMapping("/export")
public AjaxResult export(SysDictData dictData) public void export(SysDictData dictData, HttpServletResponse response)
{ {
List<SysDictData> list = dictDataService.selectDictDataList(dictData); List<SysDictData> list = dictDataService.selectDictDataList(dictData);
ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class); ExcelUtils.exportExcel(list, "字典数据", SysDictData.class, response);
return util.exportExcel(list, "字典数据");
} }
/** /**

View File

@ -8,13 +8,14 @@ import com.ruoyi.common.core.domain.entity.SysDictType;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtils;
import com.ruoyi.system.service.ISysDictTypeService; import com.ruoyi.system.service.ISysDictTypeService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List; import java.util.List;
/** /**
@ -39,11 +40,10 @@ public class SysDictTypeController extends BaseController
@Log(title = "字典类型", businessType = BusinessType.EXPORT) @Log(title = "字典类型", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:dict:export')") @PreAuthorize("@ss.hasPermi('system:dict:export')")
@GetMapping("/export") @GetMapping("/export")
public AjaxResult export(SysDictType dictType) public void export(SysDictType dictType, HttpServletResponse response)
{ {
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType); List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class); ExcelUtils.exportExcel(list, "字典类型", SysDictType.class, response);
return util.exportExcel(list, "字典类型");
} }
/** /**

View File

@ -1,17 +1,5 @@
package com.ruoyi.web.controller.system; package com.ruoyi.web.controller.system;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
@ -19,9 +7,16 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtils;
import com.ruoyi.system.domain.SysPost; import com.ruoyi.system.domain.SysPost;
import com.ruoyi.system.service.ISysPostService; import com.ruoyi.system.service.ISysPostService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/** /**
* 岗位信息操作处理 * 岗位信息操作处理
@ -48,11 +43,10 @@ public class SysPostController extends BaseController
@Log(title = "岗位管理", businessType = BusinessType.EXPORT) @Log(title = "岗位管理", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:post:export')") @PreAuthorize("@ss.hasPermi('system:post:export')")
@GetMapping("/export") @GetMapping("/export")
public AjaxResult export(SysPost post) public void export(SysPost post, HttpServletResponse response)
{ {
List<SysPost> list = postService.selectPostList(post); List<SysPost> list = postService.selectPostList(post);
ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class); ExcelUtils.exportExcel(list, "岗位数据", SysPost.class, response);
return util.exportExcel(list, "岗位数据");
} }
/** /**

View File

@ -12,7 +12,7 @@ import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.ServletUtils; import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtils;
import com.ruoyi.framework.web.service.SysPermissionService; import com.ruoyi.framework.web.service.SysPermissionService;
import com.ruoyi.framework.web.service.TokenService; import com.ruoyi.framework.web.service.TokenService;
import com.ruoyi.system.domain.SysUserRole; import com.ruoyi.system.domain.SysUserRole;
@ -23,6 +23,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List; import java.util.List;
/** /**
@ -56,11 +57,10 @@ public class SysRoleController extends BaseController
@Log(title = "角色管理", businessType = BusinessType.EXPORT) @Log(title = "角色管理", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:role:export')") @PreAuthorize("@ss.hasPermi('system:role:export')")
@GetMapping("/export") @GetMapping("/export")
public AjaxResult export(SysRole role) public void export(SysRole role, HttpServletResponse response)
{ {
List<SysRole> list = roleService.selectRoleList(role); List<SysRole> list = roleService.selectRoleList(role);
ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class); ExcelUtils.exportExcel(list, "角色数据", SysRole.class, response);
return util.exportExcel(list, "角色数据");
} }
/** /**

View File

@ -1,7 +1,6 @@
package com.ruoyi.common.core.domain.entity; package com.ruoyi.common.core.domain.entity;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
@ -22,78 +21,107 @@ import java.util.*;
@NoArgsConstructor @NoArgsConstructor
@Accessors(chain = true) @Accessors(chain = true)
@TableName("sys_dept") @TableName("sys_dept")
public class SysDept implements Serializable public class SysDept implements Serializable {
{ private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
/** 部门ID */ /**
@TableId(value = "dept_id",type = IdType.AUTO) * 部门ID
private Long deptId; */
@TableId(value = "dept_id", type = IdType.AUTO)
private Long deptId;
/** 父部门ID */ /**
private Long parentId; * 父部门ID
*/
private Long parentId;
/** 祖级列表 */ /**
private String ancestors; * 祖级列表
*/
private String ancestors;
/** 部门名称 */ /**
@NotBlank(message = "部门名称不能为空") * 部门名称
@Size(min = 0, max = 30, message = "部门名称长度不能超过30个字符") */
private String deptName; @NotBlank(message = "部门名称不能为空")
@Size(min = 0, max = 30, message = "部门名称长度不能超过30个字符")
private String deptName;
/** 显示顺序 */ /**
@NotBlank(message = "显示顺序不能为空") * 显示顺序
private String orderNum; */
@NotBlank(message = "显示顺序不能为空")
private String orderNum;
/** 负责人 */ /**
private String leader; * 负责人
*/
private String leader;
/** 联系电话 */ /**
@Size(min = 0, max = 11, message = "联系电话长度不能超过11个字符") * 联系电话
private String phone; */
@Size(min = 0, max = 11, message = "联系电话长度不能超过11个字符")
private String phone;
/** 邮箱 */ /**
@Email(message = "邮箱格式不正确") * 邮箱
@Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符") */
private String email; @Email(message = "邮箱格式不正确")
@Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符")
private String email;
/** 部门状态:0正常,1停用 */ /**
private String status; * 部门状态:0正常,1停用
*/
private String status;
/** 删除标志0代表存在 2代表删除 */ /**
@TableLogic * 删除标志0代表存在 2代表删除
private String delFlag; */
@TableLogic
private String delFlag;
/** 父部门名称 */ /**
@TableField(exist = false) * 父部门名称
private String parentName; */
@TableField(exist = false)
private String parentName;
/** 创建者 */ /**
@TableField(fill = FieldFill.INSERT) * 创建者
private String createBy; */
@TableField(fill = FieldFill.INSERT)
private String createBy;
/** 创建时间 */ /**
@TableField(fill = FieldFill.INSERT) * 创建时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") */
private Date createTime; @TableField(fill = FieldFill.INSERT)
private Date createTime;
/** 更新者 */ /**
@TableField(fill = FieldFill.INSERT_UPDATE) * 更新者
private String updateBy; */
@TableField(fill = FieldFill.INSERT_UPDATE)
private String updateBy;
/** 更新时间 */ /**
@TableField(fill = FieldFill.INSERT_UPDATE) * 更新时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") */
private Date updateTime; @TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateTime;
/** 子部门 */ /**
@TableField(exist = false) * 子部门
private List<SysDept> children = new ArrayList<SysDept>(); */
@TableField(exist = false)
private List<SysDept> children = new ArrayList<SysDept>();
/** /**
* 请求参数 * 请求参数
*/ */
@TableField(exist = false) @TableField(exist = false)
private Map<String, Object> params = new HashMap<>(); private Map<String, Object> params = new HashMap<>();
} }

View File

@ -1,10 +1,11 @@
package com.ruoyi.common.core.domain.entity; package com.ruoyi.common.core.domain.entity;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat; import com.ruoyi.common.annotation.ExcelDictFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.annotation.Excel.ColumnType;
import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.convert.ExcelDictConvert;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
@ -26,82 +27,109 @@ import java.util.Map;
@NoArgsConstructor @NoArgsConstructor
@Accessors(chain = true) @Accessors(chain = true)
@TableName("sys_dict_data") @TableName("sys_dict_data")
public class SysDictData implements Serializable @ExcelIgnoreUnannotated
{ public class SysDictData implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 字典编码 */ /**
@Excel(name = "字典编码", cellType = ColumnType.NUMERIC) * 字典编码
@TableId(value = "dict_code",type = IdType.AUTO) */
private Long dictCode; @ExcelProperty(value = "字典编码")
@TableId(value = "dict_code", type = IdType.AUTO)
private Long dictCode;
/** 字典排序 */ /**
@Excel(name = "字典排序", cellType = ColumnType.NUMERIC) * 字典排序
private Long dictSort; */
@ExcelProperty(value = "字典排序")
private Long dictSort;
/** 字典标签 */ /**
@Excel(name = "字典标签") * 字典标签
@NotBlank(message = "字典标签不能为空") */
@Size(min = 0, max = 100, message = "字典标签长度不能超过100个字符") @ExcelProperty(value = "字典标签")
private String dictLabel; @NotBlank(message = "字典标签不能为空")
@Size(min = 0, max = 100, message = "字典标签长度不能超过100个字符")
private String dictLabel;
/** 字典键值 */ /**
@Excel(name = "字典键值") * 字典键值
@NotBlank(message = "字典键值不能为空") */
@Size(min = 0, max = 100, message = "字典键值长度不能超过100个字符") @ExcelProperty(value = "字典键值")
private String dictValue; @NotBlank(message = "字典键值不能为空")
@Size(min = 0, max = 100, message = "字典键值长度不能超过100个字符")
private String dictValue;
/** 字典类型 */ /**
@Excel(name = "字典类型") * 字典类型
@NotBlank(message = "字典类型不能为空") */
@Size(min = 0, max = 100, message = "字典类型长度不能超过100个字符") @ExcelProperty(value = "字典类型")
private String dictType; @NotBlank(message = "字典类型不能为空")
@Size(min = 0, max = 100, message = "字典类型长度不能超过100个字符")
private String dictType;
/** 样式属性(其他样式扩展) */ /**
@Size(min = 0, max = 100, message = "样式属性长度不能超过100个字符") * 样式属性其他样式扩展
private String cssClass; */
@Size(min = 0, max = 100, message = "样式属性长度不能超过100个字符")
private String cssClass;
/** 表格字典样式 */ /**
private String listClass; * 表格字典样式
*/
private String listClass;
/** 是否默认Y是 N否 */ /**
@Excel(name = "是否默认", readConverterExp = "Y=是,N=否") * 是否默认Y是 N否
private String isDefault; */
@ExcelProperty(value = "是否默认", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "sys_yes_no")
private String isDefault;
/** 状态0正常 1停用 */ /**
@Excel(name = "状态", readConverterExp = "0=正常,1=停用") * 状态0正常 1停用
private String status; */
@ExcelProperty(value = "状态", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "sys_common_status")
private String status;
/** 创建者 */ /**
@TableField(fill = FieldFill.INSERT) * 创建者
private String createBy; */
@TableField(fill = FieldFill.INSERT)
private String createBy;
/** 创建时间 */ /**
@TableField(fill = FieldFill.INSERT) * 创建时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") */
private Date createTime; @TableField(fill = FieldFill.INSERT)
private Date createTime;
/** 更新者 */ /**
@TableField(fill = FieldFill.INSERT_UPDATE) * 更新者
private String updateBy; */
@TableField(fill = FieldFill.INSERT_UPDATE)
private String updateBy;
/** 更新时间 */ /**
@TableField(fill = FieldFill.INSERT_UPDATE) * 更新时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") */
private Date updateTime; @TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateTime;
/** 备注 */ /**
private String remark; * 备注
*/
private String remark;
/** /**
* 请求参数 * 请求参数
*/ */
@TableField(exist = false) @TableField(exist = false)
private Map<String, Object> params = new HashMap<>(); private Map<String, Object> params = new HashMap<>();
public boolean getDefault() public boolean getDefault() {
{ return UserConstants.YES.equals(this.isDefault) ? true : false;
return UserConstants.YES.equals(this.isDefault) ? true : false; }
}
} }

View File

@ -1,9 +1,10 @@
package com.ruoyi.common.core.domain.entity; package com.ruoyi.common.core.domain.entity;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat; import com.ruoyi.common.annotation.ExcelDictFormat;
import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.convert.ExcelDictConvert;
import com.ruoyi.common.annotation.Excel.ColumnType;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
@ -25,56 +26,73 @@ import java.util.Map;
@NoArgsConstructor @NoArgsConstructor
@Accessors(chain = true) @Accessors(chain = true)
@TableName("sys_dict_type") @TableName("sys_dict_type")
public class SysDictType implements Serializable @ExcelIgnoreUnannotated
{ public class SysDictType implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 字典主键 */ /**
@Excel(name = "字典主键", cellType = ColumnType.NUMERIC) * 字典主键
@TableId(value = "dict_id",type = IdType.AUTO) */
private Long dictId; @ExcelProperty(value = "字典主键")
@TableId(value = "dict_id", type = IdType.AUTO)
private Long dictId;
/** 字典名称 */ /**
@Excel(name = "字典名称") * 字典名称
@NotBlank(message = "字典名称不能为空") */
@Size(min = 0, max = 100, message = "字典类型名称长度不能超过100个字符") @ExcelProperty(value = "字典名称")
private String dictName; @NotBlank(message = "字典名称不能为空")
@Size(min = 0, max = 100, message = "字典类型名称长度不能超过100个字符")
private String dictName;
/** 字典类型 */ /**
@Excel(name = "字典类型") * 字典类型
@NotBlank(message = "字典类型不能为空") */
@Size(min = 0, max = 100, message = "字典类型类型长度不能超过100个字符") @ExcelProperty(value = "字典类型")
private String dictType; @NotBlank(message = "字典类型不能为空")
@Size(min = 0, max = 100, message = "字典类型类型长度不能超过100个字符")
private String dictType;
/** 状态0正常 1停用 */ /**
@Excel(name = "状态", readConverterExp = "0=正常,1=停用") * 状态0正常 1停用
private String status; */
@ExcelProperty(value = "状态", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "sys_common_status")
private String status;
/** 创建者 */ /**
@TableField(fill = FieldFill.INSERT) * 创建者
private String createBy; */
@TableField(fill = FieldFill.INSERT)
private String createBy;
/** 创建时间 */ /**
@TableField(fill = FieldFill.INSERT) * 创建时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") */
private Date createTime; @TableField(fill = FieldFill.INSERT)
private Date createTime;
/** 更新者 */ /**
@TableField(fill = FieldFill.INSERT_UPDATE) * 更新者
private String updateBy; */
@TableField(fill = FieldFill.INSERT_UPDATE)
private String updateBy;
/** 更新时间 */ /**
@TableField(fill = FieldFill.INSERT_UPDATE) * 更新时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") */
private Date updateTime; @TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateTime;
/** 备注 */ /**
private String remark; * 备注
*/
private String remark;
/** /**
* 请求参数 * 请求参数
*/ */
@TableField(exist = false) @TableField(exist = false)
private Map<String, Object> params = new HashMap<>(); private Map<String, Object> params = new HashMap<>();
} }

View File

@ -21,88 +21,129 @@ import java.util.*;
@NoArgsConstructor @NoArgsConstructor
@Accessors(chain = true) @Accessors(chain = true)
@TableName("sys_menu") @TableName("sys_menu")
public class SysMenu implements Serializable public class SysMenu implements Serializable {
{ private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
/** 菜单ID */ /**
@TableId(value = "menu_id",type = IdType.AUTO) * 菜单ID
private Long menuId; */
@TableId(value = "menu_id", type = IdType.AUTO)
private Long menuId;
/** 菜单名称 */ /**
@NotBlank(message = "菜单名称不能为空") * 菜单名称
@Size(min = 0, max = 50, message = "菜单名称长度不能超过50个字符") */
private String menuName; @NotBlank(message = "菜单名称不能为空")
@Size(min = 0, max = 50, message = "菜单名称长度不能超过50个字符")
private String menuName;
/** 父菜单名称 */ /**
@TableField(exist = false) * 父菜单名称
private String parentName; */
@TableField(exist = false)
private String parentName;
/** 父菜单ID */ /**
private Long parentId; * 父菜单ID
*/
private Long parentId;
/** 显示顺序 */ /**
@NotBlank(message = "显示顺序不能为空") * 显示顺序
private String orderNum; */
@NotBlank(message = "显示顺序不能为空")
private String orderNum;
/** 路由地址 */ /**
@Size(min = 0, max = 200, message = "路由地址不能超过200个字符") * 路由地址
private String path; */
@Size(min = 0, max = 200, message = "路由地址不能超过200个字符")
private String path;
/** 组件路径 */ /**
@Size(min = 0, max = 200, message = "组件路径不能超过255个字符") * 组件路径
private String component; */
@Size(min = 0, max = 200, message = "组件路径不能超过255个字符")
private String component;
/** 是否为外链0是 1否 */ /**
private String isFrame; * 是否为外链0 1
*/
private String isFrame;
/** 是否缓存0缓存 1不缓存 */ /**
private String isCache; * 是否缓存0缓存 1不缓存
*/
private String isCache;
/** 类型M目录 C菜单 F按钮 */ /**
@NotBlank(message = "菜单类型不能为空") * 类型M目录 C菜单 F按钮
private String menuType; */
@NotBlank(message = "菜单类型不能为空")
private String menuType;
/** 显示状态0显示 1隐藏 */ /**
private String visible; * 显示状态0显示 1隐藏
*/
private String visible;
/** 菜单状态0显示 1隐藏 */ /**
private String status; * 菜单状态0显示 1隐藏
*/
private String status;
/** 权限字符串 */ /**
@Size(min = 0, max = 100, message = "权限标识长度不能超过100个字符") * 权限字符串
private String perms; */
@Size(min = 0, max = 100, message = "权限标识长度不能超过100个字符")
private String perms;
/** 菜单图标 */ /**
private String icon; * 菜单图标
*/
private String icon;
/** 创建者 */ /**
@TableField(fill = FieldFill.INSERT) * 创建者
private String createBy; */
@TableField(fill = FieldFill.INSERT)
private String createBy;
/** 创建时间 */ /**
@TableField(fill = FieldFill.INSERT) * 创建时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") */
private Date createTime; @TableField(fill = FieldFill.INSERT)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/** 更新者 */ /**
@TableField(fill = FieldFill.INSERT_UPDATE) * 更新者
private String updateBy; */
@TableField(fill = FieldFill.INSERT_UPDATE)
private String updateBy;
/** 更新时间 */ /**
@TableField(fill = FieldFill.INSERT_UPDATE) * 更新时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") */
private Date updateTime; @TableField(fill = FieldFill.INSERT_UPDATE)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
/** 备注 */ /**
private String remark; * 备注
*/
private String remark;
/** 请求参数 */ /**
@TableField(exist = false) * 请求参数
private Map<String, Object> params = new HashMap<>(); */
@TableField(exist = false)
private Map<String, Object> params = new HashMap<>();
/** 子菜单 */ /**
@TableField(exist = false) * 子菜单
private List<SysMenu> children = new ArrayList<SysMenu>(); */
@TableField(exist = false)
private List<SysMenu> children = new ArrayList<SysMenu>();
} }

View File

@ -1,9 +1,10 @@
package com.ruoyi.common.core.domain.entity; package com.ruoyi.common.core.domain.entity;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat; import com.ruoyi.common.annotation.ExcelDictFormat;
import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.convert.ExcelDictConvert;
import com.ruoyi.common.annotation.Excel.ColumnType;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
@ -25,102 +26,133 @@ import java.util.Map;
@NoArgsConstructor @NoArgsConstructor
@Accessors(chain = true) @Accessors(chain = true)
@TableName("sys_role") @TableName("sys_role")
public class SysRole implements Serializable @ExcelIgnoreUnannotated
{ public class SysRole implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 角色ID */ /**
@Excel(name = "角色序号", cellType = ColumnType.NUMERIC) * 角色ID
@TableId(value = "role_id",type = IdType.AUTO) */
private Long roleId; @ExcelProperty(value = "角色序号")
@TableId(value = "role_id", type = IdType.AUTO)
private Long roleId;
/** 角色名称 */ /**
@Excel(name = "角色名称") * 角色名称
@NotBlank(message = "角色名称不能为空") */
@Size(min = 0, max = 30, message = "角色名称长度不能超过30个字符") @ExcelProperty(value = "角色名称")
private String roleName; @NotBlank(message = "角色名称不能为空")
@Size(min = 0, max = 30, message = "角色名称长度不能超过30个字符")
private String roleName;
/** 角色权限 */ /**
@Excel(name = "角色权限") * 角色权限
@NotBlank(message = "权限字符不能为空") */
@Size(min = 0, max = 100, message = "权限字符长度不能超过100个字符") @ExcelProperty(value = "角色权限")
private String roleKey; @NotBlank(message = "权限字符不能为空")
@Size(min = 0, max = 100, message = "权限字符长度不能超过100个字符")
private String roleKey;
/** 角色排序 */ /**
@Excel(name = "角色排序") * 角色排序
@NotBlank(message = "显示顺序不能为空") */
private String roleSort; @ExcelProperty(value = "角色排序")
@NotBlank(message = "显示顺序不能为空")
private String roleSort;
/** 数据范围1所有数据权限2自定义数据权限3本部门数据权限4本部门及以下数据权限5仅本人数据权限 */ /**
@Excel(name = "数据范围", readConverterExp = "1=所有数据权限,2=自定义数据权限,3=本部门数据权限,4=本部门及以下数据权限,5=仅本人数据权限") * 数据范围1所有数据权限2自定义数据权限3本部门数据权限4本部门及以下数据权限5仅本人数据权限
private String dataScope; */
@ExcelProperty(value = "数据范围", converter = ExcelDictConvert.class)
@ExcelDictFormat(readConverterExp = "1=所有数据权限,2=自定义数据权限,3=本部门数据权限,4=本部门及以下数据权限,5=仅本人数据权限")
private String dataScope;
/** 菜单树选择项是否关联显示( 0父子不互相关联显示 1父子互相关联显示 */ /**
private boolean menuCheckStrictly; * 菜单树选择项是否关联显示 0父子不互相关联显示 1父子互相关联显示
*/
private boolean menuCheckStrictly;
/** 部门树选择项是否关联显示0父子不互相关联显示 1父子互相关联显示 */ /**
private boolean deptCheckStrictly; * 部门树选择项是否关联显示0父子不互相关联显示 1父子互相关联显示
*/
private boolean deptCheckStrictly;
/** 角色状态0正常 1停用 */ /**
@Excel(name = "角色状态", readConverterExp = "0=正常,1=停用") * 角色状态0正常 1停用
private String status; */
@ExcelProperty(value = "角色状态", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "sys_common_status")
private String status;
/** 删除标志0代表存在 2代表删除 */ /**
@TableLogic * 删除标志0代表存在 2代表删除
private String delFlag; */
@TableLogic
private String delFlag;
/** 创建者 */ /**
@TableField(fill = FieldFill.INSERT) * 创建者
private String createBy; */
@TableField(fill = FieldFill.INSERT)
private String createBy;
/** 创建时间 */ /**
@TableField(fill = FieldFill.INSERT) * 创建时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") */
private Date createTime; @TableField(fill = FieldFill.INSERT)
private Date createTime;
/** 更新者 */ /**
@TableField(fill = FieldFill.INSERT_UPDATE) * 更新者
private String updateBy; */
@TableField(fill = FieldFill.INSERT_UPDATE)
private String updateBy;
/** 更新时间 */ /**
@TableField(fill = FieldFill.INSERT_UPDATE) * 更新时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") */
private Date updateTime; @TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateTime;
/** 备注 */ /**
private String remark; * 备注
*/
private String remark;
/** /**
* 请求参数 * 请求参数
*/ */
@TableField(exist = false) @TableField(exist = false)
private Map<String, Object> params = new HashMap<>(); private Map<String, Object> params = new HashMap<>();
/** 用户是否存在此角色标识 默认不存在 */ /**
@TableField(exist = false) * 用户是否存在此角色标识 默认不存在
private boolean flag = false; */
@TableField(exist = false)
private boolean flag = false;
/** 菜单组 */ /**
@TableField(exist = false) * 菜单组
private Long[] menuIds; */
@TableField(exist = false)
private Long[] menuIds;
/** 部门组(数据权限) */ /**
@TableField(exist = false) * 部门组数据权限
private Long[] deptIds; */
@TableField(exist = false)
private Long[] deptIds;
public SysRole(Long roleId) public SysRole(Long roleId) {
{ this.roleId = roleId;
this.roleId = roleId; }
}
public boolean isAdmin() public boolean isAdmin() {
{ return isAdmin(this.roleId);
return isAdmin(this.roleId); }
}
public static boolean isAdmin(Long roleId) public static boolean isAdmin(Long roleId) {
{ return roleId != null && 1L == roleId;
return roleId != null && 1L == roleId; }
}
} }

View File

@ -31,139 +31,183 @@ import java.util.Map;
@NoArgsConstructor @NoArgsConstructor
@Accessors(chain = true) @Accessors(chain = true)
@TableName("sys_user") @TableName("sys_user")
public class SysUser implements Serializable public class SysUser implements Serializable {
{ private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
/** 用户ID */ /**
@Excel(name = "用户序号", cellType = ColumnType.NUMERIC, prompt = "用户编号") * 用户ID
@TableId(value = "user_id",type = IdType.AUTO) */
private Long userId; @Excel(name = "用户序号", cellType = ColumnType.NUMERIC, prompt = "用户编号")
@TableId(value = "user_id", type = IdType.AUTO)
private Long userId;
/** 部门ID */ /**
@Excel(name = "部门编号", type = Type.IMPORT) * 部门ID
private Long deptId; */
@Excel(name = "部门编号", type = Type.IMPORT)
private Long deptId;
/** 用户账号 */ /**
@NotBlank(message = "用户账号不能为空") * 用户账号
@Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符") */
@Excel(name = "登录名称") @NotBlank(message = "用户账号不能为空")
private String userName; @Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符")
@Excel(name = "登录名称")
private String userName;
/** 用户昵称 */ /**
@Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符") * 用户昵称
@Excel(name = "用户名称") */
private String nickName; @Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符")
@Excel(name = "用户名称")
private String nickName;
/** 用户邮箱 */ /**
@Email(message = "邮箱格式不正确") * 用户邮箱
@Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符") */
@Excel(name = "用户邮箱") @Email(message = "邮箱格式不正确")
private String email; @Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符")
@Excel(name = "用户邮箱")
private String email;
/** 手机号码 */ /**
@Excel(name = "手机号码") * 手机号码
private String phonenumber; */
@Excel(name = "手机号码")
private String phonenumber;
/** 用户性别 */ /**
@Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知") * 用户性别
private String sex; */
@Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知")
private String sex;
/** 用户头像 */ /**
private String avatar; * 用户头像
*/
private String avatar;
/** 密码 */ /**
private String password; * 密码
*/
private String password;
@JsonIgnore @JsonIgnore
@JsonProperty @JsonProperty
public String getPassword() { public String getPassword() {
return password; return password;
} }
/** 盐加密 */ /**
private String salt; * 盐加密
*/
private String salt;
/** 帐号状态0正常 1停用 */ /**
@Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用") * 帐号状态0正常 1停用
private String status; */
@Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用")
private String status;
/** 删除标志0代表存在 2代表删除 */ /**
@TableLogic * 删除标志0代表存在 2代表删除
private String delFlag; */
@TableLogic
private String delFlag;
/** 最后登录IP */ /**
@Excel(name = "最后登录IP", type = Type.EXPORT) * 最后登录IP
private String loginIp; */
@Excel(name = "最后登录IP", type = Type.EXPORT)
private String loginIp;
/** 最后登录时间 */ /**
@Excel(name = "最后登录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT) * 最后登录时间
private Date loginDate; */
@Excel(name = "最后登录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT)
private Date loginDate;
/** 创建者 */ /**
@TableField(fill = FieldFill.INSERT) * 创建者
private String createBy; */
@TableField(fill = FieldFill.INSERT)
private String createBy;
/** 创建时间 */ /**
@TableField(fill = FieldFill.INSERT) * 创建时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") */
private Date createTime; @TableField(fill = FieldFill.INSERT)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/** 更新者 */ /**
@TableField(fill = FieldFill.INSERT_UPDATE) * 更新者
private String updateBy; */
@TableField(fill = FieldFill.INSERT_UPDATE)
private String updateBy;
/** 更新时间 */ /**
@TableField(fill = FieldFill.INSERT_UPDATE) * 更新时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") */
private Date updateTime; @TableField(fill = FieldFill.INSERT_UPDATE)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
/** 备注 */ /**
private String remark; * 备注
*/
private String remark;
/** /**
* 请求参数 * 请求参数
*/ */
@TableField(exist = false) @TableField(exist = false)
private Map<String, Object> params = new HashMap<>(); private Map<String, Object> params = new HashMap<>();
/** 部门对象 */ /**
@Excels({ * 部门对象
@Excel(name = "部门名称", targetAttr = "deptName", type = Type.EXPORT), */
@Excel(name = "部门负责人", targetAttr = "leader", type = Type.EXPORT) @Excels({
}) @Excel(name = "部门名称", targetAttr = "deptName", type = Type.EXPORT),
@TableField(exist = false) @Excel(name = "部门负责人", targetAttr = "leader", type = Type.EXPORT)
private SysDept dept; })
@TableField(exist = false)
private SysDept dept;
/** 角色对象 */ /**
@TableField(exist = false) * 角色对象
private List<SysRole> roles; */
@TableField(exist = false)
private List<SysRole> roles;
/** 角色组 */ /**
@TableField(exist = false) * 角色组
private Long[] roleIds; */
@TableField(exist = false)
private Long[] roleIds;
/** 岗位组 */ /**
@TableField(exist = false) * 岗位组
private Long[] postIds; */
@TableField(exist = false)
private Long[] postIds;
/** 角色ID */ /**
* 角色ID
*/
@TableField(exist = false) @TableField(exist = false)
private Long roleId; private Long roleId;
public SysUser(Long userId) public SysUser(Long userId) {
{ this.userId = userId;
this.userId = userId; }
}
public boolean isAdmin() public boolean isAdmin() {
{ return isAdmin(this.userId);
return isAdmin(this.userId); }
}
public static boolean isAdmin(Long userId) public static boolean isAdmin(Long userId) {
{ return userId != null && 1L == userId;
return userId != null && 1L == userId; }
}
} }

View File

@ -46,7 +46,7 @@ public class ExcelUtils {
response.addHeader("Access-Control-Allow-Origin", "*"); response.addHeader("Access-Control-Allow-Origin", "*");
response.addHeader("Access-Control-Expose-Headers", "Content-Disposition"); response.addHeader("Access-Control-Expose-Headers", "Content-Disposition");
FileUtils.setAttachmentResponseHeader(response, URLEncoder.encode(filename, StandardCharsets.UTF_8.toString())); FileUtils.setAttachmentResponseHeader(response, URLEncoder.encode(filename, StandardCharsets.UTF_8.toString()));
response.setContentType("application/vnd.ms-excel;charset=UTF-8"); response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8");
ServletOutputStream os = response.getOutputStream(); ServletOutputStream os = response.getOutputStream();
EasyExcel.write(os, clazz) EasyExcel.write(os, clazz)
.autoCloseStream(false) .autoCloseStream(false)

View File

@ -1,9 +1,10 @@
package com.ruoyi.system.domain; package com.ruoyi.system.domain;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat; import com.ruoyi.common.annotation.ExcelDictFormat;
import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.convert.ExcelDictConvert;
import com.ruoyi.common.annotation.Excel.ColumnType;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
@ -25,20 +26,21 @@ import java.util.Map;
@NoArgsConstructor @NoArgsConstructor
@Accessors(chain = true) @Accessors(chain = true)
@TableName("sys_config") @TableName("sys_config")
@ExcelIgnoreUnannotated
public class SysConfig implements Serializable { public class SysConfig implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* 参数主键 * 参数主键
*/ */
@Excel(name = "参数主键", cellType = ColumnType.NUMERIC) @ExcelProperty(value = "参数主键")
@TableId(value = "config_id", type = IdType.AUTO) @TableId(value = "config_id", type = IdType.AUTO)
private Long configId; private Long configId;
/** /**
* 参数名称 * 参数名称
*/ */
@Excel(name = "参数名称") @ExcelProperty(value = "参数名称")
@NotBlank(message = "参数名称不能为空") @NotBlank(message = "参数名称不能为空")
@Size(min = 0, max = 100, message = "参数名称不能超过100个字符") @Size(min = 0, max = 100, message = "参数名称不能超过100个字符")
private String configName; private String configName;
@ -46,7 +48,7 @@ public class SysConfig implements Serializable {
/** /**
* 参数键名 * 参数键名
*/ */
@Excel(name = "参数键名") @ExcelProperty(value = "参数键名")
@NotBlank(message = "参数键名长度不能为空") @NotBlank(message = "参数键名长度不能为空")
@Size(min = 0, max = 100, message = "参数键名长度不能超过100个字符") @Size(min = 0, max = 100, message = "参数键名长度不能超过100个字符")
private String configKey; private String configKey;
@ -54,7 +56,7 @@ public class SysConfig implements Serializable {
/** /**
* 参数键值 * 参数键值
*/ */
@Excel(name = "参数键值") @ExcelProperty(value = "参数键值")
@NotBlank(message = "参数键值不能为空") @NotBlank(message = "参数键值不能为空")
@Size(min = 0, max = 500, message = "参数键值长度不能超过500个字符") @Size(min = 0, max = 500, message = "参数键值长度不能超过500个字符")
private String configValue; private String configValue;
@ -62,7 +64,8 @@ public class SysConfig implements Serializable {
/** /**
* 系统内置Y是 N否 * 系统内置Y是 N否
*/ */
@Excel(name = "系统内置", readConverterExp = "Y=是,N=否") @ExcelProperty(value = "系统内置", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "sys_yes_no")
private String configType; private String configType;
/** /**
@ -75,7 +78,6 @@ public class SysConfig implements Serializable {
* 创建时间 * 创建时间
*/ */
@TableField(fill = FieldFill.INSERT) @TableField(fill = FieldFill.INSERT)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime; private Date createTime;
/** /**
@ -88,7 +90,6 @@ public class SysConfig implements Serializable {
* 更新时间 * 更新时间
*/ */
@TableField(fill = FieldFill.INSERT_UPDATE) @TableField(fill = FieldFill.INSERT_UPDATE)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime; private Date updateTime;
/** /**

View File

@ -1,12 +1,13 @@
package com.ruoyi.system.domain; package com.ruoyi.system.domain;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; import com.ruoyi.common.annotation.ExcelDictFormat;
import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.convert.ExcelDictConvert;
import com.ruoyi.common.annotation.Excel.ColumnType;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
@ -26,63 +27,64 @@ import java.util.Map;
@NoArgsConstructor @NoArgsConstructor
@Accessors(chain = true) @Accessors(chain = true)
@TableName("sys_logininfor") @TableName("sys_logininfor")
@ExcelIgnoreUnannotated
public class SysLogininfor implements Serializable { public class SysLogininfor implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* ID * ID
*/ */
@Excel(name = "序号", cellType = ColumnType.NUMERIC) @ExcelProperty(value = "序号")
@TableId(value = "info_id", type = IdType.AUTO) @TableId(value = "info_id", type = IdType.AUTO)
private Long infoId; private Long infoId;
/** /**
* 用户账号 * 用户账号
*/ */
@Excel(name = "用户账号") @ExcelProperty(value = "用户账号")
private String userName; private String userName;
/** /**
* 登录状态 0成功 1失败 * 登录状态 0成功 1失败
*/ */
@Excel(name = "登录状态", readConverterExp = "0=成功,1=失败") @ExcelProperty(value = "登录状态", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "sys_common_status")
private String status; private String status;
/** /**
* 登录IP地址 * 登录IP地址
*/ */
@Excel(name = "登录地址") @ExcelProperty(value = "登录地址")
private String ipaddr; private String ipaddr;
/** /**
* 登录地点 * 登录地点
*/ */
@Excel(name = "登录地点") @ExcelProperty(value = "登录地点")
private String loginLocation; private String loginLocation;
/** /**
* 浏览器类型 * 浏览器类型
*/ */
@Excel(name = "浏览器") @ExcelProperty(value = "浏览器")
private String browser; private String browser;
/** /**
* 操作系统 * 操作系统
*/ */
@Excel(name = "操作系统") @ExcelProperty(value = "操作系统")
private String os; private String os;
/** /**
* 提示消息 * 提示消息
*/ */
@Excel(name = "提示消息") @ExcelProperty(value = "提示消息")
private String msg; private String msg;
/** /**
* 访问时间 * 访问时间
*/ */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @ExcelProperty(value = "访问时间")
@Excel(name = "访问时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date loginTime; private Date loginTime;
/** /**

View File

@ -28,9 +28,6 @@ import java.util.Map;
@Accessors(chain = true) @Accessors(chain = true)
@TableName("sys_oper_log") @TableName("sys_oper_log")
@ExcelIgnoreUnannotated @ExcelIgnoreUnannotated
//@ColumnWidth(16)
//@HeadRowHeight(14)
//@HeadFontStyle(fontHeightInPoints = 11)
public class SysOperLog implements Serializable { public class SysOperLog implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

View File

@ -1,9 +1,10 @@
package com.ruoyi.system.domain; package com.ruoyi.system.domain;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat; import com.ruoyi.common.annotation.ExcelDictFormat;
import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.convert.ExcelDictConvert;
import com.ruoyi.common.annotation.Excel.ColumnType;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
@ -25,20 +26,21 @@ import java.util.Map;
@NoArgsConstructor @NoArgsConstructor
@Accessors(chain = true) @Accessors(chain = true)
@TableName("sys_post") @TableName("sys_post")
@ExcelIgnoreUnannotated
public class SysPost implements Serializable { public class SysPost implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* 岗位序号 * 岗位序号
*/ */
@Excel(name = "岗位序号", cellType = ColumnType.NUMERIC) @ExcelProperty(value = "岗位序号")
@TableId(value = "post_id", type = IdType.AUTO) @TableId(value = "post_id", type = IdType.AUTO)
private Long postId; private Long postId;
/** /**
* 岗位编码 * 岗位编码
*/ */
@Excel(name = "岗位编码") @ExcelProperty(value = "岗位编码")
@NotBlank(message = "岗位编码不能为空") @NotBlank(message = "岗位编码不能为空")
@Size(min = 0, max = 64, message = "岗位编码长度不能超过64个字符") @Size(min = 0, max = 64, message = "岗位编码长度不能超过64个字符")
private String postCode; private String postCode;
@ -46,7 +48,7 @@ public class SysPost implements Serializable {
/** /**
* 岗位名称 * 岗位名称
*/ */
@Excel(name = "岗位名称") @ExcelProperty(value = "岗位名称")
@NotBlank(message = "岗位名称不能为空") @NotBlank(message = "岗位名称不能为空")
@Size(min = 0, max = 50, message = "岗位名称长度不能超过50个字符") @Size(min = 0, max = 50, message = "岗位名称长度不能超过50个字符")
private String postName; private String postName;
@ -54,14 +56,15 @@ public class SysPost implements Serializable {
/** /**
* 岗位排序 * 岗位排序
*/ */
@Excel(name = "岗位排序") @ExcelProperty(value = "岗位排序")
@NotBlank(message = "显示顺序不能为空") @NotBlank(message = "显示顺序不能为空")
private String postSort; private String postSort;
/** /**
* 状态0正常 1停用 * 状态0正常 1停用
*/ */
@Excel(name = "状态", readConverterExp = "0=正常,1=停用") @ExcelProperty(value = "状态", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "sys_common_status")
private String status; private String status;
/** /**
@ -74,7 +77,6 @@ public class SysPost implements Serializable {
* 创建时间 * 创建时间
*/ */
@TableField(fill = FieldFill.INSERT) @TableField(fill = FieldFill.INSERT)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime; private Date createTime;
/** /**
@ -87,7 +89,6 @@ public class SysPost implements Serializable {
* 更新时间 * 更新时间
*/ */
@TableField(fill = FieldFill.INSERT_UPDATE) @TableField(fill = FieldFill.INSERT_UPDATE)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime; private Date updateTime;
/** /**

View File

@ -24,12 +24,3 @@ export function cleanLogininfor() {
method: 'delete' method: 'delete'
}) })
} }
// 导出登录日志
export function exportLogininfor(query) {
return request({
url: '/monitor/logininfor/export',
method: 'get',
params: query
})
}

View File

@ -24,12 +24,3 @@ export function cleanOperlog() {
method: 'delete' method: 'delete'
}) })
} }
// 导出操作日志
export function exportOperlog(query) {
return request({
url: '/monitor/operlog/export',
method: 'get',
params: query
})
}

View File

@ -59,11 +59,3 @@ export function refreshCache() {
}) })
} }
// 导出参数
export function exportConfig(query) {
return request({
url: '/system/config/export',
method: 'get',
params: query
})
}

View File

@ -50,12 +50,3 @@ export function delData(dictCode) {
method: 'delete' method: 'delete'
}) })
} }
// 导出字典数据
export function exportData(query) {
return request({
url: '/system/dict/data/export',
method: 'get',
params: query
})
}

View File

@ -51,15 +51,6 @@ export function refreshCache() {
}) })
} }
// 导出字典类型
export function exportType(query) {
return request({
url: '/system/dict/type/export',
method: 'get',
params: query
})
}
// 获取字典选择框列表 // 获取字典选择框列表
export function optionselect() { export function optionselect() {
return request({ return request({

View File

@ -65,16 +65,6 @@ export function delRole(roleId) {
}) })
} }
// 导出角色
export function exportRole(query) {
return request({
url: '/system/role/export',
method: 'get',
params: query
})
}
// 查询角色已授权用户列表 // 查询角色已授权用户列表
export function allocatedUserList(query) { export function allocatedUserList(query) {
return request({ return request({

View File

@ -4,7 +4,6 @@ import { getToken } from '@/utils/auth'
const mimeMap = { const mimeMap = {
xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
zip: 'application/zip', zip: 'application/zip',
excel: 'application/vnd.ms-excel',
oss: 'application/octet-stream' oss: 'application/octet-stream'
} }
@ -62,7 +61,7 @@ export function downLoadExcel(url, params) {
responseType: 'blob', responseType: 'blob',
headers: { 'Authorization': 'Bearer ' + getToken() } headers: { 'Authorization': 'Bearer ' + getToken() }
}).then(res => { }).then(res => {
resolveBlob(res, mimeMap.excel) resolveBlob(res, mimeMap.xlsx)
}) })
} }

View File

@ -119,7 +119,8 @@
</template> </template>
<script> <script>
import { list, delLogininfor, cleanLogininfor, exportLogininfor } from "@/api/monitor/logininfor"; import { list, delLogininfor, cleanLogininfor } from "@/api/monitor/logininfor";
import { downLoadExcel } from "@/utils/download";
export default { export default {
name: "Logininfor", name: "Logininfor",
@ -228,18 +229,7 @@ export default {
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
const queryParams = this.queryParams; downLoadExcel('/monitor/logininfor/export', this.queryParams);
this.$confirm('是否确认导出所有操作日志数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
this.exportLoading = true;
return exportLogininfor(queryParams);
}).then(response => {
this.download(response.msg);
this.exportLoading = false;
}).catch(() => {});
} }
} }
}; };

View File

@ -188,7 +188,7 @@
</template> </template>
<script> <script>
import { list, delOperlog, cleanOperlog, exportOperlog } from "@/api/monitor/operlog"; import { list, delOperlog, cleanOperlog } from "@/api/monitor/operlog";
import { downLoadExcel } from "@/utils/download"; import { downLoadExcel } from "@/utils/download";
export default { export default {

View File

@ -181,7 +181,8 @@
</template> </template>
<script> <script>
import { listConfig, getConfig, delConfig, addConfig, updateConfig, exportConfig, refreshCache } from "@/api/system/config"; import { listConfig, getConfig, delConfig, addConfig, updateConfig, refreshCache } from "@/api/system/config";
import { downLoadExcel } from "@/utils/download";
export default { export default {
name: "Config", name: "Config",
@ -342,18 +343,7 @@ export default {
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
const queryParams = this.queryParams; downLoadExcel('/system/config/export', this.queryParams);
this.$confirm('是否确认导出所有参数数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
this.exportLoading = true;
return exportConfig(queryParams);
}).then(response => {
this.download(response.msg);
this.exportLoading = false;
}).catch(() => {});
}, },
/** 刷新缓存按钮操作 */ /** 刷新缓存按钮操作 */
handleRefreshCache() { handleRefreshCache() {

View File

@ -183,8 +183,9 @@
</template> </template>
<script> <script>
import { listData, getData, delData, addData, updateData, exportData } from "@/api/system/dict/data"; import { listData, getData, delData, addData, updateData } from "@/api/system/dict/data";
import { listType, getType } from "@/api/system/dict/type"; import { listType, getType } from "@/api/system/dict/type";
import { downLoadExcel } from "@/utils/download";
export default { export default {
name: "Data", name: "Data",
@ -388,18 +389,7 @@ export default {
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
const queryParams = this.queryParams; downLoadExcel('/system/dict/data/export', this.queryParams);
this.$confirm('是否确认导出所有数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
this.exportLoading = true;
return exportData(queryParams);
}).then(response => {
this.download(response.msg);
this.exportLoading = false;
}).catch(() => {});
} }
} }
}; };

View File

@ -193,7 +193,8 @@
</template> </template>
<script> <script>
import { listType, getType, delType, addType, updateType, exportType, refreshCache } from "@/api/system/dict/type"; import { listType, getType, delType, addType, updateType, refreshCache } from "@/api/system/dict/type";
import { downLoadExcel } from "@/utils/download";
export default { export default {
name: "Dict", name: "Dict",
@ -346,18 +347,7 @@ export default {
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
const queryParams = this.queryParams; downLoadExcel('/system/dict/type/export', this.queryParams);
this.$confirm('是否确认导出所有类型数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
this.exportLoading = true;
return exportType(queryParams);
}).then(response => {
this.download(response.msg);
this.exportLoading = false;
}).catch(() => {});
}, },
/** 刷新缓存按钮操作 */ /** 刷新缓存按钮操作 */
handleRefreshCache() { handleRefreshCache() {

View File

@ -156,7 +156,8 @@
</template> </template>
<script> <script>
import { listPost, getPost, delPost, addPost, updatePost, exportPost } from "@/api/system/post"; import { listPost, getPost, delPost, addPost, updatePost } from "@/api/system/post";
import { downLoadExcel } from "@/utils/download";
export default { export default {
name: "Post", name: "Post",
@ -313,18 +314,7 @@ export default {
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
const queryParams = this.queryParams; downLoadExcel('/system/post/export', this.queryParams);
this.$confirm('是否确认导出所有岗位数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
this.exportLoading = true;
return exportPost(queryParams);
}).then(response => {
this.download(response.msg);
this.exportLoading = false;
}).catch(() => {});
} }
} }
}; };

View File

@ -259,9 +259,10 @@
</template> </template>
<script> <script>
import { listRole, getRole, delRole, addRole, updateRole, exportRole, dataScope, changeRoleStatus } from "@/api/system/role"; import { listRole, getRole, delRole, addRole, updateRole, dataScope, changeRoleStatus } from "@/api/system/role";
import { treeselect as menuTreeselect, roleMenuTreeselect } from "@/api/system/menu"; import { treeselect as menuTreeselect, roleMenuTreeselect } from "@/api/system/menu";
import { treeselect as deptTreeselect, roleDeptTreeselect } from "@/api/system/dept"; import { treeselect as deptTreeselect, roleDeptTreeselect } from "@/api/system/dept";
import { downLoadExcel } from "@/utils/download";
export default { export default {
name: "Role", name: "Role",
@ -625,18 +626,7 @@ export default {
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
const queryParams = this.queryParams; downLoadExcel('/system/role/export', this.queryParams);
this.$confirm('是否确认导出所有角色数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
this.exportLoading = true;
return exportRole(queryParams);
}).then(response => {
this.download(response.msg);
this.exportLoading = false;
}).catch(() => {});
} }
} }
}; };

View File

@ -126,7 +126,7 @@ export default {
formData.append("avatarfile", data); formData.append("avatarfile", data);
uploadAvatar(formData).then(response => { uploadAvatar(formData).then(response => {
this.open = false; this.open = false;
this.options.img = process.env.VUE_APP_BASE_API + response.data.imgUrl; this.options.img = response.data.imgUrl;
store.commit('SET_AVATAR', this.options.img); store.commit('SET_AVATAR', this.options.img);
this.msgSuccess("修改成功"); this.msgSuccess("修改成功");
this.visible = false; this.visible = false;