mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-26 09:11:52 +08:00
1. 增加 infra 和 system 包的说明
2. 增加 logger 组件的设计想法
This commit is contained in:
parent
00935f7d69
commit
d8a52a8c61
@ -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;
|
@ -0,0 +1,7 @@
|
||||
/**
|
||||
* infra 包下,我们放基础设施的运维与管理,支撑上层的通用与核心业务。
|
||||
* 例如说:定时任务的管理、服务器的信息等等
|
||||
*
|
||||
* 缩写:inf
|
||||
*/
|
||||
package cn.iocoder.dashboard.modules.infra;
|
@ -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<String> 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);
|
||||
|
@ -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<SysDeptRespVO> 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)
|
||||
|
@ -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<SysPostRespVO> getPost(@RequestParam("id") Long id) {
|
||||
|
@ -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<SysDictDataRespVO> 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<Boolean> 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")
|
||||
|
@ -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<SysDictTypeRespVO> 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<Boolean> deleteDictType(Long id) {
|
||||
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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<SysNoticeRespVO> 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")
|
||||
|
@ -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<SysUserRespVO> 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)
|
||||
|
@ -0,0 +1,7 @@
|
||||
/**
|
||||
* system 包下,我们放通用业务,支撑上层的核心业务。
|
||||
* 例如说:用户、部门、权限、数据字典等等
|
||||
*
|
||||
* 缩写:sys
|
||||
*/
|
||||
package cn.iocoder.dashboard.modules.system;
|
Loading…
Reference in New Issue
Block a user