diff --git a/ruoyi-ui/src/api/system/dict/data.js b/ruoyi-ui/src/api/system/dict/data.js index e756a2f9e..c29b2f81f 100644 --- a/ruoyi-ui/src/api/system/dict/data.js +++ b/ruoyi-ui/src/api/system/dict/data.js @@ -54,9 +54,10 @@ export function delData(dictCode) { // 导出字典数据 export function exportData(query) { return request({ - url: '/system/dict/data/export', + url: '/system/dict-data/export', method: 'get', - params: query + params: query, + responseType: 'blob' }) } diff --git a/ruoyi-ui/src/api/system/dict/type.js b/ruoyi-ui/src/api/system/dict/type.js index 3738ae198..a1423f1d6 100644 --- a/ruoyi-ui/src/api/system/dict/type.js +++ b/ruoyi-ui/src/api/system/dict/type.js @@ -48,7 +48,8 @@ export function exportType(query) { return request({ url: '/system/dict-type/export', method: 'get', - params: query + params: query, + responseType: 'blob' }) } diff --git a/ruoyi-ui/src/api/system/role.js b/ruoyi-ui/src/api/system/role.js index 8e026a142..36edcc2dd 100644 --- a/ruoyi-ui/src/api/system/role.js +++ b/ruoyi-ui/src/api/system/role.js @@ -69,6 +69,7 @@ export function exportRole(query) { return request({ url: '/system/role/export', method: 'get', - params: query + params: query, + responseType: 'blob' }) } diff --git a/ruoyi-ui/src/views/system/dict/data.vue b/ruoyi-ui/src/views/system/dict/data.vue index 3a1071e4d..262ea31bb 100644 --- a/ruoyi-ui/src/views/system/dict/data.vue +++ b/ruoyi-ui/src/views/system/dict/data.vue @@ -314,7 +314,7 @@ export default { }).then(function() { return exportData(queryParams); }).then(response => { - this.download(response.msg); + this.downloadExcel(response, '字典数据.xls'); }) } } diff --git a/ruoyi-ui/src/views/system/dict/index.vue b/ruoyi-ui/src/views/system/dict/index.vue index ea91bda2a..0e775eaf6 100644 --- a/ruoyi-ui/src/views/system/dict/index.vue +++ b/ruoyi-ui/src/views/system/dict/index.vue @@ -304,7 +304,10 @@ export default { }, /** 导出按钮操作 */ handleExport() { - const queryParams = this.queryParams; + const queryParams = this.addDateRange(this.queryParams, [ + this.dateRange[0] ? this.dateRange[0] + ' 00:00:00' : undefined, + this.dateRange[1] ? this.dateRange[1] + ' 23:59:59' : undefined, + ]); this.$confirm('是否确认导出所有类型数据项?', "警告", { confirmButtonText: "确定", cancelButtonText: "取消", @@ -312,7 +315,7 @@ export default { }).then(function() { return exportType(queryParams); }).then(response => { - this.download(response.msg); + this.downloadExcel(response, '数据类型.xls'); }) } } diff --git a/ruoyi-ui/src/views/system/role/index.vue b/ruoyi-ui/src/views/system/role/index.vue index e43ffbc2e..2cc1a9399 100644 --- a/ruoyi-ui/src/views/system/role/index.vue +++ b/ruoyi-ui/src/views/system/role/index.vue @@ -568,7 +568,7 @@ export default { }).then(function() { return exportRole(queryParams); }).then(response => { - this.download(response.msg); + this.downloadExcel(response, '角色数据.xls'); }) } } diff --git a/src/main/java/cn/iocoder/dashboard/framework/excel/Excel.java b/src/main/java/cn/iocoder/dashboard/framework/excel/Excel.java deleted file mode 100644 index 490a01b74..000000000 --- a/src/main/java/cn/iocoder/dashboard/framework/excel/Excel.java +++ /dev/null @@ -1,157 +0,0 @@ -package cn.iocoder.dashboard.framework.excel; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; -import java.math.BigDecimal; - -/** - * 自定义导出Excel数据注解 - * - * @author ruoyi - */ -@Deprecated -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.FIELD) -public @interface Excel { - - /** - * 导出时在excel中排序 - */ - int sort() default Integer.MAX_VALUE; - - /** - * 导出到Excel中的名字. - */ - String name() default ""; - - /** - * 日期格式, 如: yyyy-MM-dd - */ - String dateFormat() default ""; - - /** - * 如果是字典类型,请设置字典的type值 (如: sys_user_sex) - */ - String dictType() 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; - - /** - * 导出类型(0数字 1字符串) - */ - public ColumnType cellType() default ColumnType.STRING; - - /** - * 导出时在excel中每个列的高度 单位为字符 - */ - public double height() default 14; - - /** - * 导出时在excel中每个列的宽 单位为字符 - */ - public double width() default 16; - - /** - * 文字后缀,如% 90 变成90% - */ - String suffix() default ""; - - /** - * 当值为空时,字段的默认值 - */ - String defaultValue() default ""; - - /** - * 提示信息 - */ - String prompt() default ""; - - /** - * 设置只能选择不能输入的列内容. - */ - String[] combo() default {}; - - /** - * 是否导出数据,应对需求:有时我们需要导出一份模板,这是标题需要但内容需要用户手工填写. - */ - boolean isExport() default true; - - /** - * 另一个类中的属性名称,支持多级获取,以小数点隔开 - */ - String targetAttr() default ""; - - /** - * 是否自动统计数据,在最后追加一行统计数据总和 - */ - boolean isStatistics() default false; - - /** - * 导出字段对齐方式(0:默认;1:靠左;2:居中;3:靠右) - */ - Align align() default Align.AUTO; - - enum Align { - AUTO(0), LEFT(1), CENTER(2), RIGHT(3); - private final int value; - - Align(int value) { - this.value = value; - } - - public int value() { - return this.value; - } - } - - /** - * 字段类型(0:导出导入;1:仅导出;2:仅导入) - */ - Type type() default Type.ALL; - - enum Type { - ALL(0), EXPORT(1), IMPORT(2); - private final int value; - - Type(int value) { - this.value = value; - } - - public int value() { - return this.value; - } - } - - enum ColumnType { - NUMERIC(0), STRING(1), IMAGE(2); - private final int value; - - ColumnType(int value) { - this.value = value; - } - - public int value() { - return this.value; - } - } -} diff --git a/src/main/java/cn/iocoder/dashboard/framework/excel/Excels.java b/src/main/java/cn/iocoder/dashboard/framework/excel/Excels.java deleted file mode 100644 index ad767b596..000000000 --- a/src/main/java/cn/iocoder/dashboard/framework/excel/Excels.java +++ /dev/null @@ -1,19 +0,0 @@ -package cn.iocoder.dashboard.framework.excel; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Excel注解集 - * - * @author ruoyi - */ -@Deprecated -@Target(ElementType.FIELD) -@Retention(RetentionPolicy.RUNTIME) -public @interface Excels -{ - Excel[] value(); -} diff --git a/src/main/java/cn/iocoder/dashboard/framework/excel/core/util/ExcelUtils.java b/src/main/java/cn/iocoder/dashboard/framework/excel/core/util/ExcelUtils.java index d79e82013..34a84c28f 100644 --- a/src/main/java/cn/iocoder/dashboard/framework/excel/core/util/ExcelUtils.java +++ b/src/main/java/cn/iocoder/dashboard/framework/excel/core/util/ExcelUtils.java @@ -10,18 +10,32 @@ import java.util.List; /** * Excel 工具类 + * + * @author 芋道源码 */ public class ExcelUtils { - public static void write(HttpServletResponse response, String filename, String sheetName, - Class head, List data) throws IOException { - // 设置 header 和 contentType - response.addHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(filename, "UTF-8")); - response.setContentType("application/vnd.ms-excel;charset=UTF-8"); + /** + * 将列表以 Excel 响应给前端 + * + * @param response 响应 + * @param filename 文件名 + * @param sheetName Excel sheet 名 + * @param head Excel head 头 + * @param data 数据列表哦 + * @param 泛型,保证 head 和 data 类型的一致性 + * @throws IOException 写入失败的情况 + */ + public static void write(HttpServletResponse response, String filename, String sheetName, + Class head, List data) throws IOException { // 输出 Excel EasyExcel.write(response.getOutputStream(), head) + .autoCloseStream(false) // 不要自动关闭,交给 Servlet 自己处理 .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) // 基于 column 长度,自动适配。最大 255 宽度 .sheet(sheetName).doWrite(data); + // 设置 header 和 contentType。写在最后的原因是,避免报错时,响应 contentType 已经被修改了 + response.addHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(filename, "UTF-8")); + response.setContentType("application/vnd.ms-excel;charset=UTF-8"); } } diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/dept/SysPostController.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/dept/SysPostController.java index 2b16c08e3..f8043ffa1 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/controller/dept/SysPostController.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/controller/dept/SysPostController.java @@ -89,10 +89,10 @@ public class SysPostController { // @PreAuthorize("@ss.hasPermi('system:post:export')") public void export(HttpServletResponse response, @Validated SysPostExportReqVO reqVO) throws IOException { List posts = postService.listPosts(reqVO); - List excelPosts = SysPostConvert.INSTANCE.convertList03(posts); + List excelDataList = SysPostConvert.INSTANCE.convertList03(posts); // 输出 ExcelUtils.write(response, "岗位数据.xls", "岗位列表", - SysPostExcelVO.class, excelPosts); + SysPostExcelVO.class, excelDataList); } } diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/dept/vo/post/SysPostExcelVO.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/dept/vo/post/SysPostExcelVO.java index eec19cb94..7ebbd9f93 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/controller/dept/vo/post/SysPostExcelVO.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/controller/dept/vo/post/SysPostExcelVO.java @@ -1,12 +1,8 @@ package cn.iocoder.dashboard.modules.system.controller.dept.vo.post; -import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat; -import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert; import com.alibaba.excel.annotation.ExcelProperty; import lombok.Data; -import static cn.iocoder.dashboard.modules.system.enums.dict.DictTypeEnum.SYS_COMMON_STATUS; - /** * 岗位 Excel 导出响应 VO */ @@ -25,8 +21,9 @@ public class SysPostExcelVO { @ExcelProperty("岗位排序") private String sort; - @ExcelProperty(value = "状态", converter = DictConvert.class) - @DictFormat(SYS_COMMON_STATUS) +// @ExcelProperty(value = "状态", converter = DictConvert.class) +// @DictFormat(SYS_COMMON_STATUS) + @ExcelProperty(value = "状态") private String status; } diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/dict/SysDictDataController.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/dict/SysDictDataController.java index a7c8b9a29..363dac106 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/controller/dict/SysDictDataController.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/controller/dict/SysDictDataController.java @@ -2,6 +2,7 @@ package cn.iocoder.dashboard.modules.system.controller.dict; import cn.iocoder.dashboard.common.pojo.CommonResult; import cn.iocoder.dashboard.common.pojo.PageResult; +import cn.iocoder.dashboard.framework.excel.core.util.ExcelUtils; import cn.iocoder.dashboard.modules.system.controller.dict.vo.data.*; import cn.iocoder.dashboard.modules.system.convert.dict.SysDictDataConvert; import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.dict.SysDictDataDO; @@ -13,6 +14,8 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; import java.util.List; import static cn.iocoder.dashboard.common.pojo.CommonResult.success; @@ -25,8 +28,8 @@ public class SysDictDataController { @Resource private SysDictDataService dictDataService; - @GetMapping("/list-all-simple") @ApiOperation(value = "获得全部字典数据列表", notes = "一般用于管理后台缓存字典数据在本地") + @GetMapping("/list-all-simple") // 无需添加权限认证,因为前端全局都需要 public CommonResult> listSimpleDictDatas() { List list = dictDataService.listDictDatas(); @@ -75,14 +78,16 @@ public class SysDictDataController { return success(true); } - + @ApiOperation("导出字典数据") + @GetMapping("/export") // @Log(title = "字典类型", businessType = BusinessType.EXPORT) // @PreAuthorize("@ss.hasPermi('system:dict:export')") -// @GetMapping("/export") -// public AjaxResult export(SysDictType dictType) { -// List list = dictTypeService.selectDictTypeList(dictType); -// ExcelUtil util = new ExcelUtil(SysDictType.class); -// return util.exportExcel(list, "字典类型"); -// } + public void export(HttpServletResponse response, @Validated SysDictDataExportReqVO reqVO) throws IOException { + List list = dictDataService.listDictDatas(reqVO); + List excelDataList = SysDictDataConvert.INSTANCE.convertList02(list); + // 输出 + ExcelUtils.write(response, "字典数据.xls", "数据列表", + SysDictDataExcelVO.class, excelDataList); + } } diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/dict/SysDictTypeController.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/dict/SysDictTypeController.java index 88b5deab4..df9fd6b87 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/controller/dict/SysDictTypeController.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/controller/dict/SysDictTypeController.java @@ -2,6 +2,7 @@ package cn.iocoder.dashboard.modules.system.controller.dict; import cn.iocoder.dashboard.common.pojo.CommonResult; import cn.iocoder.dashboard.common.pojo.PageResult; +import cn.iocoder.dashboard.framework.excel.core.util.ExcelUtils; import cn.iocoder.dashboard.modules.system.controller.dict.vo.type.*; import cn.iocoder.dashboard.modules.system.convert.dict.SysDictTypeConvert; import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.dict.SysDictTypeDO; @@ -13,6 +14,8 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; import java.util.List; import static cn.iocoder.dashboard.common.pojo.CommonResult.success; @@ -76,14 +79,16 @@ public class SysDictTypeController { return success(SysDictTypeConvert.INSTANCE.convertList(list)); } - // + @ApiOperation("导出数据类型") + @GetMapping("/export") // @Log(title = "字典类型", businessType = BusinessType.EXPORT) // @PreAuthorize("@ss.hasPermi('system:dict:export')") -// @GetMapping("/export") -// public AjaxResult export(SysDictType dictType) { -// List list = dictTypeService.selectDictTypeList(dictType); -// ExcelUtil util = new ExcelUtil(SysDictType.class); -// return util.exportExcel(list, "字典类型"); -// } + public void export(HttpServletResponse response, @Validated SysDictTypeExportReqVO reqVO) throws IOException { + List list = dictTypeService.listDictTypes(reqVO); + List excelTypeList = SysDictTypeConvert.INSTANCE.convertList02(list); + // 输出 + ExcelUtils.write(response, "字典类型.xls", "类型列表", + SysDictTypeExcelVO.class, excelTypeList); + } } diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/dict/vo/data/SysDictDataExportReqVO.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/dict/vo/data/SysDictDataExportReqVO.java new file mode 100644 index 000000000..f05c12407 --- /dev/null +++ b/src/main/java/cn/iocoder/dashboard/modules/system/controller/dict/vo/data/SysDictDataExportReqVO.java @@ -0,0 +1,24 @@ +package cn.iocoder.dashboard.modules.system.controller.dict.vo.data; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.Size; + +@ApiModel("字典类型导出 Request VO") +@Data +public class SysDictDataExportReqVO { + + @ApiModelProperty(value = "字典标签", example = "芋道") + @Size(max = 100, message = "字典标签长度不能超过100个字符") + private String label; + + @ApiModelProperty(value = "字典类型", example = "sys_common_sex", notes = "模糊匹配") + @Size(max = 100, message = "字典类型类型长度不能超过100个字符") + private String dictType; + + @ApiModelProperty(value = "展示状态", example = "1", notes = "参见 SysCommonStatusEnum 枚举类") + private Integer status; + +} diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/dict/vo/type/SysDictTypeExportReqVO.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/dict/vo/type/SysDictTypeExportReqVO.java new file mode 100644 index 000000000..66b429f6a --- /dev/null +++ b/src/main/java/cn/iocoder/dashboard/modules/system/controller/dict/vo/type/SysDictTypeExportReqVO.java @@ -0,0 +1,35 @@ +package cn.iocoder.dashboard.modules.system.controller.dict.vo.type; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import javax.validation.constraints.Size; +import java.util.Date; + +import static cn.iocoder.dashboard.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@ApiModel("字典类型分页列表 Request VO") +@Data +public class SysDictTypeExportReqVO { + + @ApiModelProperty(value = "字典类型名称", example = "芋道", notes = "模糊匹配") + private String name; + + @ApiModelProperty(value = "字典类型", example = "sys_common_sex", notes = "模糊匹配") + @Size(max = 100, message = "字典类型类型长度不能超过100个字符") + private String type; + + @ApiModelProperty(value = "展示状态", example = "1", notes = "参见 SysCommonStatusEnum 枚举类") + private Integer status; + + @ApiModelProperty(value = "开始时间", example = "2020-10-24") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private Date beginTime; + + @ApiModelProperty(value = "结束时间", example = "2020-10-24") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private Date endTime; + +} diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/dict/vo/type/SysDictTypePageReqVO.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/dict/vo/type/SysDictTypePageReqVO.java index c91031a4b..29437aa9c 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/controller/dict/vo/type/SysDictTypePageReqVO.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/controller/dict/vo/type/SysDictTypePageReqVO.java @@ -4,6 +4,7 @@ import cn.iocoder.dashboard.common.pojo.PageParam; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import lombok.EqualsAndHashCode; import org.springframework.format.annotation.DateTimeFormat; import javax.validation.constraints.Size; @@ -13,6 +14,7 @@ import static cn.iocoder.dashboard.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOU @ApiModel("字典类型分页列表 Request VO") @Data +@EqualsAndHashCode(callSuper = true) public class SysDictTypePageReqVO extends PageParam { @ApiModelProperty(value = "字典类型名称", example = "芋道", notes = "模糊匹配") diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/permission/SysRoleController.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/permission/SysRoleController.java index 358dc798b..2e0d9df52 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/controller/permission/SysRoleController.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/controller/permission/SysRoleController.java @@ -3,6 +3,7 @@ package cn.iocoder.dashboard.modules.system.controller.permission; import cn.iocoder.dashboard.common.enums.CommonStatusEnum; import cn.iocoder.dashboard.common.pojo.CommonResult; import cn.iocoder.dashboard.common.pojo.PageResult; +import cn.iocoder.dashboard.framework.excel.core.util.ExcelUtils; import cn.iocoder.dashboard.modules.system.controller.permission.vo.role.*; import cn.iocoder.dashboard.modules.system.convert.permission.SysRoleConvert; import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.permission.SysRoleDO; @@ -14,6 +15,8 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; import java.util.Collections; import java.util.Comparator; import java.util.List; @@ -80,16 +83,6 @@ public class SysRoleController { return success(SysRoleConvert.INSTANCE.convert(role)); } -// @Log(title = "角色管理", businessType = BusinessType.EXPORT) -// @PreAuthorize("@ss.hasPermi('system:role:export')") -// @GetMapping("/export") -// public AjaxResult export(SysRole role) -// { -// List list = roleService.selectRoleList(role); -// ExcelUtil util = new ExcelUtil(SysRole.class); -// return util.exportExcel(list, "角色数据"); -// } - @ApiOperation("修改角色状态") @PostMapping("/update-status") // @PreAuthorize("@ss.hasPermi('system:role:edit')") @@ -99,4 +92,15 @@ public class SysRoleController { return success(true); } + @GetMapping("/export") +// @Log(title = "角色管理", businessType = BusinessType.EXPORT) +// @PreAuthorize("@ss.hasPermi('system:role:export')") + public void export(HttpServletResponse response, @Validated SysRoleExportReqVO reqVO) throws IOException { + List list = roleService.listRoles(reqVO); + List excelDataList = SysRoleConvert.INSTANCE.convertList03(list); + // 输出 + ExcelUtils.write(response, "角色数据.xls", "角色列表", + SysRoleExcelVO.class, excelDataList); + } + } diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/permission/vo/role/SysRoleExcelRespVO.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/permission/vo/role/SysRoleExcelRespVO.java deleted file mode 100644 index 3913b3788..000000000 --- a/src/main/java/cn/iocoder/dashboard/modules/system/controller/permission/vo/role/SysRoleExcelRespVO.java +++ /dev/null @@ -1,30 +0,0 @@ -package cn.iocoder.dashboard.modules.system.controller.permission.vo.role; - -import cn.iocoder.dashboard.framework.excel.Excel; -import lombok.Data; - -/** - * 角色 Excel 导出响应 VO - */ -@Data -public class SysRoleExcelRespVO { - - @Excel(name = "角色序号", cellType = Excel.ColumnType.NUMERIC) - private Long id; - - @Excel(name = "角色名称") - private String name; - - @Excel(name = "角色标志") - private String code; - - @Excel(name = "角色排序") - private Integer sort; - - @Excel(name = "数据范围", readConverterExp = "1=所有数据权限,2=自定义数据权限,3=本部门数据权限,4=本部门及以下数据权限") - private Integer dataScope; - - @Excel(name = "角色状态", readConverterExp = "0=正常,1=停用") - private String status; - -} diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/permission/vo/role/SysRoleExcelVO.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/permission/vo/role/SysRoleExcelVO.java new file mode 100644 index 000000000..3b4473d77 --- /dev/null +++ b/src/main/java/cn/iocoder/dashboard/modules/system/controller/permission/vo/role/SysRoleExcelVO.java @@ -0,0 +1,34 @@ +package cn.iocoder.dashboard.modules.system.controller.permission.vo.role; + +import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat; +import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert; +import cn.iocoder.dashboard.modules.system.enums.dict.DictTypeEnum; +import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Data; + +/** + * 角色 Excel 导出响应 VO + */ +@Data +public class SysRoleExcelVO { + + @ExcelProperty("角色序号") + private Long id; + + @ExcelProperty("角色名称") + private String name; + + @ExcelProperty("角色标志") + private String code; + + @ExcelProperty("角色排序") + private Integer sort; + + @ExcelProperty("数据范围") + private Integer dataScope; + + @ExcelProperty(value = "角色状态", converter = DictConvert.class) + @DictFormat(DictTypeEnum.SYS_COMMON_STATUS) + private String status; + +} diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/permission/vo/role/SysRoleExportReqVO.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/permission/vo/role/SysRoleExportReqVO.java new file mode 100644 index 000000000..129fd103d --- /dev/null +++ b/src/main/java/cn/iocoder/dashboard/modules/system/controller/permission/vo/role/SysRoleExportReqVO.java @@ -0,0 +1,34 @@ +package cn.iocoder.dashboard.modules.system.controller.permission.vo.role; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; + +import static cn.iocoder.dashboard.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@ApiModel("角色分页 Request VO") +@Data +public class SysRoleExportReqVO { + + @ApiModelProperty(value = "角色名称", example = "芋道", notes = "模糊匹配") + private String name; + + @ApiModelProperty(value = "角色标识", example = "yudao", notes = "模糊匹配") + private String code; + + @ApiModelProperty(value = "展示状态", example = "1", notes = "参见 SysCommonStatusEnum 枚举类") + private Integer status; + + @ApiModelProperty(value = "开始时间", example = "2020-10-24") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private Date beginTime; + + @ApiModelProperty(value = "结束时间", example = "2020-10-24") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private Date endTime; + +} diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/user/vo/user/SysUserExcelRespBackVO.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/user/vo/user/SysUserExcelRespBackVO.java deleted file mode 100644 index 0c97d2fc2..000000000 --- a/src/main/java/cn/iocoder/dashboard/modules/system/controller/user/vo/user/SysUserExcelRespBackVO.java +++ /dev/null @@ -1,52 +0,0 @@ -package cn.iocoder.dashboard.modules.system.controller.user.vo.user; - -import cn.iocoder.dashboard.framework.excel.Excel; -import cn.iocoder.dashboard.framework.excel.Excels; -import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.dept.SysDeptDO; -import lombok.Data; - -import java.util.Date; - -/** - * 用户 Excel 导出响应 VO - */ -@Data -public class SysUserExcelRespBackVO { - - @Excel(name = "用户序号", cellType = Excel.ColumnType.NUMERIC, prompt = "用户编号") - private Long id; - - @Excel(name = "登录名称") - private String username; - - @Excel(name = "用户名称") - private String nickname; - - @Excel(name = "部门编号", type = Excel.Type.IMPORT) - private Long deptId; - - @Excel(name = "用户邮箱") - private String email; - - @Excel(name = "手机号码") - private String mobile; - - @Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知") - private String sex; - - @Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用") - private Integer status; - - @Excel(name = "最后登录IP", type = Excel.Type.EXPORT) - private String loginIp; - - @Excel(name = "最后登录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Excel.Type.EXPORT) - private Date loginDate; - - @Excels({ - @Excel(name = "部门名称", targetAttr = "deptName", type = Excel.Type.EXPORT), - @Excel(name = "部门负责人", targetAttr = "leader", type = Excel.Type.EXPORT) - }) - private SysDeptDO dept; - -} diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/user/vo/user/SysUserImportExcelVO.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/user/vo/user/SysUserImportExcelVO.java new file mode 100644 index 000000000..a90ad49e6 --- /dev/null +++ b/src/main/java/cn/iocoder/dashboard/modules/system/controller/user/vo/user/SysUserImportExcelVO.java @@ -0,0 +1,38 @@ +package cn.iocoder.dashboard.modules.system.controller.user.vo.user; + +import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat; +import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert; +import cn.iocoder.dashboard.modules.system.enums.dict.DictTypeEnum; +import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Data; + +/** + * 用户 Excel 导入 VO + */ +@Data +public class SysUserImportExcelVO { + + @ExcelProperty("登录名称") + private String username; + + @ExcelProperty("用户名称") + private String nickname; + + @ExcelProperty("部门编号") + private Long deptId; + + @ExcelProperty("用户邮箱") + private String email; + + @ExcelProperty("手机号码") + private String mobile; + + @ExcelProperty(value = "用户性别", converter = DictConvert.class) + @DictFormat(DictTypeEnum.SYS_USER_SEX) + private String sex; + + @ExcelProperty(value = "账号状态", converter = DictConvert.class) + @DictFormat(DictTypeEnum.SYS_COMMON_STATUS) + private Integer status; + +} diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/convert/dict/SysDictDataConvert.java b/src/main/java/cn/iocoder/dashboard/modules/system/convert/dict/SysDictDataConvert.java index fe9cc38fe..e10abcb7b 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/convert/dict/SysDictDataConvert.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/convert/dict/SysDictDataConvert.java @@ -1,10 +1,7 @@ package cn.iocoder.dashboard.modules.system.convert.dict; import cn.iocoder.dashboard.common.pojo.PageResult; -import cn.iocoder.dashboard.modules.system.controller.dict.vo.data.SysDictDataCreateReqVO; -import cn.iocoder.dashboard.modules.system.controller.dict.vo.data.SysDictDataRespVO; -import cn.iocoder.dashboard.modules.system.controller.dict.vo.data.SysDictDataSimpleVO; -import cn.iocoder.dashboard.modules.system.controller.dict.vo.data.SysDictDataUpdateReqVO; +import cn.iocoder.dashboard.modules.system.controller.dict.vo.data.*; import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.dict.SysDictDataDO; import com.baomidou.mybatisplus.core.metadata.IPage; import org.mapstruct.Mapper; @@ -31,4 +28,6 @@ public interface SysDictDataConvert { @Mapping(source = "records", target = "list") PageResult convertPage02(IPage page); + List convertList02(List bean); + } diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/convert/dict/SysDictTypeConvert.java b/src/main/java/cn/iocoder/dashboard/modules/system/convert/dict/SysDictTypeConvert.java index 03bc41ba4..b4fa65aee 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/convert/dict/SysDictTypeConvert.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/convert/dict/SysDictTypeConvert.java @@ -1,10 +1,7 @@ package cn.iocoder.dashboard.modules.system.convert.dict; import cn.iocoder.dashboard.common.pojo.PageResult; -import cn.iocoder.dashboard.modules.system.controller.dict.vo.type.SysDictTypeCreateReqVO; -import cn.iocoder.dashboard.modules.system.controller.dict.vo.type.SysDictTypeRespVO; -import cn.iocoder.dashboard.modules.system.controller.dict.vo.type.SysDictTypeSimpleRespVO; -import cn.iocoder.dashboard.modules.system.controller.dict.vo.type.SysDictTypeUpdateReqVO; +import cn.iocoder.dashboard.modules.system.controller.dict.vo.type.*; import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.dict.SysDictTypeDO; import com.baomidou.mybatisplus.core.metadata.IPage; import org.mapstruct.Mapper; @@ -31,4 +28,6 @@ public interface SysDictTypeConvert { List convertList(List list); + List convertList02(List list); + } diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/convert/permission/SysRoleConvert.java b/src/main/java/cn/iocoder/dashboard/modules/system/convert/permission/SysRoleConvert.java index ced4660e1..3d7bf6092 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/convert/permission/SysRoleConvert.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/convert/permission/SysRoleConvert.java @@ -1,10 +1,7 @@ package cn.iocoder.dashboard.modules.system.convert.permission; import cn.iocoder.dashboard.common.pojo.PageResult; -import cn.iocoder.dashboard.modules.system.controller.permission.vo.role.SysRoleCreateReqVO; -import cn.iocoder.dashboard.modules.system.controller.permission.vo.role.SysRoleRespVO; -import cn.iocoder.dashboard.modules.system.controller.permission.vo.role.SysRoleSimpleRespVO; -import cn.iocoder.dashboard.modules.system.controller.permission.vo.role.SysRoleUpdateReqVO; +import cn.iocoder.dashboard.modules.system.controller.permission.vo.role.*; import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.permission.SysRoleDO; import com.baomidou.mybatisplus.core.metadata.IPage; import org.mapstruct.Mapper; @@ -29,4 +26,6 @@ public interface SysRoleConvert { List convertList02(List list); + List convertList03(List list); + } diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/dal/mysql/dao/dict/SysDictDataMapper.java b/src/main/java/cn/iocoder/dashboard/modules/system/dal/mysql/dao/dict/SysDictDataMapper.java index c18023bc4..cc6fee182 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/dal/mysql/dao/dict/SysDictDataMapper.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/dal/mysql/dao/dict/SysDictDataMapper.java @@ -2,6 +2,7 @@ package cn.iocoder.dashboard.modules.system.dal.mysql.dao.dict; import cn.iocoder.dashboard.framework.mybatis.core.query.QueryWrapperX; import cn.iocoder.dashboard.framework.mybatis.core.util.MyBatisUtils; +import cn.iocoder.dashboard.modules.system.controller.dict.vo.data.SysDictDataExportReqVO; import cn.iocoder.dashboard.modules.system.controller.dict.vo.data.SysDictDataPageReqVO; import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.dict.SysDictDataDO; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @@ -36,4 +37,9 @@ public interface SysDictDataMapper extends BaseMapper { return selectList(new QueryWrapper<>()); } + default List selectList(SysDictDataExportReqVO reqVO) { + return selectList(new QueryWrapperX().likeIfPresent("label", reqVO.getLabel()) + .likeIfPresent("dict_type", reqVO.getDictType()) + .eqIfPresent("status", reqVO.getStatus())); + } } diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/dal/mysql/dao/dict/SysDictTypeMapper.java b/src/main/java/cn/iocoder/dashboard/modules/system/dal/mysql/dao/dict/SysDictTypeMapper.java index f9aa104ce..0c17ea5d3 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/dal/mysql/dao/dict/SysDictTypeMapper.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/dal/mysql/dao/dict/SysDictTypeMapper.java @@ -2,6 +2,7 @@ package cn.iocoder.dashboard.modules.system.dal.mysql.dao.dict; import cn.iocoder.dashboard.framework.mybatis.core.query.QueryWrapperX; import cn.iocoder.dashboard.framework.mybatis.core.util.MyBatisUtils; +import cn.iocoder.dashboard.modules.system.controller.dict.vo.type.SysDictTypeExportReqVO; import cn.iocoder.dashboard.modules.system.controller.dict.vo.type.SysDictTypePageReqVO; import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.dict.SysDictTypeDO; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @@ -22,6 +23,13 @@ public interface SysDictTypeMapper extends BaseMapper { .betweenIfPresent("create_time", reqVO.getBeginTime(), reqVO.getEndTime())); } + default List selectList(SysDictTypeExportReqVO reqVO) { + return selectList(new QueryWrapperX().likeIfPresent("name", reqVO.getName()) + .likeIfPresent("dict_type", reqVO.getType()) + .eqIfPresent("status", reqVO.getStatus()) + .betweenIfPresent("create_time", reqVO.getBeginTime(), reqVO.getEndTime())); + } + default SysDictTypeDO selectByType(String type) { return selectOne(new QueryWrapperX().eq("dict_type", type)); } diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/dal/mysql/dao/permission/SysRoleMapper.java b/src/main/java/cn/iocoder/dashboard/modules/system/dal/mysql/dao/permission/SysRoleMapper.java index eb03f1e18..615fc44ea 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/dal/mysql/dao/permission/SysRoleMapper.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/dal/mysql/dao/permission/SysRoleMapper.java @@ -2,6 +2,7 @@ package cn.iocoder.dashboard.modules.system.dal.mysql.dao.permission; import cn.iocoder.dashboard.framework.mybatis.core.query.QueryWrapperX; import cn.iocoder.dashboard.framework.mybatis.core.util.MyBatisUtils; +import cn.iocoder.dashboard.modules.system.controller.permission.vo.role.SysRoleExportReqVO; import cn.iocoder.dashboard.modules.system.controller.permission.vo.role.SysRolePageReqVO; import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.permission.SysRoleDO; import com.baomidou.mybatisplus.core.mapper.BaseMapper; @@ -18,9 +19,16 @@ public interface SysRoleMapper extends BaseMapper { default IPage selectPage(SysRolePageReqVO reqVO) { return selectPage(MyBatisUtils.buildPage(reqVO), new QueryWrapperX().likeIfPresent("name", reqVO.getName()) - .likeIfPresent("code", reqVO.getCode()) - .eqIfPresent("status", reqVO.getStatus()) - .betweenIfPresent("create_time", reqVO.getBeginTime(), reqVO.getEndTime())); + .likeIfPresent("code", reqVO.getCode()) + .eqIfPresent("status", reqVO.getStatus()) + .betweenIfPresent("create_time", reqVO.getBeginTime(), reqVO.getEndTime())); + } + + default List listRoles(SysRoleExportReqVO reqVO) { + return selectList(new QueryWrapperX().likeIfPresent("name", reqVO.getName()) + .likeIfPresent("code", reqVO.getCode()) + .eqIfPresent("status", reqVO.getStatus()) + .betweenIfPresent("create_time", reqVO.getBeginTime(), reqVO.getEndTime())); } default SysRoleDO selectByName(String name) { @@ -34,4 +42,5 @@ public interface SysRoleMapper extends BaseMapper { default List selectListByStatus(@Nullable Collection statuses) { return selectList(new QueryWrapperX().in("status", statuses)); } + } diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/service/dict/SysDictDataService.java b/src/main/java/cn/iocoder/dashboard/modules/system/service/dict/SysDictDataService.java index 9606972c4..4b093beb3 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/service/dict/SysDictDataService.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/service/dict/SysDictDataService.java @@ -3,6 +3,7 @@ package cn.iocoder.dashboard.modules.system.service.dict; import cn.iocoder.dashboard.common.pojo.PageResult; import cn.iocoder.dashboard.framework.dict.core.service.DictDataFrameworkService; import cn.iocoder.dashboard.modules.system.controller.dict.vo.data.SysDictDataCreateReqVO; +import cn.iocoder.dashboard.modules.system.controller.dict.vo.data.SysDictDataExportReqVO; import cn.iocoder.dashboard.modules.system.controller.dict.vo.data.SysDictDataPageReqVO; import cn.iocoder.dashboard.modules.system.controller.dict.vo.data.SysDictDataUpdateReqVO; import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.dict.SysDictDataDO; @@ -36,6 +37,14 @@ public interface SysDictDataService extends DictDataFrameworkService { */ PageResult pageDictDatas(SysDictDataPageReqVO reqVO); + /** + * 获得字典数据列表 + * + * @param reqVO 列表请求 + * @return 字典数据列表 + */ + List listDictDatas(SysDictDataExportReqVO reqVO); + /** * 获得字典数据详情 * diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/service/dict/SysDictTypeService.java b/src/main/java/cn/iocoder/dashboard/modules/system/service/dict/SysDictTypeService.java index 3a1e46f9f..b8f4f4bcf 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/service/dict/SysDictTypeService.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/service/dict/SysDictTypeService.java @@ -2,6 +2,7 @@ package cn.iocoder.dashboard.modules.system.service.dict; import cn.iocoder.dashboard.common.pojo.PageResult; import cn.iocoder.dashboard.modules.system.controller.dict.vo.type.SysDictTypeCreateReqVO; +import cn.iocoder.dashboard.modules.system.controller.dict.vo.type.SysDictTypeExportReqVO; import cn.iocoder.dashboard.modules.system.controller.dict.vo.type.SysDictTypePageReqVO; import cn.iocoder.dashboard.modules.system.controller.dict.vo.type.SysDictTypeUpdateReqVO; import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.dict.SysDictTypeDO; @@ -23,6 +24,14 @@ public interface SysDictTypeService { */ PageResult pageDictTypes(SysDictTypePageReqVO reqVO); + /** + * 获得字典类型列表 + * + * @param reqVO 列表请求 + * @return 字典类型列表 + */ + List listDictTypes(SysDictTypeExportReqVO reqVO); + /** * 获得字典类型详情 * diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/service/dict/impl/SysDictDataServiceImpl.java b/src/main/java/cn/iocoder/dashboard/modules/system/service/dict/impl/SysDictDataServiceImpl.java index 3321c0e92..6e5bcfbf9 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/service/dict/impl/SysDictDataServiceImpl.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/service/dict/impl/SysDictDataServiceImpl.java @@ -4,6 +4,7 @@ import cn.iocoder.dashboard.common.enums.CommonStatusEnum; import cn.iocoder.dashboard.common.exception.util.ServiceExceptionUtil; import cn.iocoder.dashboard.common.pojo.PageResult; import cn.iocoder.dashboard.modules.system.controller.dict.vo.data.SysDictDataCreateReqVO; +import cn.iocoder.dashboard.modules.system.controller.dict.vo.data.SysDictDataExportReqVO; import cn.iocoder.dashboard.modules.system.controller.dict.vo.data.SysDictDataPageReqVO; import cn.iocoder.dashboard.modules.system.controller.dict.vo.data.SysDictDataUpdateReqVO; import cn.iocoder.dashboard.modules.system.convert.dict.SysDictDataConvert; @@ -84,6 +85,13 @@ public class SysDictDataServiceImpl implements SysDictDataService { return SysDictDataConvert.INSTANCE.convertPage02(dictDataMapper.selectList(reqVO)); } + @Override + public List listDictDatas(SysDictDataExportReqVO reqVO) { + List list = dictDataMapper.selectList(reqVO); + list.sort(COMPARATOR_TYPE_AND_SORT); + return list; + } + @Override public SysDictDataDO getDictData(Long id) { return dictDataMapper.selectById(id); diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/service/dict/impl/SysDictTypeServiceImpl.java b/src/main/java/cn/iocoder/dashboard/modules/system/service/dict/impl/SysDictTypeServiceImpl.java index 7738b16d1..bb0416b07 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/service/dict/impl/SysDictTypeServiceImpl.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/service/dict/impl/SysDictTypeServiceImpl.java @@ -3,6 +3,7 @@ package cn.iocoder.dashboard.modules.system.service.dict.impl; import cn.iocoder.dashboard.common.exception.util.ServiceExceptionUtil; import cn.iocoder.dashboard.common.pojo.PageResult; import cn.iocoder.dashboard.modules.system.controller.dict.vo.type.SysDictTypeCreateReqVO; +import cn.iocoder.dashboard.modules.system.controller.dict.vo.type.SysDictTypeExportReqVO; import cn.iocoder.dashboard.modules.system.controller.dict.vo.type.SysDictTypePageReqVO; import cn.iocoder.dashboard.modules.system.controller.dict.vo.type.SysDictTypeUpdateReqVO; import cn.iocoder.dashboard.modules.system.convert.dict.SysDictTypeConvert; @@ -40,6 +41,11 @@ public class SysDictTypeServiceImpl implements SysDictTypeService { return SysDictTypeConvert.INSTANCE.convertPage02(dictTypeMapper.selectList(reqVO)); } + @Override + public List listDictTypes(SysDictTypeExportReqVO reqVO) { + return dictTypeMapper.selectList(reqVO); + } + @Override public SysDictTypeDO getDictType(Long id) { return dictTypeMapper.selectById(id); diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/service/permission/SysRoleService.java b/src/main/java/cn/iocoder/dashboard/modules/system/service/permission/SysRoleService.java index ba9b98c17..41a9d39ef 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/service/permission/SysRoleService.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/service/permission/SysRoleService.java @@ -2,6 +2,7 @@ package cn.iocoder.dashboard.modules.system.service.permission; import cn.iocoder.dashboard.common.pojo.PageResult; import cn.iocoder.dashboard.modules.system.controller.permission.vo.role.SysRoleCreateReqVO; +import cn.iocoder.dashboard.modules.system.controller.permission.vo.role.SysRoleExportReqVO; import cn.iocoder.dashboard.modules.system.controller.permission.vo.role.SysRolePageReqVO; import cn.iocoder.dashboard.modules.system.controller.permission.vo.role.SysRoleUpdateReqVO; import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.permission.SysRoleDO; @@ -93,6 +94,14 @@ public interface SysRoleService { */ PageResult pageRole(SysRolePageReqVO reqVO); + /** + * 获得角色列表 + * + * @param reqVO 列表查询 + * @return 角色列表 + */ + List listRoles(SysRoleExportReqVO reqVO); + /** * 更新角色状态 * diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/service/permission/impl/SysRoleServiceImpl.java b/src/main/java/cn/iocoder/dashboard/modules/system/service/permission/impl/SysRoleServiceImpl.java index add6281c8..f332d56fa 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/service/permission/impl/SysRoleServiceImpl.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/service/permission/impl/SysRoleServiceImpl.java @@ -5,6 +5,7 @@ import cn.iocoder.dashboard.common.enums.CommonStatusEnum; import cn.iocoder.dashboard.common.exception.util.ServiceExceptionUtil; import cn.iocoder.dashboard.common.pojo.PageResult; import cn.iocoder.dashboard.modules.system.controller.permission.vo.role.SysRoleCreateReqVO; +import cn.iocoder.dashboard.modules.system.controller.permission.vo.role.SysRoleExportReqVO; import cn.iocoder.dashboard.modules.system.controller.permission.vo.role.SysRolePageReqVO; import cn.iocoder.dashboard.modules.system.controller.permission.vo.role.SysRoleUpdateReqVO; import cn.iocoder.dashboard.modules.system.convert.permission.SysRoleConvert; @@ -140,6 +141,11 @@ public class SysRoleServiceImpl implements SysRoleService { return SysRoleConvert.INSTANCE.convertPage(roleDOPage); } + @Override + public List listRoles(SysRoleExportReqVO reqVO) { + return roleMapper.listRoles(reqVO); + } + @Override public void updateRoleStatus(Long id, Integer status) { // 校验是否可以更新 diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/service/user/SysUserServiceImpl.java b/src/main/java/cn/iocoder/dashboard/modules/system/service/user/SysUserServiceImpl.java index 577222e89..ad1be16f3 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/service/user/SysUserServiceImpl.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/service/user/SysUserServiceImpl.java @@ -335,15 +335,4 @@ public class SysUserServiceImpl implements SysUserService { // return successMsg.toString(); // } -// /** -// * 根据条件分页查询用户列表 -// * -// * @param user 用户信息 -// * @return 用户信息集合信息 -// */ -// @Override -// @DataScope(deptAlias = "d", userAlias = "u") -// public List selectUserList(SysUser user) { -// return userMapper.selectUserList(user); -// } }