...
 
Commits (11)
    https://gitcode.net/twelvet/twelvet/-/commit/f28440a5812598d07d40d3feb80fd4a3a4f677fc 优化代码生成 2023-07-28T09:46:24+08:00 twelvet 2471835953@qq.com https://gitcode.net/twelvet/twelvet/-/commit/112a758eafad979fd122511c1355083ffa2f9d49 优化代码生成第一版 2023-07-28T22:48:20+08:00 twelvet 2471835953@qq.com https://gitcode.net/twelvet/twelvet/-/commit/9fb9dfe24d23cf81fb5882e9cdd644088468a191 优化代码生成第二版 2023-07-29T11:49:18+08:00 twelvet 2471835953@qq.com https://gitcode.net/twelvet/twelvet/-/commit/e00907f4fcda96e60760d583cd325e3be7e1b836 Spring Boot3 升级提示 2023-07-29T15:59:00+08:00 twelvet 2471835953@qq.com https://gitcode.net/twelvet/twelvet/-/commit/b76c94818898401cb413c938b05d22ae7c4408af Spring Boot3 升级提示 2023-07-29T15:59:53+08:00 twelvet 2471835953@qq.com https://gitcode.net/twelvet/twelvet/-/commit/10d151bc2138e398db24059c3475dae0dcb3ca95 优化代码生成器第三版 2023-07-31T15:55:43+08:00 TwelveT 2471835953@qq.com https://gitcode.net/twelvet/twelvet/-/commit/4615f863384a2283d89354049f649f4e68bec48e Update sync-repository.yml 2023-08-05T09:42:37+08:00 twelvet 2471835953@qq.com https://gitcode.net/twelvet/twelvet/-/commit/86bf6888bbd444fd41013a7dddd2089c3df13c80 用户导入 2023-08-05T11:36:07+08:00 TwelveT 2471835953@qq.com https://gitcode.net/twelvet/twelvet/-/commit/a9661f0b3a25bda55a29bb6b43482214e0ead613 Merge branch 'master' of https://github.com/twelvet-s/twelvet 2023-08-05T11:36:26+08:00 TwelveT 2471835953@qq.com https://gitcode.net/twelvet/twelvet/-/commit/7917a8fe2295734484fed6defc1699370ccdcbd0 Excel分离 2023-08-05T11:55:30+08:00 TwelveT 2471835953@qq.com https://gitcode.net/twelvet/twelvet/-/commit/f18e28a5278cc5c7dbbac094b0518150a81b397a Excel分离 2023-08-06T20:50:08+08:00 twelvet 2471835953@qq.com
......@@ -18,7 +18,7 @@ jobs:
dst_key: ${{ secrets.SSH_PRIVATE_KEY }}
dst_token: ${{ secrets.GITEE_TOKEN }}
# 指定同步仓库
static_list: twelvet,twelvet-ui,twelvet-fast,netty-websocket-spring-boot-starter,gins,twelvet-ai,twelvet-mall-ui,twelvet-mall
static_list: twelvet,twelvet-ui,twelvet-fast,netty-websocket-spring-boot-starter,gins,twelvet-ai,twelvet-mall-ui,twelvet-mall,excel-spring-boot-starter
force_update: true
account_type: user
clone_style: ssh
......
......@@ -10,6 +10,8 @@
[![star](https://gitee.com/twelvet/twelvet/badge/star.svg?theme=white)](https://gitee.com/twelvet/twelvet/stargazers)
[![fork](https://gitee.com/twelvet/twelvet/badge/fork.svg?theme=white)](https://gitee.com/twelvet/twelvet/members)
### 此版本将跟随Spring Boot的脚步于2023-11-18停止维护,将不会再有新的特性更新(依旧进行BUG修复),请尽快升级到Spring Boot3分支
一款基于Spring Cloud Alibaba的权限管理系统,集成市面上流行库,可以作用为快速开发的一个框架使用
一套以微服务架构的脚手架,使用Spring Cloud Alibaba系列进行架构,学习并了解它将能快速掌握微服务核心基础。
......
......@@ -10,6 +10,8 @@
[![star](https://gitee.com/twelvet/twelvet/badge/star.svg?theme=white)](https://gitee.com/twelvet/twelvet/stargazers)
[![fork](https://gitee.com/twelvet/twelvet/badge/fork.svg?theme=white)](https://gitee.com/twelvet/twelvet/members)
### This version will be deprecated following the timeline of Spring Boot on 2023-11-18. There will be no further feature updates, although bug fixes will continue to be addressed. We strongly encourage you to upgrade to the Spring Boot 3 branch as soon as possible.
A permission management system based on Spring Cloud Alibaba that integrates popular libraries on the market and can act
as a framework for rapid development.
......
......@@ -61,11 +61,12 @@
<pagehelper.boot.version>1.4.6</pagehelper.boot.version>
<poi.version>5.2.3</poi.version>
<commons.io.version>2.11.0</commons.io.version>
<commons.io.version>2.13.0</commons.io.version>
<velocity.version>2.3</velocity.version>
<hutool.version>5.8.19</hutool.version>
<redisson.version>3.18.0</redisson.version>
<qiniu.version>7.12.1</qiniu.version>
<excel-spring-boot-starter.version>1.0.2</excel-spring-boot-starter.version>
<docker.plugin.version>0.32.0</docker.plugin.version>
<spring.checkstyle.plugin>0.0.39</spring.checkstyle.plugin>
......@@ -285,6 +286,13 @@
<version>${twelvet.version}</version>
</dependency>
<!--Excel-->
<dependency>
<groupId>cn.twelvet.excel</groupId>
<artifactId>excel-spring-boot-starter</artifactId>
<version>${excel-spring-boot-starter.version}</version>
</dependency>
<!--job API-->
<dependency>
<groupId>com.twelvet</groupId>
......
......@@ -43,6 +43,12 @@
<artifactId>twelvet-framework-swagger</artifactId>
</dependency>
<!--Excel-->
<dependency>
<groupId>cn.twelvet.excel</groupId>
<artifactId>excel-spring-boot-starter</artifactId>
</dependency>
</dependencies>
</project>
package com.twelvet.api.job.domain;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.twelvet.framework.core.application.domain.BaseEntity;
import com.twelvet.framework.core.constants.ScheduleConstants;
import com.twelvet.framework.utils.CronUtils;
import com.twelvet.framework.utils.StringUtils;
import com.twelvet.framework.utils.annotation.excel.Excel;
import com.twelvet.framework.utils.annotation.excel.Excel.ColumnType;
import io.swagger.v3.oas.annotations.media.Schema;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
......@@ -30,56 +28,56 @@ public class SysJob extends BaseEntity {
* 任务ID
*/
@Schema(description = "任务序号")
@Excel(name = "任务序号", cellType = ColumnType.NUMERIC)
@ExcelProperty(value = "任务序号")
private Long jobId;
/**
* 任务名称
*/
@Schema(description = "任务名称")
@Excel(name = "任务名称")
@ExcelProperty(value = "任务名称")
private String jobName;
/**
* 任务组名
*/
@Schema(description = "任务组名")
@Excel(name = "任务组名")
@ExcelProperty(value = "任务组名")
private String jobGroup;
/**
* 调用目标字符串
*/
@Schema(description = "调用目标字符串")
@Excel(name = "调用目标字符串")
@ExcelProperty(value = "调用目标字符串")
private String invokeTarget;
/**
* cron执行表达式
*/
@Schema(description = "执行表达式")
@Excel(name = "执行表达式 ")
@ExcelProperty(value = "执行表达式 ")
private String cronExpression;
/**
* cron计划策略
*/
@Schema(description = "计划策略")
@Excel(name = "计划策略 ", readConverterExp = "0=默认,1=立即触发执行,2=触发一次执行,3=不触发立即执行")
@ExcelProperty(value = "计划策略(0=默认,1=立即触发执行,2=触发一次执行,3=不触发立即执行)")
private String misfirePolicy = ScheduleConstants.MISFIRE_DEFAULT;
/**
* 是否并发执行(0允许 1禁止)
*/
@Schema(description = "是否并发执行")
@Excel(name = "并发执行", readConverterExp = "0=允许,1=禁止")
@ExcelProperty(value = "并发执行(0=允许,1=禁止)")
private String concurrent;
/**
* 任务状态(0正常 1暂停)
*/
@Schema(description = "任务状态")
@Excel(name = "任务状态", readConverterExp = "0=正常,1=暂停")
@ExcelProperty(value = "任务状态(0=正常,1=暂停)")
private String status;
public Long getJobId() {
......
package com.twelvet.api.job.domain;
import com.alibaba.excel.annotation.ExcelProperty;
import com.twelvet.framework.core.application.domain.BaseEntity;
import com.twelvet.framework.utils.annotation.excel.Excel;
import io.swagger.v3.oas.annotations.media.Schema;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
......@@ -21,37 +20,37 @@ public class SysJobLog extends BaseEntity {
/** ID */
@Schema(description = "日志序号")
@Excel(name = "日志序号")
@ExcelProperty(value = "日志序号")
private Long jobLogId;
/** 任务名称 */
@Schema(description = "任务名称")
@Excel(name = "任务名称")
@ExcelProperty(value = "任务名称")
private String jobName;
/** 任务组名 */
@Schema(description = "任务组名")
@Excel(name = "任务组名")
@ExcelProperty(value = "任务组名")
private String jobGroup;
/** 调用目标字符串 */
@Schema(description = "调用目标字符串")
@Excel(name = "调用目标字符串")
@ExcelProperty(value = "调用目标字符串")
private String invokeTarget;
/** 日志信息 */
@Schema(description = "日志信息")
@Excel(name = "日志信息")
@ExcelProperty(value = "日志信息")
private String jobMessage;
/** 执行状态(0正常 1失败) */
@Schema(description = "执行状态")
@Excel(name = "执行状态", readConverterExp = "0=正常,1=失败")
@ExcelProperty(value = "执行状态(0=正常,1=失败)")
private String status;
/** 异常信息 */
@Schema(description = "异常信息")
@Excel(name = "异常信息")
@ExcelProperty(value = "异常信息")
private String exceptionInfo;
/** 开始时间 */
......
......@@ -2,7 +2,6 @@ package com.twelvet.api.system.domain;
import com.twelvet.framework.core.application.domain.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
......
package com.twelvet.api.system.domain;
import com.alibaba.excel.annotation.ExcelProperty;
import com.twelvet.framework.core.application.domain.BaseEntity;
import com.twelvet.framework.utils.annotation.excel.Excel;
import com.twelvet.framework.utils.annotation.excel.Excel.ColumnType;
import io.swagger.v3.oas.annotations.media.Schema;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
......@@ -25,35 +23,35 @@ public class SysConfig extends BaseEntity {
* 参数主键
*/
@Schema(description = "参数主键")
@Excel(name = "参数主键", cellType = ColumnType.NUMERIC)
@ExcelProperty(value = "参数主键")
private Long configId;
/**
* 参数名称
*/
@Schema(description = "参数名称")
@Excel(name = "参数名称")
@ExcelProperty(value = "参数名称")
private String configName;
/**
* 参数键名
*/
@Schema(description = "参数键名")
@Excel(name = "参数键名")
@ExcelProperty(value = "参数键名")
private String configKey;
/**
* 参数键值
*/
@Schema(description = "参数键值")
@Excel(name = "参数键值")
@ExcelProperty(value = "参数键值")
private String configValue;
/**
* 系统内置(Y是 N否)
*/
@Schema(description = "系统内置")
@Excel(name = "系统内置", readConverterExp = "Y=是,N=否")
@ExcelProperty(value = "系统内置(Y=是,N=否)")
private String configType;
public Long getConfigId() {
......
......@@ -2,7 +2,6 @@ package com.twelvet.api.system.domain;
import com.twelvet.framework.core.application.domain.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
......
package com.twelvet.api.system.domain;
import com.alibaba.excel.annotation.ExcelProperty;
import com.twelvet.framework.core.application.domain.BaseEntity;
import com.twelvet.framework.core.constants.UserConstants;
import com.twelvet.framework.utils.annotation.excel.Excel;
import com.twelvet.framework.utils.annotation.excel.Excel.ColumnType;
import io.swagger.v3.oas.annotations.media.Schema;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* @author twelvet
......@@ -25,35 +23,35 @@ public class SysDictData extends BaseEntity {
* 字典编码
*/
@Schema(description = "字典编码")
@Excel(name = "字典编码", cellType = ColumnType.NUMERIC)
@ExcelProperty(value = "字典编码")
private Long dictCode;
/**
* 字典排序
*/
@Schema(description = "字典排序")
@Excel(name = "字典排序", cellType = ColumnType.NUMERIC)
@ExcelProperty(value = "字典排序")
private Long dictSort;
/**
* 字典标签
*/
@Schema(description = "字典标签")
@Excel(name = "字典标签")
@ExcelProperty(value = "字典标签")
private String dictLabel;
/**
* 字典键值
*/
@Schema(description = "字典键值")
@Excel(name = "字典键值")
@ExcelProperty(value = "字典键值")
private String dictValue;
/**
* 字典类型
*/
@Schema(description = "字典类型")
@Excel(name = "字典类型")
@ExcelProperty(value = "字典类型")
private String dictType;
/**
......@@ -72,14 +70,14 @@ public class SysDictData extends BaseEntity {
* 是否默认(Y是 N否)
*/
@Schema(description = "是否默认")
@Excel(name = "是否默认", readConverterExp = "Y=是,N=否")
@ExcelProperty(value = "是否默认(Y=是,N=否)")
private String isDefault;
/**
* 状态(0正常 1停用)
*/
@Schema(description = "状态")
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
@ExcelProperty(value = "状态(0=正常,1=停用)")
private String status;
public Long getDictCode() {
......
package com.twelvet.api.system.domain;
import com.alibaba.excel.annotation.ExcelProperty;
import com.twelvet.framework.core.application.domain.BaseEntity;
import com.twelvet.framework.utils.annotation.excel.Excel;
import io.swagger.v3.oas.annotations.media.Schema;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.twelvet.framework.utils.annotation.excel.Excel.ColumnType;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
......@@ -20,28 +18,28 @@ public class SysDictType extends BaseEntity {
* 字典主键
*/
@Schema(description = "字典主键")
@Excel(name = "字典主键", cellType = ColumnType.NUMERIC)
@ExcelProperty(value = "字典主键")
private Long dictId;
/**
* 字典名称
*/
@Schema(description = "字典名称")
@Excel(name = "字典名称")
@ExcelProperty(value = "字典名称")
private String dictName;
/**
* 字典类型
*/
@Schema(description = "字典类型")
@Excel(name = "字典类型")
@ExcelProperty(value = "字典类型")
private String dictType;
/**
* 状态(0正常 1停用)
*/
@Schema(description = "状态")
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
@ExcelProperty(value = "状态(0=正常,1=停用)")
private String status;
public Long getDictId() {
......
package com.twelvet.api.system.domain;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.twelvet.framework.core.application.domain.BaseEntity;
import com.twelvet.framework.utils.annotation.excel.Excel;
import com.twelvet.framework.utils.annotation.excel.Excel.ColumnType;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.Date;
......@@ -22,35 +21,35 @@ public class SysLoginInfo extends BaseEntity {
* ID
*/
@Schema(description = "序号")
@Excel(name = "序号", cellType = ColumnType.NUMERIC)
@ExcelProperty(value = "序号")
private Long infoId;
/**
* 用户账号
*/
@Schema(description = "用户账号")
@Excel(name = "用户账号")
@ExcelProperty(value = "用户账号")
private String userName;
/**
* 状态 0成功 1失败
*/
@Schema(description = "状态")
@Excel(name = "状态", readConverterExp = "1=登录成功,2=退出成功,0=登录失败")
@ExcelProperty(value = "状态(1=登录成功,2=退出成功,0=登录失败)")
private String status;
/**
* 地址
*/
@Schema(description = "地址")
@Excel(name = "地址")
@ExcelProperty(value = "地址")
private String ipaddr;
/**
* 描述
*/
@Schema(description = "描述")
@Excel(name = "描述")
@ExcelProperty(value = "描述")
private String msg;
/**
......@@ -58,14 +57,14 @@ public class SysLoginInfo extends BaseEntity {
*/
@Schema(description = "访问时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "访问时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
@ExcelProperty(value = "访问时间")
private Date accessTime;
/**
* 部门ID
*/
@Schema(description = "部门ID")
@Excel(name = "部门ID")
@ExcelProperty(value = "部门ID")
private Long deptId;
public Long getDeptId() {
......
package com.twelvet.api.system.domain;
import java.util.Arrays;
import java.util.Date;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.twelvet.framework.core.application.domain.BaseEntity;
import com.twelvet.framework.utils.annotation.excel.Excel;
import com.twelvet.framework.utils.annotation.excel.Excel.ColumnType;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.Arrays;
import java.util.Date;
/**
* @author twelvet
* @WebSite twelvet.cn
......@@ -23,21 +22,21 @@ public class SysOperationLog extends BaseEntity {
* 日志主键
*/
@Schema(description = "日志主键")
@Excel(name = "操作序号", cellType = ColumnType.NUMERIC)
@ExcelProperty(value = "操作序号")
private Long operId;
/**
* 操作模块
*/
@Schema(description = "操作模块")
@Excel(name = "操作模块")
@ExcelProperty(value = "操作模块")
private String service;
/**
* 业务类型(0其它 1新增 2修改 3删除)
*/
@Schema(description = "业务类型")
@Excel(name = "业务类型", readConverterExp = "0=其它,1=新增,2=修改,3=删除,4=授权,5=导出,6=导入,7=强退,8=生成代码,9=清空数据")
@ExcelProperty(value = "业务类型(0=其它,1=新增,2=修改,3=删除,4=授权,5=导出,6=导入,7=强退,8=生成代码,9=清空数据)")
private Integer businessType;
/**
......@@ -50,77 +49,77 @@ public class SysOperationLog extends BaseEntity {
* 请求方法
*/
@Schema(description = "请求方法")
@Excel(name = "请求方法")
@ExcelProperty(value = "请求方法")
private String method;
/**
* 请求方式
*/
@Schema(description = "请求方式")
@Excel(name = "请求方式")
@ExcelProperty(value = "请求方式")
private String requestMethod;
/**
* 操作类别(0其它 1后台用户 2手机端用户)
*/
@Schema(description = "操作类别")
@Excel(name = "操作类别", readConverterExp = "0=其它,1=后台用户,2=手机端用户")
@ExcelProperty(value = "操作类别(0=其它,1=后台用户,2=手机端用户)")
private Integer operatorType;
/**
* 操作人员
*/
@Schema(description = "操作人员")
@Excel(name = "操作人员")
@ExcelProperty(value = "操作人员")
private String operName;
/**
* 部门名称
*/
@Schema(description = "部门名称")
@Excel(name = "部门名称")
@ExcelProperty(value = "部门名称")
private String deptName;
/**
* 请求url
*/
@Schema(description = "请求url")
@Excel(name = "请求地址")
@ExcelProperty(value = "请求地址")
private String operUrl;
/**
* 操作地址
*/
@Schema(description = "操作地址")
@Excel(name = "操作地址")
@ExcelProperty(value = "操作地址")
private String operIp;
/**
* 请求参数
*/
@Schema(description = "请求参数")
@Excel(name = "请求参数")
@ExcelProperty(value = "请求参数")
private String operParam;
/**
* 返回参数
*/
@Schema(description = "返回参数")
@Excel(name = "返回参数")
@ExcelProperty(value = "返回参数")
private String jsonResult;
/**
* 操作状态(0正常 1异常)
*/
@Schema(description = "操作状态")
@Excel(name = "状态", readConverterExp = "0=正常,1=异常")
@ExcelProperty(value = "状态(0=正常,1=异常)")
private Integer status;
/**
* 错误消息
*/
@Schema(description = "错误消息")
@Excel(name = "错误消息")
@ExcelProperty(value = "错误消息")
private String errorMsg;
/**
......@@ -128,14 +127,14 @@ public class SysOperationLog extends BaseEntity {
*/
@Schema(description = "操作时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "操作时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
@ExcelProperty(value = "操作时间")
private Date operTime;
/**
* 部门ID
*/
@Schema(description = "部门ID")
@Excel(name = "部门ID")
@ExcelProperty(value = "部门ID")
private Long deptId;
public Long getDeptId() {
......
package com.twelvet.api.system.domain;
import com.alibaba.excel.annotation.ExcelProperty;
import com.twelvet.framework.core.application.domain.BaseEntity;
import com.twelvet.framework.utils.annotation.excel.Excel;
import com.twelvet.framework.utils.annotation.excel.Excel.ColumnType;
import io.swagger.v3.oas.annotations.media.Schema;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
......@@ -25,35 +23,35 @@ public class SysPost extends BaseEntity {
* 岗位序号
*/
@Schema(description = "岗位序号")
@Excel(name = "岗位序号", cellType = ColumnType.NUMERIC)
@ExcelProperty(value = "岗位序号")
private Long postId;
/**
* 岗位编码
*/
@Schema(description = "岗位编码")
@Excel(name = "岗位编码")
@ExcelProperty(value = "岗位编码")
private String postCode;
/**
* 岗位名称
*/
@Schema(description = "岗位名称")
@Excel(name = "岗位名称")
@ExcelProperty(value = "岗位名称")
private String postName;
/**
* 岗位排序
*/
@Schema(description = "岗位排序")
@Excel(name = "岗位排序")
@ExcelProperty(value = "岗位排序")
private String postSort;
/**
* 状态(0正常 1停用)
*/
@Schema(description = "状态")
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
@ExcelProperty(value = "状态(0=正常,1=停用)")
private String status;
/**
......
package com.twelvet.api.system.domain;
import io.swagger.v3.oas.annotations.media.Schema;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.io.Serializable;
/**
* @author twelvet
* @WebSite twelvet.cn
* @Description: 角色和部门关联 sys_role_dept
*/
@Schema(description = "角色和部门关联")
public class SysRoleDept {
public class SysRoleDept implements Serializable {
private static final long serialVersionUID = 1L;
/** 角色ID */
@Schema(description = "角色ID")
......
package com.twelvet.api.system.domain;
import io.swagger.v3.oas.annotations.media.Schema;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.io.Serializable;
/**
* @author twelvet
* @WebSite twelvet.cn
* @Description: 角色和菜单关联 sys_role_menu
*/
@Schema(description = "角色和菜单关联")
public class SysRoleMenu {
public class SysRoleMenu implements Serializable {
private static final long serialVersionUID = 1L;
/** 角色ID */
/**
* 角色ID
*/
@Schema(description = "角色ID")
private Long roleId;
/** 菜单ID */
/**
* 菜单ID
*/
@Schema(description = "菜单ID")
private Long menuId;
......
package com.twelvet.api.system.domain;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.twelvet.framework.core.application.domain.BaseEntity;
import com.twelvet.framework.core.xss.Xss;
import com.twelvet.framework.utils.annotation.excel.Excel;
import com.twelvet.framework.utils.annotation.excel.Excel.ColumnType;
import com.twelvet.framework.utils.annotation.excel.Excel.Type;
import com.twelvet.framework.utils.annotation.excel.Excels;
import io.swagger.v3.oas.annotations.media.Schema;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
......@@ -32,49 +27,49 @@ public class SysUser extends BaseEntity {
* 用户ID
*/
@Schema(description = "用户ID")
@Excel(name = "用户序号", cellType = ColumnType.NUMERIC, prompt = "用户编号")
@ExcelProperty(value = "用户序号")
private Long userId;
/**
* 部门ID
*/
@Schema(description = "部门ID")
@Excel(name = "部门编号", type = Type.IMPORT)
@ExcelProperty(value = "部门编号")
private Long deptId;
/**
* 用户账号
*/
@Schema(description = "用户账号")
@Excel(name = "登录名称")
@ExcelProperty(value = "登录名称")
private String username;
/**
* 用户昵称
*/
@Schema(description = "用户昵称")
@Excel(name = "用户名称")
@ExcelProperty(value = "用户名称")
private String nickName;
/**
* 用户邮箱
*/
@Schema(description = "用户邮箱")
@Excel(name = "用户邮箱")
@ExcelProperty(value = "用户邮箱")
private String email;
/**
* 手机号码
*/
@Schema(description = "手机号码")
@Excel(name = "手机号码")
@ExcelProperty(value = "手机号码")
private String phonenumber;
/**
* 用户性别
*/
@Schema(description = "用户性别")
@Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知")
@ExcelProperty(value = "用户性别(0=男,1=女,2=未知)")
private String sex;
/**
......@@ -93,7 +88,7 @@ public class SysUser extends BaseEntity {
* 帐号状态(0正常 1停用)
*/
@Schema(description = "帐号状态")
@Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用")
@ExcelProperty(value = "帐号状态(0=正常,1=停用)")
private String status;
/**
......@@ -106,39 +101,41 @@ public class SysUser extends BaseEntity {
* 最后登录IP
*/
@Schema(description = "最后登录IP")
@Excel(name = "最后登录IP", type = Type.EXPORT)
@ExcelProperty(value = "最后登录IP")
private String loginIp;
/**
* 最后登录时间
*/
@Schema(description = "最后登录时间")
@Excel(name = "最后登录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT)
@ExcelProperty(value = "最后登录时间")
private Date loginDate;
/**
* 部门对象
*/
@ExcelIgnore
@Schema(description = "部门对象")
@Excels({ @Excel(name = "部门名称", targetAttr = "deptName", type = Type.EXPORT),
@Excel(name = "部门负责人", targetAttr = "leader", type = Type.EXPORT) })
private SysDept dept;
/**
* 角色对象
*/
@ExcelIgnore
@Schema(description = "角色对象")
private List<SysRole> roles;
/**
* 角色组
*/
@ExcelIgnore
@Schema(description = "角色组")
private Long[] roleIds;
/**
* 岗位组
*/
@ExcelIgnore
@Schema(description = "岗位组")
private Long[] postIds;
......@@ -180,7 +177,6 @@ public class SysUser extends BaseEntity {
this.deptId = deptId;
}
@Xss(message = "用户昵称不能包含脚本字符")
@Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符")
public String getNickName() {
return nickName;
......@@ -190,7 +186,6 @@ public class SysUser extends BaseEntity {
this.nickName = nickName;
}
@Xss(message = "用户账号不能包含脚本字符")
@NotBlank(message = "用户账号不能为空")
@Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符")
public String getUsername() {
......
package com.twelvet.api.system.domain;
import io.swagger.v3.oas.annotations.media.Schema;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.io.Serializable;
/**
* @author twelvet
* @WebSite twelvet.cn
* @Description: 用户和岗位关联 sys_user_post
*/
@Schema(description = "用户和岗位关联")
public class SysUserPost {
public class SysUserPost implements Serializable {
private static final long serialVersionUID = 1L;
/** 用户ID */
@Schema(description = "用户ID")
......
package com.twelvet.api.system.domain;
import io.swagger.v3.oas.annotations.media.Schema;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.io.Serializable;
/**
* @author twelvet
* @WebSite twelvet.cn
* @Description: 用户和角色关联 sys_user_role
*/
@Schema(description = "用户和角色关联")
public class SysUserRole {
public class SysUserRole implements Serializable {
private static final long serialVersionUID = 1L;
/** 用户ID */
@Schema(description = "用户ID")
......
......@@ -40,6 +40,12 @@
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<!--Excel-->
<dependency>
<groupId>cn.twelvet.excel</groupId>
<artifactId>excel-spring-boot-starter</artifactId>
</dependency>
</dependencies>
</project>
package com.twelvet.framework.core.application.domain;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.io.Serializable;
......@@ -19,48 +21,57 @@ public class BaseEntity implements Serializable {
/**
* 搜索值
*/
@ExcelIgnore
private String searchValue;
/**
* 创建者
*/
@ExcelProperty("创建者")
private String createBy;
/**
* 创建时间
*/
@ExcelProperty("创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/**
* 更新者
*/
@ExcelProperty("更新者")
private String updateBy;
/**
* 更新时间
*/
@ExcelProperty("更新时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
/**
* 备注
*/
@ExcelProperty("备注")
private String remark;
/**
* 开始时间
*/
@ExcelProperty("开始时间")
private String beginTime;
/**
* 结束时间
*/
@ExcelProperty("结束时间")
private String endTime;
/**
* 请求参数
*/
@ExcelIgnore
private Map<String, Object> params;
public String getSearchValue() {
......
package com.twelvet.framework.utils.annotation.excel;
import com.twelvet.framework.utils.poi.ExcelHandlerAdapter;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.IndexedColors;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.math.BigDecimal;
/**
* @author twelvet
* @WebSite twelvet.cn
* @Description: 自定义导出Excel数据注解
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface Excel {
/**
* 导出时在excel中排序
*/
public int sort() default Integer.MAX_VALUE;
/**
* 导出到Excel中的名字.
*/
public String name() default "";
/**
* 日期格式, 如: yyyy-MM-dd
*/
public String dateFormat() default "";
/**
* 读取内容转表达式 (如: 0=男,1=女,2=未知)
*/
public String readConverterExp() default "";
/**
* 分隔符,读取字符串组内容
*/
public String separator() default ",";
/**
* BigDecimal 精度 默认:-1(默认不开启BigDecimal格式化)
*/
public int scale() default -1;
/**
* BigDecimal 舍入规则 默认:BigDecimal.ROUND_HALF_EVEN
*/
public int roundingMode() default BigDecimal.ROUND_HALF_EVEN;
/**
* 导出时在excel中每个列的高度 单位为字符
*/
public double height() default 14;
/**
* 导出时在excel中每个列的宽 单位为字符
*/
public double width() default 16;
/**
* 文字后缀,如% 90 变成90%
*/
public String suffix() default "";
/**
* 当值为空时,字段的默认值
*/
public String defaultValue() default "";
/**
* 提示信息
*/
public String prompt() default "";
/**
* 设置只能选择不能输入的列内容.
*/
public String[] combo() default {};
/**
* 是否导出数据,应对需求:有时我们需要导出一份模板,这是标题需要但内容需要用户手工填写.
*/
public boolean isExport() default true;
/**
* 另一个类中的属性名称,支持多级获取,以小数点隔开
*/
public String targetAttr() default "";
/**
* 是否自动统计数据,在最后追加一行统计数据总和
*/
public boolean isStatistics() default false;
/**
* 导出类型(0数字 1字符串)
*/
public ColumnType cellType() default ColumnType.STRING;
/**
* 导出字体颜色
*/
public IndexedColors color() default IndexedColors.BLACK;
/**
* 导出字段对齐方式
*/
public HorizontalAlignment align() default HorizontalAlignment.CENTER;
/**
* 自定义数据处理器
*/
public Class<?> handler() default ExcelHandlerAdapter.class;
/**
* 自定义数据处理器参数
*/
public String[] args() default {};
/**
* 字段类型(0:导出导入;1:仅导出;2:仅导入)
*/
Type type() default Type.ALL;
public enum Type {
ALL(0), EXPORT(1), IMPORT(2);
private final int value;
Type(int value) {
this.value = value;
}
public int value() {
return this.value;
}
}
public enum ColumnType {
NUMERIC(0), STRING(1), IMAGE(2);
private final int value;
ColumnType(int value) {
this.value = value;
}
public int value() {
return this.value;
}
}
}
package com.twelvet.framework.utils.annotation.excel;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @author twelvet
* @WebSite twelvet.cn
* @Description: Excel注解集
*/
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
public @interface Excels {
Excel[] value();
}
package com.twelvet.framework.utils.poi;
/**
* @author twelvet
* @WebSite twelvet.cn
* @Description: Excel数据格式处理适配器
*/
public interface ExcelHandlerAdapter {
/**
* 格式化
* @param value 单元格数据值
* @param args excel注解args参数组
* @return 处理后的值
*/
Object format(Object value, String[] args);
}
......@@ -5,7 +5,6 @@ import com.twelvet.framework.utils.DateUtils;
import com.twelvet.framework.utils.exception.TWTUtilsException;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
import org.apache.poi.ss.usermodel.DateUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -165,9 +164,6 @@ public class ReflectUtils {
if (args[i] instanceof String) {
args[i] = DateUtils.parseDate(args[i]);
}
else {
args[i] = DateUtil.getJavaDate((Double) args[i]);
}
}
}
}
......
......@@ -62,6 +62,12 @@
<dependency>
<groupId>com.twelvet</groupId>
<artifactId>twelvet-framework-core</artifactId>
<exclusions>
<exclusion>
<groupId>cn.twelvet.excel</groupId>
<artifactId>excel-spring-boot-starter</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
......
......@@ -65,6 +65,12 @@
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>
<!--Excel-->
<dependency>
<groupId>cn.twelvet.excel</groupId>
<artifactId>excel-spring-boot-starter</artifactId>
</dependency>
</dependencies>
<build>
......
......@@ -227,11 +227,10 @@ public class GenController extends TWTController {
* @param data 数据
* @throws IOException IOException
*/
@Operation(summary = "生成zip文件")
private void genCode(HttpServletResponse response, byte[] data) throws IOException {
response.reset();
response.setHeader("Content-Disposition", "attachment; filename=\"twelvet.zip\"");
response.addHeader("Content-Length", "" + data.length);
response.setHeader("Content-Length", String.valueOf(data.length));
response.setContentType("application/octet-stream; charset=UTF-8");
IOUtils.write(data, response.getOutputStream());
}
......
......@@ -225,7 +225,7 @@ public class GenTableServiceImpl implements IGenTableService {
// 获取模板列表
List<String> templates = VelocityUtils.getTemplateList(table.getTplCategory());
for (String template : templates) {
if (!StringUtils.containsAny(template, "sql.vm", "api.ts.vm", "index.tsx.vm", "index-tree.tsx.vm")) {
if (!StringUtils.containsAny(template, "sql.vm", "service.ts.vm", "index.tsx.vm", "index-tree.tsx.vm")) {
// 渲染模板
StringWriter sw = new StringWriter();
Template tpl = Velocity.getTemplate(template, Constants.UTF8);
......
......@@ -130,7 +130,7 @@ public class VelocityUtils {
templates.add("vm/java/controller.java.vm");
templates.add("vm/xml/mapper.xml.vm");
templates.add("vm/sql/sql.vm");
templates.add("vm/js/api.ts.vm");
templates.add("vm/react/service.ts.vm");
if (GenConstants.TPL_CRUD.equals(tplCategory)) {
templates.add("vm/react/index.tsx.vm");
}
......@@ -188,7 +188,7 @@ public class VelocityUtils {
else if (template.contains("sql.vm")) {
fileName = businessName + "Menu.sql";
}
else if (template.contains("api.ts.vm")) {
else if (template.contains("service.ts.vm")) {
fileName = StringUtils.format("{}/pages/{}/{}/service.ts", reactPath, moduleName, businessName);
}
else if (template.contains("index.tsx.vm")) {
......
package ${packageName}.controller;
import java.util.List;
import jakarta.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -16,13 +16,13 @@ import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import com.twelvet.framework.log.annotation.Log;
import com.twelvet.framework.log.enums.BusinessType;
import org.springframework.security.access.prepost.PreAuthorize;
import cn.dev33.satoken.annotation.SaCheckPermission;
import ${packageName}.domain.${ClassName};
import ${packageName}.service.I${ClassName}Service;
import com.twelvet.framework.core.application.controller.TWTController;
import com.twelvet.framework.core.application.domain.AjaxResult;
import com.twelvet.framework.core.application.domain.JsonResult;
import com.twelvet.framework.utils.poi.ExcelUtils;
import cn.twelvet.excel.annotation.ResponseExcel;
#if($table.crud || $table.sub)
import com.twelvet.framework.jdbc.web.utils.PageUtils;
#elseif($table.tree)
......@@ -37,20 +37,20 @@ import com.twelvet.framework.jdbc.web.utils.PageUtils;
*/
@Tag(description = "${ClassName}Controller", name = "${functionName}")
@RestController
@RequestMapping("/${businessName}")
@RequestMapping("/${moduleName}/${businessName}")
public class ${ClassName}Controller extends TWTController
{
@Autowired
private I${ClassName}Service ${className}Service;
/**
* 查询${functionName}列表
*/
@Operation(summary = "查询${functionName}列表")
@PreAuthorize("@role.hasPermi('${permissionPrefix}:list')")
@GetMapping("/list")
/**
* 查询${functionName}列表
*/
@Operation(summary = "查询${functionName}列表")
@SaCheckPermission("${permissionPrefix}:list")
@GetMapping("/pageQuery")
#if($table.crud || $table.sub)
public JsonResult<TableDataInfo> list(${ClassName} ${className})
public JsonResult<TableDataInfo> pageQuery(${ClassName} ${className})
{
PageUtils.startPage();
List<${ClassName}> list = ${className}Service.select${ClassName}List(${className});
......@@ -67,22 +67,21 @@ public class ${ClassName}Controller extends TWTController
/**
* 导出${functionName}列表
*/
@ResponseExcel(name = "${functionName}")
@Operation(summary = "导出${functionName}列表")
@PreAuthorize("@role.hasPermi('${permissionPrefix}:export')")
@SaCheckPermission("${permissionPrefix}:export")
@Log(service = "${functionName}", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, ${ClassName} ${className})
public List<${ClassName}> export(${ClassName} ${className})
{
List<${ClassName}> list = ${className}Service.select${ClassName}List(${className});
ExcelUtils<${ClassName}> util = new ExcelUtils<${ClassName}>(${ClassName}.class);
util.exportExcel(response, list, "${functionName}数据");
return ${className}Service.select${ClassName}List(${className});
}
/**
* 获取${functionName}详细信息
*/
@Operation(summary = "获取${functionName}详细信息")
@PreAuthorize("@role.hasPermi('${permissionPrefix}:query')")
@SaCheckPermission("${permissionPrefix}:query")
@GetMapping(value = "/{${pkColumn.javaField}}")
public JsonResult<${ClassName}> getInfo(@PathVariable("${pkColumn.javaField}") ${pkColumn.javaType} ${pkColumn.javaField})
{
......@@ -93,7 +92,7 @@ public class ${ClassName}Controller extends TWTController
* 新增${functionName}
*/
@Operation(summary = "新增${functionName}")
@PreAuthorize("@role.hasPermi('${permissionPrefix}:add')")
@SaCheckPermission("${permissionPrefix}:add")
@Log(service = "${functionName}", businessType = BusinessType.INSERT)
@PostMapping
public JsonResult<String> add(@RequestBody ${ClassName} ${className})
......@@ -105,7 +104,7 @@ public class ${ClassName}Controller extends TWTController
* 修改${functionName}
*/
@Operation(summary = "修改${functionName}")
@PreAuthorize("@role.hasPermi('${permissionPrefix}:edit')")
@SaCheckPermission("${permissionPrefix}:edit")
@Log(service = "${functionName}", businessType = BusinessType.UPDATE)
@PutMapping
public JsonResult<String> edit(@RequestBody ${ClassName} ${className})
......@@ -117,7 +116,7 @@ public class ${ClassName}Controller extends TWTController
* 删除${functionName}
*/
@Operation(summary = "删除${functionName}")
@PreAuthorize("@role.hasPermi('${permissionPrefix}:remove')")
@SaCheckPermission("${permissionPrefix}:remove")
@Log(service = "${functionName}", businessType = BusinessType.DELETE)
@DeleteMapping("/{${pkColumn.javaField}s}")
public JsonResult<String> remove(@PathVariable ${pkColumn.javaType}[] ${pkColumn.javaField}s)
......
......@@ -3,7 +3,7 @@ package ${packageName}.domain;
#foreach ($import in $importList)
import ${import};
#end
import com.twelvet.framework.utils.annotation.excel.Excel;
import com.alibaba.excel.annotation.ExcelProperty;
import com.twelvet.framework.core.application.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
......@@ -43,12 +43,12 @@ public class ${ClassName} extends ${Entity} {
#set($comment=$column.columnComment)
#end
#if($parentheseIndex != -1)
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
@ExcelProperty(value ="${comment}($column.readConverterExp())")
#elseif($column.javaType == 'Date')
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "${comment}", width = 30, dateFormat = "yyyy-MM-dd")
@ExcelProperty(value ="${comment}", width = 30, dateFormat = "yyyy-MM-dd")
#else
@Excel(name = "${comment}")
@ExcelProperty(value ="${comment}")
#end
#end
private $column.javaType $column.javaField;
......
......@@ -28,12 +28,12 @@ public class ${subClassName} extends BaseEntity
#set($comment=$column.columnComment)
#end
#if($parentheseIndex != -1)
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
@ExcelProperty(value ="${comment}($column.readConverterExp())")
#elseif($column.javaType == 'Date')
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "${comment}", width = 30, dateFormat = "yyyy-MM-dd")
@ExcelProperty(value ="${comment}", width = 30, dateFormat = "yyyy-MM-dd")
#else
@Excel(name = "${comment}")
@ExcelProperty(value ="${comment}")
#end
#end
private $column.javaType $column.javaField;
......
import request, { download } from '@/utils/request'
import {request} from '@umijs/max'
import {download} from '@/utils/twelvet'
// 请求的控制器名称
const controller = "/${moduleName}/${businessName}";
/**
* 查询${functionName}列表
* @param query 查询参数
*/
export function list${BusinessName}(query: { [key: string]: any }) {
return request(`/${moduleName}/${businessName}/list`, {
export function pageQuery${BusinessName}(query: { [key: string]: any }) {
return request(`${controller}/pageQuery`, {
method: `get`,
params: query
})
......@@ -16,7 +20,7 @@ export function list${BusinessName}(query: { [key: string]: any }) {
* @param 主键
*/
export function get${BusinessName}(${pkColumn.javaField}: string | number) {
return request(`/${moduleName}/${businessName}/${${pkColumn.javaField}}`, {
return request(`${controller}/${${pkColumn.javaField}}`, {
method: `get`
})
}
......@@ -26,7 +30,7 @@ export function get${BusinessName}(${pkColumn.javaField}: string | number) {
* @param data 数据参数
*/
export function add${BusinessName}(data: { [key: string]: any }) {
return request(`/${moduleName}/${businessName}`, {
return request(`${controller}`, {
method: `post`,
data: data
})
......@@ -37,7 +41,7 @@ export function add${BusinessName}(data: { [key: string]: any }) {
* @param data 数据参数
*/
export function update${BusinessName}(data: { [key: string]: any }) {
return request(`/${moduleName}/${businessName}`, {
return request(`${controller}`, {
method: `put`,
data: data
})
......@@ -48,7 +52,7 @@ export function update${BusinessName}(data: { [key: string]: any }) {
* @param 主键
*/
export function del${BusinessName}(${pkColumn.javaField}: string | number) {
return request(`/${moduleName}/${businessName}/${${pkColumn.javaField}}`, {
return request(`${controller}/${${pkColumn.javaField}}`, {
method: `delete`
})
}
......@@ -57,6 +61,6 @@ export function del${BusinessName}(${pkColumn.javaField}: string | number) {
* 导出数据
* @param params
*/
export async function exportDfs(params?: { [key: string]: any }) {
return download(`/${moduleName}/${businessName}/export`, params);
export async function export${BusinessName}(params?: { [key: string]: any }) {
return download(`${controller}/export`, params);
}
-- 菜单 SQL
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('${functionName}', '${parentMenuId}', '1', '${businessName}', '${moduleName}/${businessName}/index', 1, 0, 'C', '0', '0', '${permissionPrefix}:list', '#', 'admin', '2018-03-01', 'twelvet', '2018-03-01', '${functionName}菜单');
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('${functionName}', '${parentMenuId}', '1', '${businessName}', '${moduleName}/${businessName}/index', 1, 'C', '0', '0', '${permissionPrefix}:list', '#', 'admin', '2018-03-01', 'twelvet', '2018-03-01', '${functionName}菜单');
-- 按钮父菜单ID
SELECT @parentId := LAST_INSERT_ID();
-- 按钮 SQL
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('${functionName}查询', @parentId, '1', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:query', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', '');
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('${functionName}查询', @parentId, '1', '#', '', 1, 'F', '0', '0', '${permissionPrefix}:query', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', '');
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('${functionName}新增', @parentId, '2', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:add', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', '');
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('${functionName}新增', @parentId, '2', '#', '', 1, 'F', '0', '0', '${permissionPrefix}:add', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', '');
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('${functionName}修改', @parentId, '3', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:edit', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', '');
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('${functionName}修改', @parentId, '3', '#', '', 1, 'F', '0', '0', '${permissionPrefix}:edit', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', '');
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('${functionName}删除', @parentId, '4', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:remove', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', '');
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('${functionName}删除', @parentId, '4', '#', '', 1, 'F', '0', '0', '${permissionPrefix}:remove', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', '');
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('${functionName}导出', @parentId, '5', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:export', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', '');
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('${functionName}导出', @parentId, '5', '#', '', 1, 'F', '0', '0', '${permissionPrefix}:export', '#', 'admin', '2018-03-01', 'ry', '2018-03-01', '');
package com.twelvet.server.job.controller;
import cn.twelvet.excel.annotation.ResponseExcel;
import com.twelvet.api.job.domain.SysJob;
import com.twelvet.framework.core.application.controller.TWTController;
import com.twelvet.framework.core.application.domain.JsonResult;
import com.twelvet.framework.core.constants.Constants;
import com.twelvet.framework.core.application.page.TableDataInfo;
import com.twelvet.framework.core.constants.Constants;
import com.twelvet.framework.jdbc.web.utils.PageUtils;
import com.twelvet.framework.log.annotation.Log;
import com.twelvet.framework.log.enums.BusinessType;
import com.twelvet.framework.security.utils.SecurityUtils;
import com.twelvet.framework.utils.StringUtils;
import com.twelvet.framework.utils.poi.ExcelUtils;
import com.twelvet.server.job.exception.TaskException;
import com.twelvet.server.job.service.ISysJobService;
import com.twelvet.server.job.util.CronUtils;
import com.twelvet.server.job.util.ScheduleUtils;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.quartz.SchedulerException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
......@@ -54,17 +53,16 @@ public class SysJobController extends TWTController {
/**
* 导出定时任务列表
* @param response HttpServletResponse
* @param sysJob SysJob
* @return List<SysJob>
*/
@ResponseExcel(name = "定时任务")
@Operation(summary = "导出定时任务列表")
@Log(service = "定时任务", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@PreAuthorize("@role.hasPermi('monitor:job:export')")
public void export(HttpServletResponse response, @RequestBody SysJob sysJob) {
List<SysJob> list = jobService.selectJobList(sysJob);
ExcelUtils<SysJob> excelUtils = new ExcelUtils<>(SysJob.class);
excelUtils.exportExcel(response, list, "定时任务");
public List<SysJob> export(@RequestBody SysJob sysJob) {
return jobService.selectJobList(sysJob);
}
/**
......
package com.twelvet.server.job.controller;
import cn.twelvet.excel.annotation.ResponseExcel;
import com.twelvet.api.job.domain.SysJobLog;
import com.twelvet.framework.core.application.controller.TWTController;
import com.twelvet.framework.core.application.domain.JsonResult;
......@@ -7,15 +8,13 @@ import com.twelvet.framework.core.application.page.TableDataInfo;
import com.twelvet.framework.jdbc.web.utils.PageUtils;
import com.twelvet.framework.log.annotation.Log;
import com.twelvet.framework.log.enums.BusinessType;
import com.twelvet.framework.utils.poi.ExcelUtils;
import com.twelvet.server.job.service.ISysJobLogService;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
......@@ -47,17 +46,16 @@ public class SysJobLogController extends TWTController {
/**
* 导出定时任务调度日志列表
* @param response HttpServletResponse
* @param sysJobLog SysJobLog
* @return List<SysJobLog>
*/
@ResponseExcel(name = "任务调度日志")
@Operation(summary = "导出定时任务调度日志列表")
@Log(service = "任务调度日志", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@PreAuthorize("@role.hasPermi('system:job:export')")
public void export(HttpServletResponse response, @RequestBody SysJobLog sysJobLog) {
List<SysJobLog> list = jobLogService.selectJobLogList(sysJobLog);
ExcelUtils<SysJobLog> excelUtils = new ExcelUtils<>(SysJobLog.class);
excelUtils.exportExcel(response, list, "调度日志");
public List<SysJobLog> export(@RequestBody SysJobLog sysJobLog) {
return jobLogService.selectJobLogList(sysJobLog);
}
/**
......
......@@ -8,12 +8,11 @@ import com.twelvet.framework.core.application.page.TableDataInfo;
import com.twelvet.framework.jdbc.web.utils.PageUtils;
import com.twelvet.framework.log.annotation.Log;
import com.twelvet.framework.log.enums.BusinessType;
import com.twelvet.framework.security.utils.SecurityUtils;
import com.twelvet.framework.utils.TUtils;
import com.twelvet.framework.utils.StringUtils;
import com.twelvet.framework.utils.TUtils;
import com.twelvet.server.system.service.ISysClientDetailsService;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
......@@ -73,7 +72,7 @@ public class Oauth2ClientDetailsController extends TWTController {
if (StringUtils.isNotNull(sysClientDetailsService.selectSysClientDetailsById(clientId))) {
return JsonResult.error("新增终端'" + clientId + "'失败,编号已存在");
}
sysClientDetails.setClientSecret(SecurityUtils.encryptPassword(sysClientDetails.getClientSecret()));
sysClientDetails.setClientSecret(sysClientDetails.getClientSecret());
return json(sysClientDetailsService.insertSysClientDetails(sysClientDetails));
}
......
......@@ -3,8 +3,8 @@ package com.twelvet.server.system.controller;
import com.twelvet.framework.core.application.domain.AjaxResult;
import com.twelvet.framework.utils.DateUtils;
import com.twelvet.framework.utils.StringUtils;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.connection.RedisServerCommands;
import org.springframework.data.redis.core.RedisCallback;
......
......@@ -11,8 +11,8 @@ import com.twelvet.framework.log.enums.BusinessType;
import com.twelvet.framework.security.utils.SecurityUtils;
import com.twelvet.framework.utils.StringUtils;
import com.twelvet.server.system.service.ISysDeptService;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
......
package com.twelvet.server.system.controller;
import cn.twelvet.excel.annotation.ResponseExcel;
import com.twelvet.api.system.domain.SysDictData;
import com.twelvet.framework.core.application.controller.TWTController;
import com.twelvet.framework.core.application.domain.JsonResult;
......@@ -8,17 +9,15 @@ import com.twelvet.framework.jdbc.web.utils.PageUtils;
import com.twelvet.framework.log.annotation.Log;
import com.twelvet.framework.log.enums.BusinessType;
import com.twelvet.framework.security.utils.SecurityUtils;
import com.twelvet.framework.utils.poi.ExcelUtils;
import com.twelvet.server.system.service.ISysDictDataService;
import com.twelvet.server.system.service.ISysDictTypeService;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
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;
/**
......@@ -53,17 +52,16 @@ public class SysDictDataController extends TWTController {
/**
* 导出数据字典excel
* @param response HttpServletResponse
* @param sysDictData SysDictData
* @return List<SysDictData>
*/
@ResponseExcel(name = "字典数据")
@Operation(summary = "导出数据字典excel")
@Log(service = "字典数据", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@PreAuthorize("@role.hasPermi('system:dict:export')")
public void exportExcel(HttpServletResponse response, @RequestBody SysDictData sysDictData) {
List<SysDictData> list = dictDataService.selectDictDataList(sysDictData);
ExcelUtils<SysDictData> excelUtils = new ExcelUtils<>(SysDictData.class);
excelUtils.exportExcel(response, list, "字典数据");
public List<SysDictData> exportExcel(@RequestBody SysDictData sysDictData) {
return dictDataService.selectDictDataList(sysDictData);
}
/**
......
package com.twelvet.server.system.controller;
import cn.twelvet.excel.annotation.ResponseExcel;
import com.twelvet.api.system.domain.SysDictType;
import com.twelvet.framework.core.application.controller.TWTController;
import com.twelvet.framework.core.application.domain.JsonResult;
import com.twelvet.framework.core.constants.UserConstants;
import com.twelvet.framework.core.application.page.TableDataInfo;
import com.twelvet.framework.core.constants.UserConstants;
import com.twelvet.framework.jdbc.web.utils.PageUtils;
import com.twelvet.framework.log.annotation.Log;
import com.twelvet.framework.log.enums.BusinessType;
import com.twelvet.framework.security.utils.SecurityUtils;
import com.twelvet.framework.utils.poi.ExcelUtils;
import com.twelvet.server.system.service.ISysDictTypeService;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
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;
/**
......@@ -50,17 +49,16 @@ public class SysDictTypeController extends TWTController {
/**
* 数据字典导出
* @param response HttpServletResponse
* @param dictType SysDictType
* @return List<SysDictType>
*/
@ResponseExcel(name = "字典类型")
@Operation(summary = "数据字典导出")
@Log(service = "字典类型", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@PreAuthorize("@role.hasPermi('system:dict:export')")
public void export(HttpServletResponse response, @RequestBody SysDictType dictType) {
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
ExcelUtils<SysDictType> excelUtils = new ExcelUtils<>(SysDictType.class);
excelUtils.exportExcel(response, list, "字典类型");
public List<SysDictType> export(@RequestBody SysDictType dictType) {
return dictTypeService.selectDictTypeList(dictType);
}
/**
......
package com.twelvet.server.system.controller;
import cn.twelvet.excel.annotation.ResponseExcel;
import com.twelvet.api.system.domain.SysLoginInfo;
import com.twelvet.framework.core.application.controller.TWTController;
import com.twelvet.framework.core.application.domain.JsonResult;
......@@ -7,15 +8,13 @@ import com.twelvet.framework.core.application.page.TableDataInfo;
import com.twelvet.framework.jdbc.web.utils.PageUtils;
import com.twelvet.framework.log.annotation.Log;
import com.twelvet.framework.log.enums.BusinessType;
import com.twelvet.framework.utils.poi.ExcelUtils;
import com.twelvet.server.system.service.ISysLoginInfoService;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
......@@ -72,17 +71,16 @@ public class SysLoginInfoController extends TWTController {
/**
* 导出Excel
* @param response HttpServletResponse
* @param loginInfo SysLoginInfo
* @return List<SysLoginInfo>
*/
@ResponseExcel(name = "登陆日志")
@Operation(summary = "导出Excel")
@Log(service = "登陆日志", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@PreAuthorize("@role.hasPermi('system:logininfor:export')")
public void export(HttpServletResponse response, @RequestBody SysLoginInfo loginInfo) {
List<SysLoginInfo> list = iSysLoginInfoService.selectLoginInfoList(loginInfo);
ExcelUtils<SysLoginInfo> excelUtils = new ExcelUtils<>(SysLoginInfo.class);
excelUtils.exportExcel(response, list, "登陆日志");
public List<SysLoginInfo> export(@RequestBody SysLoginInfo loginInfo) {
return iSysLoginInfoService.selectLoginInfoList(loginInfo);
}
}
package com.twelvet.server.system.controller;
import cn.twelvet.excel.annotation.ResponseExcel;
import com.twelvet.api.system.domain.SysOperationLog;
import com.twelvet.framework.core.application.controller.TWTController;
import com.twelvet.framework.core.application.domain.JsonResult;
......@@ -7,15 +8,13 @@ import com.twelvet.framework.core.application.page.TableDataInfo;
import com.twelvet.framework.jdbc.web.utils.PageUtils;
import com.twelvet.framework.log.annotation.Log;
import com.twelvet.framework.log.enums.BusinessType;
import com.twelvet.framework.utils.poi.ExcelUtils;
import com.twelvet.server.system.service.ISysOperationLogService;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
......@@ -73,17 +72,16 @@ public class SysOperationLogController extends TWTController {
/**
* Excel导出
* @param response HttpServletResponse
* @param operationLog SysOperationLog
* @return List<SysOperationLog>
*/
@ResponseExcel(name = "操作日志")
@Operation(summary = "Excel导出")
@Log(service = "操作日志", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@PreAuthorize("@role.hasPermi('system:operlog:export')")
public void export(HttpServletResponse response, @RequestBody SysOperationLog operationLog) {
List<SysOperationLog> list = iSysOperationLogService.selectOperationLogList(operationLog);
ExcelUtils<SysOperationLog> exportExcel = new ExcelUtils<>(SysOperationLog.class);
exportExcel.exportExcel(response, list, "操作日志");
public List<SysOperationLog> export(@RequestBody SysOperationLog operationLog) {
return iSysOperationLogService.selectOperationLogList(operationLog);
}
}
package com.twelvet.server.system.controller;
import cn.twelvet.excel.annotation.ResponseExcel;
import com.twelvet.api.system.domain.SysPost;
import com.twelvet.framework.core.application.controller.TWTController;
import com.twelvet.framework.core.application.domain.JsonResult;
import com.twelvet.framework.core.constants.UserConstants;
import com.twelvet.framework.core.application.page.TableDataInfo;
import com.twelvet.framework.core.constants.UserConstants;
import com.twelvet.framework.jdbc.web.utils.PageUtils;
import com.twelvet.framework.log.annotation.Log;
import com.twelvet.framework.log.enums.BusinessType;
import com.twelvet.framework.security.utils.SecurityUtils;
import com.twelvet.framework.utils.poi.ExcelUtils;
import com.twelvet.server.system.service.ISysPostService;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
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;
/**
......@@ -125,18 +124,17 @@ public class SysPostController extends TWTController {
}
/**
* 数据导出
* @param response HttpServletResponse
* 岗位管理数据导出
* @param sysPost SysPost
* @return List<SysPost>
*/
@ResponseExcel(name = "岗位管理")
@Operation(summary = "数据导出")
@Log(service = "岗位管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@PreAuthorize("@role.hasPermi('system:post:export')")
public void export(HttpServletResponse response, @RequestBody SysPost sysPost) {
List<SysPost> list = iSysPostService.selectPostList(sysPost);
ExcelUtils<SysPost> excelUtils = new ExcelUtils<>(SysPost.class);
excelUtils.exportExcel(response, list, "岗位数据");
public List<SysPost> export(@RequestBody SysPost sysPost) {
return iSysPostService.selectPostList(sysPost);
}
}
package com.twelvet.server.system.controller;
import cn.twelvet.excel.annotation.ResponseExcel;
import com.twelvet.api.system.domain.SysRole;
import com.twelvet.framework.core.application.controller.TWTController;
import com.twelvet.framework.core.application.domain.JsonResult;
import com.twelvet.framework.core.constants.UserConstants;
import com.twelvet.framework.core.application.page.TableDataInfo;
import com.twelvet.framework.core.constants.UserConstants;
import com.twelvet.framework.jdbc.web.utils.PageUtils;
import com.twelvet.framework.log.annotation.Log;
import com.twelvet.framework.log.enums.BusinessType;
import com.twelvet.framework.security.utils.SecurityUtils;
import com.twelvet.framework.utils.poi.ExcelUtils;
import com.twelvet.server.system.service.ISysRoleService;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
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;
/**
......@@ -50,17 +49,16 @@ public class SysRoleController extends TWTController {
/**
* 数据导出
* @param response HttpServletResponse
* @param role SysRole
* @return List<SysRole>
*/
@ResponseExcel(name = "角色管理")
@Operation(summary = "数据导出")
@Log(service = "角色管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@PreAuthorize("@role.hasPermi('system:role:export')")
public void export(HttpServletResponse response, @RequestBody SysRole role) {
List<SysRole> list = iSysRoleService.selectRoleList(role);
ExcelUtils<SysRole> excelUtils = new ExcelUtils<>(SysRole.class);
excelUtils.exportExcel(response, list, "角色数据");
public List<SysRole> export(@RequestBody SysRole role) {
return iSysRoleService.selectRoleList(role);
}
/**
......
package com.twelvet.server.system.controller;
import cn.twelvet.excel.annotation.RequestExcel;
import cn.twelvet.excel.annotation.ResponseExcel;
import com.twelvet.api.system.domain.SysRole;
import com.twelvet.api.system.domain.SysUser;
import com.twelvet.framework.core.application.controller.TWTController;
......@@ -13,7 +15,6 @@ import com.twelvet.framework.log.enums.BusinessType;
import com.twelvet.framework.security.utils.SecurityUtils;
import com.twelvet.framework.utils.StringUtils;
import com.twelvet.framework.utils.TUtils;
import com.twelvet.framework.utils.poi.ExcelUtils;
import com.twelvet.server.system.service.ISysPermissionService;
import com.twelvet.server.system.service.ISysPostService;
import com.twelvet.server.system.service.ISysRoleService;
......@@ -22,15 +23,11 @@ import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;
import java.util.stream.Collectors;
/**
......@@ -71,22 +68,21 @@ public class SysUserController extends TWTController {
/**
* 用户用户导出
* @param response HttpServletResponse
* @param user SysUser
* @return List<SysUser>
*/
@ResponseExcel(name = "用户管理")
@Operation(summary = "用户用户导出")
@PostMapping("/export")
@Log(service = "用户管理", businessType = BusinessType.EXPORT)
@PreAuthorize("@role.hasPermi('system:user:export')")
public void export(HttpServletResponse response, @RequestBody SysUser user) {
List<SysUser> list = iSysUserService.selectUserList(user);
ExcelUtils<SysUser> excelUtils = new ExcelUtils<>(SysUser.class);
excelUtils.exportExcel(response, list, "用户数据");
public List<SysUser> export(@RequestBody SysUser user) {
return iSysUserService.selectUserList(user);
}
/**
* 用户数据导入
* @param files MultipartFile[]
* @param userList List<SysUser>
* @param cover 是否允许覆盖
* @return JsonResult<String>
* @throws Exception Exception
......@@ -95,26 +91,20 @@ public class SysUserController extends TWTController {
@PostMapping("/importData")
@Log(service = "用户管理", businessType = BusinessType.IMPORT)
@PreAuthorize("@role.hasPermi('system:user:import')")
public JsonResult<String> importData(MultipartFile[] files, boolean cover) throws Exception {
ExcelUtils<SysUser> excelUtils = new ExcelUtils<>(SysUser.class);
// 支持多数据源导入
for (MultipartFile file : files) {
List<SysUser> userList = excelUtils.importExcel(file.getInputStream());
String operName = SecurityUtils.getUsername();
iSysUserService.importUser(userList, cover, operName);
}
public JsonResult<String> importData(@RequestExcel List<SysUser> userList, boolean cover,
BindingResult bindingResult) throws Exception {
String operName = SecurityUtils.getUsername();
iSysUserService.importUser(userList, cover, operName);
return JsonResult.success();
}
/**
* 导出模板
* @param response HttpServletResponse
*/
@Operation(summary = "导出模板")
@ResponseExcel(name = "用户数据导入模板")
@PostMapping("/exportTemplate")
public void exportTemplate(HttpServletResponse response) {
ExcelUtils<SysUser> excelUtils = new ExcelUtils<>(SysUser.class);
excelUtils.exportExcel(response, "用户数据");
public List<SysUser> exportTemplate() {
return Collections.singletonList(new SysUser());
}
/**
......