diff --git a/src/main/java/cn/iocoder/dashboard/framework/logger/package-info.java b/src/main/java/cn/iocoder/dashboard/framework/logger/package-info.java new file mode 100644 index 000000000..2cba832b8 --- /dev/null +++ b/src/main/java/cn/iocoder/dashboard/framework/logger/package-info.java @@ -0,0 +1,10 @@ +/** + * 日志组件,包括: + * + * 1. 用户操作日志:记录用户的操作,用于对用户的操作的审计与追溯,永久保存。 + * 2. API 日志:包含两类 + * 2.1 API 访问日志:记录用户访问 API 的访问日志,定期归档历史日志。 + * 2.2 API 异常日志:记录用户访问 API 的系统异常,方便日常排查问题与告警。 + * 3. 通用 Logger 日志:将 {@link org.slf4j.Logger} 打印的日志,只满足大于等于 {@link org.slf4j.event.Level} 进行持久化,可以理解成简易的“日志中心”。 + */ +package cn.iocoder.dashboard.framework.logger; diff --git a/src/main/java/cn/iocoder/dashboard/modules/infra/package-info.java b/src/main/java/cn/iocoder/dashboard/modules/infra/package-info.java new file mode 100644 index 000000000..341d2bea3 --- /dev/null +++ b/src/main/java/cn/iocoder/dashboard/modules/infra/package-info.java @@ -0,0 +1,7 @@ +/** + * infra 包下,我们放基础设施的运维与管理,支撑上层的通用与核心业务。 + * 例如说:定时任务的管理、服务器的信息等等 + * + * 缩写:inf + */ +package cn.iocoder.dashboard.modules.infra; diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/common/SysFileController.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/common/SysFileController.java index cdba7828d..03edcefbc 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/controller/common/SysFileController.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/controller/common/SysFileController.java @@ -6,6 +6,9 @@ import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.common.SysFileDO import cn.iocoder.dashboard.modules.system.service.common.SysFileService; import cn.iocoder.dashboard.util.servlet.ServletUtils; import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.*; @@ -13,7 +16,6 @@ import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; - import java.io.IOException; import static cn.iocoder.dashboard.common.pojo.CommonResult.success; @@ -27,12 +29,19 @@ public class SysFileController { @Resource private SysFileService fileService; + @ApiOperation("上传文件") + @ApiImplicitParams({ + @ApiImplicitParam(name = "path", value = "文件附件", required = true, dataTypeClass = MultipartFile.class), + @ApiImplicitParam(name = "path", value = "文件路径", required = true, example = "yudaoyuanma.png", dataTypeClass = Long.class) + }) @PostMapping("/upload") public CommonResult uploadFile(@RequestParam("file") MultipartFile file, @RequestParam("path") String path) throws IOException { return success(fileService.createFile(path, IoUtil.readBytes(file.getInputStream()))); } + @ApiOperation("下载文件") + @ApiImplicitParam(name = "path", value = "文件附件", required = true, dataTypeClass = MultipartFile.class) @GetMapping("/get/{path}") public void getFile(HttpServletResponse response, @PathVariable("path") String path) throws IOException { SysFileDO file = fileService.getFile(path); diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/dept/SysDeptController.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/dept/SysDeptController.java index 0105e08c3..b5b9b7875 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/controller/dept/SysDeptController.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/controller/dept/SysDeptController.java @@ -48,7 +48,7 @@ public class SysDeptController { } @ApiOperation("获得部门信息") - @ApiImplicitParam(name = "id", value = "编号", readOnly = true, example = "1024", dataTypeClass = Long.class) + @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) // @PreAuthorize("@ss.hasPermi('system:dept:query')") @GetMapping("/get") public CommonResult getDept(@RequestParam("id") Long id) { @@ -74,7 +74,7 @@ public class SysDeptController { } @ApiOperation("删除部门") - @ApiImplicitParam(name = "id", value = "编号", readOnly = true, example = "1024", dataTypeClass = Long.class) + @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) @PostMapping("delete") // @PreAuthorize("@ss.hasPermi('system:dept:remove')") // @Log(title = "部门管理", businessType = BusinessType.DELETE) 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 5eb7e5062..2b16c08e3 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 @@ -76,7 +76,7 @@ public class SysPostController { } @ApiOperation("获得岗位信息") - @ApiImplicitParam(name = "id", value = "岗位编号", readOnly = true, example = "1024", dataTypeClass = Long.class) + @ApiImplicitParam(name = "id", value = "岗位编号", required = true, example = "1024", dataTypeClass = Long.class) // @PreAuthorize("@ss.hasPermi('system:post:query')") @GetMapping(value = "/get") public CommonResult getPost(@RequestParam("id") Long id) { 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 ffc9c30d1..a7c8b9a29 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 @@ -41,7 +41,7 @@ public class SysDictDataController { } @ApiOperation("/查询字典数据详细") - @ApiImplicitParam(name = "id", value = "编号", readOnly = true, example = "1024", dataTypeClass = Long.class) + @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) @GetMapping(value = "/get") // @PreAuthorize("@ss.hasPermi('system:dict:query')") public CommonResult getDictData(@RequestParam("id") Long id) { @@ -67,7 +67,7 @@ public class SysDictDataController { } @ApiOperation("删除字典数据") - @ApiImplicitParam(name = "id", value = "编号", readOnly = true, example = "1024", dataTypeClass = Long.class) + @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) @PostMapping("/delete") // @PreAuthorize("@ss.hasPermi('system:dict:remove')") public CommonResult deleteDictData(Long id) { @@ -75,7 +75,7 @@ public class SysDictDataController { return success(true); } - // + // @Log(title = "字典类型", businessType = BusinessType.EXPORT) // @PreAuthorize("@ss.hasPermi('system:dict:export')") // @GetMapping("/export") 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 a7e8bbf19..88b5deab4 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 @@ -33,7 +33,7 @@ public class SysDictTypeController { } @ApiOperation("/查询字典类型详细") - @ApiImplicitParam(name = "id", value = "编号", readOnly = true, example = "1024", dataTypeClass = Long.class) + @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) @GetMapping(value = "/get") // @PreAuthorize("@ss.hasPermi('system:dict:query')") public CommonResult getDictType(@RequestParam("id") Long id) { @@ -59,7 +59,7 @@ public class SysDictTypeController { } @ApiOperation("删除字典类型") - @ApiImplicitParam(name = "id", value = "编号", readOnly = true, example = "1024", dataTypeClass = Long.class) + @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) @PostMapping("/delete") // @PreAuthorize("@ss.hasPermi('system:dict:remove')") public CommonResult deleteDictType(Long id) { diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/dict/vo/data/SysDictDataExcelRespVO.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/dict/vo/data/SysDictDataExcelRespVO.java deleted file mode 100644 index 2672c5528..000000000 --- a/src/main/java/cn/iocoder/dashboard/modules/system/controller/dict/vo/data/SysDictDataExcelRespVO.java +++ /dev/null @@ -1,30 +0,0 @@ -package cn.iocoder.dashboard.modules.system.controller.dict.vo.data; - -import cn.iocoder.dashboard.framework.excel.Excel; -import lombok.Data; - -/** - * 字典数据 Excel 导出响应 VO - */ -@Data -public class SysDictDataExcelRespVO { - - @Excel(name = "字典编码", cellType = Excel.ColumnType.NUMERIC) - private Long id; - - @Excel(name = "字典排序", cellType = Excel.ColumnType.NUMERIC) - private Integer sort; - - @Excel(name = "字典标签") - private String label; - - @Excel(name = "字典键值") - private String value; - - @Excel(name = "字典类型") - private String dictType; - - @Excel(name = "状态", readConverterExp = "0=正常,1=停用") - private Integer status; - -} diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/dict/vo/data/SysDictDataExcelVO.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/dict/vo/data/SysDictDataExcelVO.java new file mode 100644 index 000000000..50f5c5956 --- /dev/null +++ b/src/main/java/cn/iocoder/dashboard/modules/system/controller/dict/vo/data/SysDictDataExcelVO.java @@ -0,0 +1,35 @@ +package cn.iocoder.dashboard.modules.system.controller.dict.vo.data; + +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 + */ +@Data +public class SysDictDataExcelVO { + + @ExcelProperty("字典编码") + private Long id; + + @ExcelProperty("字典排序") + private Integer sort; + + @ExcelProperty("字典标签") + private String label; + + @ExcelProperty("字典键值") + private String value; + + @ExcelProperty("字典类型") + private String dictType; + + @ExcelProperty(value = "状态", converter = DictConvert.class) + @DictFormat(SYS_COMMON_STATUS) + private Integer status; + +} diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/dict/vo/type/SysDictTypeExcelRespVO.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/dict/vo/type/SysDictTypeExcelRespVO.java deleted file mode 100644 index e25e994eb..000000000 --- a/src/main/java/cn/iocoder/dashboard/modules/system/controller/dict/vo/type/SysDictTypeExcelRespVO.java +++ /dev/null @@ -1,24 +0,0 @@ -package cn.iocoder.dashboard.modules.system.controller.dict.vo.type; - -import cn.iocoder.dashboard.framework.excel.Excel; -import lombok.Data; - -/** - * 字典类型 Excel 导出响应 VO - */ -@Data -public class SysDictTypeExcelRespVO { - - @Excel(name = "字典主键", cellType = Excel.ColumnType.NUMERIC) - private Long id; - - @Excel(name = "字典名称") - private String name; - - @Excel(name = "字典类型") - private String type; - - @Excel(name = "状态", readConverterExp = "0=正常,1=停用") - private Integer status; - -} diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/dict/vo/type/SysDictTypeExcelVO.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/dict/vo/type/SysDictTypeExcelVO.java new file mode 100644 index 000000000..15922759f --- /dev/null +++ b/src/main/java/cn/iocoder/dashboard/modules/system/controller/dict/vo/type/SysDictTypeExcelVO.java @@ -0,0 +1,29 @@ +package cn.iocoder.dashboard.modules.system.controller.dict.vo.type; + +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 + */ +@Data +public class SysDictTypeExcelVO { + + @ExcelProperty("字典主键") + private Long id; + + @ExcelProperty("字典名称") + private String name; + + @ExcelProperty("字典类型") + private String type; + + @ExcelProperty(value = "状态", converter = DictConvert.class) + @DictFormat(SYS_COMMON_STATUS) + private Integer status; + +} diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/notice/SysNoticeController.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/notice/SysNoticeController.java index cf968ac50..b586ef050 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/controller/notice/SysNoticeController.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/controller/notice/SysNoticeController.java @@ -34,7 +34,7 @@ public class SysNoticeController { } @ApiOperation("获得通知公告") - @ApiImplicitParam(name = "id", value = "编号", readOnly = true, example = "1024", dataTypeClass = Long.class) + @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) // @PreAuthorize("@ss.hasPermi('system:notice:query')") @GetMapping(value = "/get") public CommonResult getNotice(@RequestParam("id") Long id) { @@ -60,7 +60,7 @@ public class SysNoticeController { } @ApiOperation("删除通知公告") - @ApiImplicitParam(name = "id", value = "编号", readOnly = true, example = "1024", dataTypeClass = Long.class) + @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) // @PreAuthorize("@ss.hasPermi('system:notice:remove')") // @Log(title = "通知公告", businessType = BusinessType.DELETE) @PostMapping("/delete") diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/user/SysUserController.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/user/SysUserController.java index 188e4520e..0d3088659 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/controller/user/SysUserController.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/controller/user/SysUserController.java @@ -65,7 +65,7 @@ public class SysUserController { * 根据用户编号获取详细信息 */ @ApiOperation("获得用户详情") - @ApiImplicitParam(name = "id", value = "编号", readOnly = true, example = "1024", dataTypeClass = Long.class) + @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) @GetMapping("/get") // @PreAuthorize("@ss.hasPermi('system:user:query')") public CommonResult getInfo(@RequestParam("id") Long id) { @@ -91,7 +91,7 @@ public class SysUserController { } @ApiOperation("删除用户") - @ApiImplicitParam(name = "id", value = "编号", readOnly = true, example = "1024", dataTypeClass = Long.class) + @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) @PostMapping("/delete") // @PreAuthorize("@ss.hasPermi('system:user:remove')") // @Log(title = "用户管理", businessType = BusinessType.DELETE) diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/package-info.java b/src/main/java/cn/iocoder/dashboard/modules/system/package-info.java new file mode 100644 index 000000000..54c955b25 --- /dev/null +++ b/src/main/java/cn/iocoder/dashboard/modules/system/package-info.java @@ -0,0 +1,7 @@ +/** + * system 包下,我们放通用业务,支撑上层的核心业务。 + * 例如说:用户、部门、权限、数据字典等等 + * + * 缩写:sys + */ +package cn.iocoder.dashboard.modules.system;