Commit d8a52a8c6110bda65f7e83bb7b91607fccfb84f5

Authored by YunaiV
1 parent 00935f7d

1. 增加 infra 和 system 包的说明

2. 增加 logger 组件的设计想法
src/main/java/cn/iocoder/dashboard/framework/logger/package-info.java 0 → 100644
  1 +/**
  2 + * 日志组件,包括:
  3 + *
  4 + * 1. 用户操作日志:记录用户的操作,用于对用户的操作的审计与追溯,永久保存。
  5 + * 2. API 日志:包含两类
  6 + * 2.1 API 访问日志:记录用户访问 API 的访问日志,定期归档历史日志。
  7 + * 2.2 API 异常日志:记录用户访问 API 的系统异常,方便日常排查问题与告警。
  8 + * 3. 通用 Logger 日志:将 {@link org.slf4j.Logger} 打印的日志,只满足大于等于 {@link org.slf4j.event.Level} 进行持久化,可以理解成简易的“日志中心”。
  9 + */
  10 +package cn.iocoder.dashboard.framework.logger;
... ...
src/main/java/cn/iocoder/dashboard/modules/infra/package-info.java 0 → 100644
  1 +/**
  2 + * infra 包下,我们放基础设施的运维与管理,支撑上层的通用与核心业务。
  3 + * 例如说:定时任务的管理、服务器的信息等等
  4 + *
  5 + * 缩写:inf
  6 + */
  7 +package cn.iocoder.dashboard.modules.infra;
... ...
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
6 6 import cn.iocoder.dashboard.modules.system.service.common.SysFileService;
7 7 import cn.iocoder.dashboard.util.servlet.ServletUtils;
8 8 import io.swagger.annotations.Api;
  9 +import io.swagger.annotations.ApiImplicitParam;
  10 +import io.swagger.annotations.ApiImplicitParams;
  11 +import io.swagger.annotations.ApiOperation;
9 12 import lombok.extern.slf4j.Slf4j;
10 13 import org.springframework.http.HttpStatus;
11 14 import org.springframework.web.bind.annotation.*;
... ... @@ -13,7 +16,6 @@ import org.springframework.web.multipart.MultipartFile;
13 16  
14 17 import javax.annotation.Resource;
15 18 import javax.servlet.http.HttpServletResponse;
16   -
17 19 import java.io.IOException;
18 20  
19 21 import static cn.iocoder.dashboard.common.pojo.CommonResult.success;
... ... @@ -27,12 +29,19 @@ public class SysFileController {
27 29 @Resource
28 30 private SysFileService fileService;
29 31  
  32 + @ApiOperation("上传文件")
  33 + @ApiImplicitParams({
  34 + @ApiImplicitParam(name = "path", value = "文件附件", required = true, dataTypeClass = MultipartFile.class),
  35 + @ApiImplicitParam(name = "path", value = "文件路径", required = true, example = "yudaoyuanma.png", dataTypeClass = Long.class)
  36 + })
30 37 @PostMapping("/upload")
31 38 public CommonResult<String> uploadFile(@RequestParam("file") MultipartFile file,
32 39 @RequestParam("path") String path) throws IOException {
33 40 return success(fileService.createFile(path, IoUtil.readBytes(file.getInputStream())));
34 41 }
35 42  
  43 + @ApiOperation("下载文件")
  44 + @ApiImplicitParam(name = "path", value = "文件附件", required = true, dataTypeClass = MultipartFile.class)
36 45 @GetMapping("/get/{path}")
37 46 public void getFile(HttpServletResponse response, @PathVariable("path") String path) throws IOException {
38 47 SysFileDO file = fileService.getFile(path);
... ...
src/main/java/cn/iocoder/dashboard/modules/system/controller/dept/SysDeptController.java
... ... @@ -48,7 +48,7 @@ public class SysDeptController {
48 48 }
49 49  
50 50 @ApiOperation("获得部门信息")
51   - @ApiImplicitParam(name = "id", value = "编号", readOnly = true, example = "1024", dataTypeClass = Long.class)
  51 + @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
52 52 // @PreAuthorize("@ss.hasPermi('system:dept:query')")
53 53 @GetMapping("/get")
54 54 public CommonResult<SysDeptRespVO> getDept(@RequestParam("id") Long id) {
... ... @@ -74,7 +74,7 @@ public class SysDeptController {
74 74 }
75 75  
76 76 @ApiOperation("删除部门")
77   - @ApiImplicitParam(name = "id", value = "编号", readOnly = true, example = "1024", dataTypeClass = Long.class)
  77 + @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
78 78 @PostMapping("delete")
79 79 // @PreAuthorize("@ss.hasPermi('system:dept:remove')")
80 80 // @Log(title = "部门管理", businessType = BusinessType.DELETE)
... ...
src/main/java/cn/iocoder/dashboard/modules/system/controller/dept/SysPostController.java
... ... @@ -76,7 +76,7 @@ public class SysPostController {
76 76 }
77 77  
78 78 @ApiOperation("获得岗位信息")
79   - @ApiImplicitParam(name = "id", value = "岗位编号", readOnly = true, example = "1024", dataTypeClass = Long.class)
  79 + @ApiImplicitParam(name = "id", value = "岗位编号", required = true, example = "1024", dataTypeClass = Long.class)
80 80 // @PreAuthorize("@ss.hasPermi('system:post:query')")
81 81 @GetMapping(value = "/get")
82 82 public CommonResult<SysPostRespVO> getPost(@RequestParam("id") Long id) {
... ...
src/main/java/cn/iocoder/dashboard/modules/system/controller/dict/SysDictDataController.java
... ... @@ -41,7 +41,7 @@ public class SysDictDataController {
41 41 }
42 42  
43 43 @ApiOperation("/查询字典数据详细")
44   - @ApiImplicitParam(name = "id", value = "编号", readOnly = true, example = "1024", dataTypeClass = Long.class)
  44 + @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
45 45 @GetMapping(value = "/get")
46 46 // @PreAuthorize("@ss.hasPermi('system:dict:query')")
47 47 public CommonResult<SysDictDataRespVO> getDictData(@RequestParam("id") Long id) {
... ... @@ -67,7 +67,7 @@ public class SysDictDataController {
67 67 }
68 68  
69 69 @ApiOperation("删除字典数据")
70   - @ApiImplicitParam(name = "id", value = "编号", readOnly = true, example = "1024", dataTypeClass = Long.class)
  70 + @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
71 71 @PostMapping("/delete")
72 72 // @PreAuthorize("@ss.hasPermi('system:dict:remove')")
73 73 public CommonResult<Boolean> deleteDictData(Long id) {
... ... @@ -75,7 +75,7 @@ public class SysDictDataController {
75 75 return success(true);
76 76 }
77 77  
78   - //
  78 +
79 79 // @Log(title = "字典类型", businessType = BusinessType.EXPORT)
80 80 // @PreAuthorize("@ss.hasPermi('system:dict:export')")
81 81 // @GetMapping("/export")
... ...
src/main/java/cn/iocoder/dashboard/modules/system/controller/dict/SysDictTypeController.java
... ... @@ -33,7 +33,7 @@ public class SysDictTypeController {
33 33 }
34 34  
35 35 @ApiOperation("/查询字典类型详细")
36   - @ApiImplicitParam(name = "id", value = "编号", readOnly = true, example = "1024", dataTypeClass = Long.class)
  36 + @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
37 37 @GetMapping(value = "/get")
38 38 // @PreAuthorize("@ss.hasPermi('system:dict:query')")
39 39 public CommonResult<SysDictTypeRespVO> getDictType(@RequestParam("id") Long id) {
... ... @@ -59,7 +59,7 @@ public class SysDictTypeController {
59 59 }
60 60  
61 61 @ApiOperation("删除字典类型")
62   - @ApiImplicitParam(name = "id", value = "编号", readOnly = true, example = "1024", dataTypeClass = Long.class)
  62 + @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
63 63 @PostMapping("/delete")
64 64 // @PreAuthorize("@ss.hasPermi('system:dict:remove')")
65 65 public CommonResult<Boolean> deleteDictType(Long id) {
... ...
src/main/java/cn/iocoder/dashboard/modules/system/controller/dict/vo/data/SysDictDataExcelRespVO.java renamed to src/main/java/cn/iocoder/dashboard/modules/system/controller/dict/vo/data/SysDictDataExcelVO.java
1 1 package cn.iocoder.dashboard.modules.system.controller.dict.vo.data;
2 2  
3   -import cn.iocoder.dashboard.framework.excel.Excel;
  3 +import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat;
  4 +import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert;
  5 +import com.alibaba.excel.annotation.ExcelProperty;
4 6 import lombok.Data;
5 7  
  8 +import static cn.iocoder.dashboard.modules.system.enums.dict.DictTypeEnum.SYS_COMMON_STATUS;
  9 +
6 10 /**
7 11 * 字典数据 Excel 导出响应 VO
8 12 */
9 13 @Data
10   -public class SysDictDataExcelRespVO {
  14 +public class SysDictDataExcelVO {
11 15  
12   - @Excel(name = "字典编码", cellType = Excel.ColumnType.NUMERIC)
  16 + @ExcelProperty("字典编码")
13 17 private Long id;
14 18  
15   - @Excel(name = "字典排序", cellType = Excel.ColumnType.NUMERIC)
  19 + @ExcelProperty("字典排序")
16 20 private Integer sort;
17 21  
18   - @Excel(name = "字典标签")
  22 + @ExcelProperty("字典标签")
19 23 private String label;
20 24  
21   - @Excel(name = "字典键值")
  25 + @ExcelProperty("字典键值")
22 26 private String value;
23 27  
24   - @Excel(name = "字典类型")
  28 + @ExcelProperty("字典类型")
25 29 private String dictType;
26 30  
27   - @Excel(name = "状态", readConverterExp = "0=正常,1=停用")
  31 + @ExcelProperty(value = "状态", converter = DictConvert.class)
  32 + @DictFormat(SYS_COMMON_STATUS)
28 33 private Integer status;
29 34  
30 35 }
... ...
src/main/java/cn/iocoder/dashboard/modules/system/controller/dict/vo/type/SysDictTypeExcelRespVO.java renamed to src/main/java/cn/iocoder/dashboard/modules/system/controller/dict/vo/type/SysDictTypeExcelVO.java
1 1 package cn.iocoder.dashboard.modules.system.controller.dict.vo.type;
2 2  
3   -import cn.iocoder.dashboard.framework.excel.Excel;
  3 +import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat;
  4 +import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert;
  5 +import com.alibaba.excel.annotation.ExcelProperty;
4 6 import lombok.Data;
5 7  
  8 +import static cn.iocoder.dashboard.modules.system.enums.dict.DictTypeEnum.SYS_COMMON_STATUS;
  9 +
6 10 /**
7 11 * 字典类型 Excel 导出响应 VO
8 12 */
9 13 @Data
10   -public class SysDictTypeExcelRespVO {
  14 +public class SysDictTypeExcelVO {
11 15  
12   - @Excel(name = "字典主键", cellType = Excel.ColumnType.NUMERIC)
  16 + @ExcelProperty("字典主键")
13 17 private Long id;
14 18  
15   - @Excel(name = "字典名称")
  19 + @ExcelProperty("字典名称")
16 20 private String name;
17 21  
18   - @Excel(name = "字典类型")
  22 + @ExcelProperty("字典类型")
19 23 private String type;
20 24  
21   - @Excel(name = "状态", readConverterExp = "0=正常,1=停用")
  25 + @ExcelProperty(value = "状态", converter = DictConvert.class)
  26 + @DictFormat(SYS_COMMON_STATUS)
22 27 private Integer status;
23 28  
24 29 }
... ...
src/main/java/cn/iocoder/dashboard/modules/system/controller/notice/SysNoticeController.java
... ... @@ -34,7 +34,7 @@ public class SysNoticeController {
34 34 }
35 35  
36 36 @ApiOperation("获得通知公告")
37   - @ApiImplicitParam(name = "id", value = "编号", readOnly = true, example = "1024", dataTypeClass = Long.class)
  37 + @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
38 38 // @PreAuthorize("@ss.hasPermi('system:notice:query')")
39 39 @GetMapping(value = "/get")
40 40 public CommonResult<SysNoticeRespVO> getNotice(@RequestParam("id") Long id) {
... ... @@ -60,7 +60,7 @@ public class SysNoticeController {
60 60 }
61 61  
62 62 @ApiOperation("删除通知公告")
63   - @ApiImplicitParam(name = "id", value = "编号", readOnly = true, example = "1024", dataTypeClass = Long.class)
  63 + @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
64 64 // @PreAuthorize("@ss.hasPermi('system:notice:remove')")
65 65 // @Log(title = "通知公告", businessType = BusinessType.DELETE)
66 66 @PostMapping("/delete")
... ...
src/main/java/cn/iocoder/dashboard/modules/system/controller/user/SysUserController.java
... ... @@ -65,7 +65,7 @@ public class SysUserController {
65 65 * 根据用户编号获取详细信息
66 66 */
67 67 @ApiOperation("获得用户详情")
68   - @ApiImplicitParam(name = "id", value = "编号", readOnly = true, example = "1024", dataTypeClass = Long.class)
  68 + @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
69 69 @GetMapping("/get")
70 70 // @PreAuthorize("@ss.hasPermi('system:user:query')")
71 71 public CommonResult<SysUserRespVO> getInfo(@RequestParam("id") Long id) {
... ... @@ -91,7 +91,7 @@ public class SysUserController {
91 91 }
92 92  
93 93 @ApiOperation("删除用户")
94   - @ApiImplicitParam(name = "id", value = "编号", readOnly = true, example = "1024", dataTypeClass = Long.class)
  94 + @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
95 95 @PostMapping("/delete")
96 96 // @PreAuthorize("@ss.hasPermi('system:user:remove')")
97 97 // @Log(title = "用户管理", businessType = BusinessType.DELETE)
... ...
src/main/java/cn/iocoder/dashboard/modules/system/package-info.java 0 → 100644
  1 +/**
  2 + * system 包下,我们放通用业务,支撑上层的核心业务。
  3 + * 例如说:用户、部门、权限、数据字典等等
  4 + *
  5 + * 缩写:sys
  6 + */
  7 +package cn.iocoder.dashboard.modules.system;
... ...