Commit 378f5834ccc94e1fef23bc0d5d2e7d0b58c61dc5

Authored by YunaiV
1 parent 9f9c63a2

整理 logger、notice 的 url

ruoyi-ui/src/views/system/loginlog/index.vue
... ... @@ -2,56 +2,22 @@
2 2 <div class="app-container">
3 3 <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
4 4 <el-form-item label="登录地址" prop="userIp">
5   - <el-input
6   - v-model="queryParams.userIp"
7   - placeholder="请输入登录地址"
8   - clearable
9   - style="width: 240px;"
10   - size="small"
11   - @keyup.enter.native="handleQuery"
12   - />
  5 + <el-input v-model="queryParams.userIp" placeholder="请输入登录地址" clearable style="width: 240px;" size="small"
  6 + @keyup.enter.native="handleQuery"/>
13 7 </el-form-item>
14 8 <el-form-item label="用户名称" prop="username">
15   - <el-input
16   - v-model="queryParams.username"
17   - placeholder="请输入用户名称"
18   - clearable
19   - style="width: 240px;"
20   - size="small"
21   - @keyup.enter.native="handleQuery"
22   - />
  9 + <el-input v-model="queryParams.username" placeholder="请输入用户名称" clearable style="width: 240px;" size="small"
  10 + @keyup.enter.native="handleQuery"/>
23 11 </el-form-item>
24 12 <el-form-item label="状态" prop="status">
25   - <el-select
26   - v-model="queryParams.status"
27   - placeholder="结果"
28   - clearable
29   - size="small"
30   - style="width: 240px"
31   - >
32   - <el-option
33   - :key="true"
34   - label="成功"
35   - :value="true"
36   - />
37   - <el-option
38   - :key="false"
39   - label="失败"
40   - :value="false"
41   - />
  13 + <el-select v-model="queryParams.status" placeholder="结果" clearable size="small" style="width: 240px">
  14 + <el-option :key="true" label="成功" :value="true"/>
  15 + <el-option :key="false" label="失败" :value="false"/>
42 16 </el-select>
43 17 </el-form-item>
44 18 <el-form-item label="登录时间">
45   - <el-date-picker
46   - v-model="dateRange"
47   - size="small"
48   - style="width: 240px"
49   - value-format="yyyy-MM-dd"
50   - type="daterange"
51   - range-separator="-"
52   - start-placeholder="开始日期"
53   - end-placeholder="结束日期"
54   - ></el-date-picker>
  19 + <el-date-picker v-model="dateRange" size="small" style="width: 240px" value-format="yyyy-MM-dd"
  20 + type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
55 21 </el-form-item>
56 22 <el-form-item>
57 23 <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
... ... @@ -61,13 +27,8 @@
61 27  
62 28 <el-row :gutter="10" class="mb8">
63 29 <el-col :span="1.5">
64   - <el-button
65   - type="warning"
66   - icon="el-icon-download"
67   - size="mini"
68   - @click="handleExport"
69   - v-hasPermi="['system:login-log:export']"
70   - >导出</el-button>
  30 + <el-button type="warning" icon="el-icon-download" size="mini" @click="handleExport"
  31 + v-hasPermi="['system:login-log:export']">导出</el-button>
71 32 </el-col>
72 33 <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
73 34 </el-row>
... ... @@ -76,7 +37,7 @@
76 37 <el-table-column label="访问编号" align="center" prop="id" />
77 38 <el-table-column label="日志类型" align="center" prop="logType">
78 39 <template slot-scope="scope">
79   - <span>{{ scope.row.logType === 1 ? '登录' : '退出' }}</span>
  40 + <span>{{ scope.row.logType === 100 ? '登录' : '退出' }}</span>
80 41 </template>
81 42 </el-table-column>
82 43 <el-table-column label="用户名称" align="center" prop="username" />
... ... @@ -95,13 +56,8 @@
95 56 </el-table-column>
96 57 </el-table>
97 58  
98   - <pagination
99   - v-show="total>0"
100   - :total="total"
101   - :page.sync="queryParams.pageNo"
102   - :limit.sync="queryParams.pageSize"
103   - @pagination="getList"
104   - />
  59 + <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
  60 + @pagination="getList"/>
105 61 </div>
106 62 </template>
107 63  
... ...
ruoyi-ui/src/views/system/notice/index.vue
... ... @@ -2,31 +2,14 @@
2 2 <div class="app-container">
3 3 <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
4 4 <el-form-item label="公告标题" prop="title">
5   - <el-input
6   - v-model="queryParams.title"
7   - placeholder="请输入公告标题"
8   - clearable
9   - size="small"
10   - @keyup.enter.native="handleQuery"
11   - />
  5 + <el-input v-model="queryParams.title" placeholder="请输入公告标题" clearable size="small" @keyup.enter.native="handleQuery"/>
12 6 </el-form-item>
13 7 <el-form-item label="操作人员" prop="createBy">
14   - <el-input
15   - v-model="queryParams.createBy"
16   - placeholder="请输入操作人员"
17   - clearable
18   - size="small"
19   - @keyup.enter.native="handleQuery"
20   - />
  8 + <el-input v-model="queryParams.createBy" placeholder="请输入操作人员" clearable size="small" @keyup.enter.native="handleQuery"/>
21 9 </el-form-item>
22 10 <el-form-item label="类型" prop="type">
23 11 <el-select v-model="queryParams.type" placeholder="公告类型" clearable size="small">
24   - <el-option
25   - v-for="dict in noticeTypeDictDatas"
26   - :key="parseInt(dict.value)"
27   - :label="dict.label"
28   - :value="parseInt(dict.value)"
29   - />
  12 + <el-option v-for="dict in noticeTypeDictDatas" :key="parseInt(dict.value)" :label="dict.label" :value="parseInt(dict.value)"/>
30 13 </el-select>
31 14 </el-form-item>
32 15 <el-form-item>
... ... @@ -37,39 +20,16 @@
37 20  
38 21 <el-row :gutter="10" class="mb8">
39 22 <el-col :span="1.5">
40   - <el-button
41   - type="primary"
42   - icon="el-icon-plus"
43   - size="mini"
44   - @click="handleAdd"
45   - v-hasPermi="['system:notice:add']"
46   - >新增</el-button>
  23 + <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['system:notice:create']"s>新增</el-button>
47 24 </el-col>
48 25 <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
49 26 </el-row>
50 27  
51 28 <el-table v-loading="loading" :data="noticeList">
52 29 <el-table-column label="序号" align="center" prop="id" width="100" />
53   - <el-table-column
54   - label="公告标题"
55   - align="center"
56   - prop="title"
57   - :show-overflow-tooltip="true"
58   - />
59   - <el-table-column
60   - label="公告类型"
61   - align="center"
62   - prop="type"
63   - :formatter="typeFormat"
64   - width="100"
65   - />
66   - <el-table-column
67   - label="状态"
68   - align="center"
69   - prop="status"
70   - :formatter="statusFormat"
71   - width="100"
72   - />
  30 + <el-table-column label="公告标题" align="center" prop="title" :show-overflow-tooltip="true"/>
  31 + <el-table-column label="公告类型" align="center" prop="type" :formatter="typeFormat" width="100"/>
  32 + <el-table-column label="状态" align="center" prop="status" :formatter="statusFormat" width="100"/>
73 33 <el-table-column label="创建者" align="center" prop="createBy" width="100" />
74 34 <el-table-column label="创建时间" align="center" prop="createTime" width="100">
75 35 <template slot-scope="scope">
... ... @@ -78,31 +38,16 @@
78 38 </el-table-column>
79 39 <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
80 40 <template slot-scope="scope">
81   - <el-button
82   - size="mini"
83   - type="text"
84   - icon="el-icon-edit"
85   - @click="handleUpdate(scope.row)"
86   - v-hasPermi="['system:notice:edit']"
87   - >修改</el-button>
88   - <el-button
89   - size="mini"
90   - type="text"
91   - icon="el-icon-delete"
92   - @click="handleDelete(scope.row)"
93   - v-hasPermi="['system:notice:remove']"
94   - >删除</el-button>
  41 + <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
  42 + v-hasPermi="['system:notice:update']">修改</el-button>
  43 + <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
  44 + v-hasPermi="['system:notice:delete']">删除</el-button>
95 45 </template>
96 46 </el-table-column>
97 47 </el-table>
98 48  
99   - <pagination
100   - v-show="total>0"
101   - :total="total"
102   - :page.sync="queryParams.pageNo"
103   - :limit.sync="queryParams.pageSize"
104   - @pagination="getList"
105   - />
  49 + <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
  50 + @pagination="getList"/>
106 51  
107 52 <!-- 添加或修改公告对话框 -->
108 53 <el-dialog :title="title" :visible.sync="open" width="780px" append-to-body>
... ...
ruoyi-ui/src/views/system/operatelog/index.vue
... ... @@ -2,72 +2,28 @@
2 2 <div class="app-container">
3 3 <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
4 4 <el-form-item label="系统模块" prop="title">
5   - <el-input
6   - v-model="queryParams.title"
7   - placeholder="请输入系统模块"
8   - clearable
9   - style="width: 240px;"
10   - size="small"
11   - @keyup.enter.native="handleQuery"
12   - />
  5 + <el-input v-model="queryParams.title" placeholder="请输入系统模块" clearable style="width: 240px;" size="small"
  6 + @keyup.enter.native="handleQuery"/>
13 7 </el-form-item>
14 8 <el-form-item label="操作人员" prop="operName">
15   - <el-input
16   - v-model="queryParams.operName"
17   - placeholder="请输入操作人员"
18   - clearable
19   - style="width: 240px;"
20   - size="small"
21   - @keyup.enter.native="handleQuery"
22   - />
  9 + <el-input v-model="queryParams.operName" placeholder="请输入操作人员" clearable style="width: 240px;" size="small"
  10 + @keyup.enter.native="handleQuery"/>
23 11 </el-form-item>
24 12 <el-form-item label="类型" prop="type">
25   - <el-select
26   - v-model="queryParams.type"
27   - placeholder="操作类型"
28   - clearable
29   - size="small"
30   - style="width: 240px"
31   - >
32   - <el-option
33   - v-for="dict in this.getDictDatas(DICT_TYPE.SYS_OPERATE_TYPE)"
34   - :key="parseInt(dict.value)"
35   - :label="dict.label"
36   - :value="parseInt(dict.value)"
37   - />
  13 + <el-select v-model="queryParams.type" placeholder="操作类型" clearable size="small" style="width: 240px">
  14 + <el-option v-for="dict in this.getDictDatas(DICT_TYPE.SYS_OPERATE_TYPE)" :key="parseInt(dict.value)"
  15 + :label="dict.label" :value="parseInt(dict.value)"/>
38 16 </el-select>
39 17 </el-form-item>
40 18 <el-form-item label="状态" prop="status">
41   - <el-select
42   - v-model="queryParams.success"
43   - placeholder="操作状态"
44   - clearable
45   - size="small"
46   - style="width: 240px"
47   - >
48   - <el-option
49   - :key="true"
50   - label="成功"
51   - :value="true"
52   - />
53   - <el-option
54   - :key="false"
55   - label="失败"
56   - :value="false"
57   - />
  19 + <el-select v-model="queryParams.success" placeholder="操作状态" clearable size="small" style="width: 240px">
  20 + <el-option :key="true" label="成功" :value="true"/>
  21 + <el-option :key="false" label="失败" :value="false"/>
58 22 </el-select>
59 23 </el-form-item>
60 24 <el-form-item label="操作时间">
61   - <el-date-picker
62   - v-model="dateRange"
63   - size="small"
64   - style="width: 240px"
65   - value-format="yyyy-MM-dd"
66   - type="daterange"
67   - range-separator="-"
68   - start-placeholder="开始日期"
69   - end-placeholder="结束日期"
70   - ></el-date-picker>
  25 + <el-date-picker v-model="dateRange" size="small" style="width: 240px" value-format="yyyy-MM-dd"
  26 + type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
71 27 </el-form-item>
72 28 <el-form-item>
73 29 <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
... ... @@ -77,13 +33,8 @@
77 33  
78 34 <el-row :gutter="10" class="mb8">
79 35 <el-col :span="1.5">
80   - <el-button
81   - type="warning"
82   - icon="el-icon-download"
83   - size="mini"
84   - @click="handleExport"
85   - v-hasPermi="['system:config:export']"
86   - >导出</el-button>
  36 + <el-button type="warning" icon="el-icon-download" size="mini" @click="handleExport"
  37 + v-hasPermi="['system:operate-log:export']">导出</el-button>
87 38 </el-col>
88 39 <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
89 40 </el-row>
... ...
src/main/java/cn/iocoder/dashboard/framework/jackson/config/JacksonConfig.java
... ... @@ -5,7 +5,6 @@ import cn.iocoder.dashboard.framework.jackson.ser.LocalDateTimeSerializer;
5 5 import cn.iocoder.dashboard.util.json.JsonUtils;
6 6 import com.fasterxml.jackson.databind.ObjectMapper;
7 7 import com.fasterxml.jackson.databind.module.SimpleModule;
8   -import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
9 8 import org.springframework.context.annotation.Bean;
10 9 import org.springframework.context.annotation.Configuration;
11 10  
... ... @@ -22,8 +21,9 @@ public class JacksonConfig {
22 21 * 1. 新增Long类型序列化规则,数值超过2^53-1,在JS会出现精度丢失问题,因此Long自动序列化为字符串类型
23 22 * 2. 新增LocalDateTime序列化、反序列化规则
24 23 */
25   - simpleModule.addSerializer(Long.class, ToStringSerializer.instance)
26   - .addSerializer(Long.TYPE, ToStringSerializer.instance)
  24 + simpleModule
  25 +// .addSerializer(Long.class, ToStringSerializer.instance)
  26 +// .addSerializer(Long.TYPE, ToStringSerializer.instance)
27 27 .addSerializer(LocalDateTime.class, LocalDateTimeSerializer.INSTANCE)
28 28 .addDeserializer(LocalDateTime.class, LocalDateTimeDeserializer.INSTANCE);
29 29  
... ...
src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/SysLoginLogController.java
... ... @@ -3,6 +3,7 @@ package cn.iocoder.dashboard.modules.system.controller.logger;
3 3 import cn.iocoder.dashboard.common.pojo.CommonResult;
4 4 import cn.iocoder.dashboard.common.pojo.PageResult;
5 5 import cn.iocoder.dashboard.framework.excel.core.util.ExcelUtils;
  6 +import cn.iocoder.dashboard.framework.logger.operatelog.core.annotations.OperateLog;
6 7 import cn.iocoder.dashboard.modules.system.controller.logger.vo.loginlog.SysLoginLogExcelVO;
7 8 import cn.iocoder.dashboard.modules.system.controller.logger.vo.loginlog.SysLoginLogExportReqVO;
8 9 import cn.iocoder.dashboard.modules.system.controller.logger.vo.loginlog.SysLoginLogPageReqVO;
... ... @@ -12,6 +13,7 @@ import cn.iocoder.dashboard.modules.system.dal.dataobject.logger.SysLoginLogDO;
12 13 import cn.iocoder.dashboard.modules.system.service.logger.SysLoginLogService;
13 14 import io.swagger.annotations.Api;
14 15 import io.swagger.annotations.ApiOperation;
  16 +import org.springframework.security.access.prepost.PreAuthorize;
15 17 import org.springframework.validation.annotation.Validated;
16 18 import org.springframework.web.bind.annotation.GetMapping;
17 19 import org.springframework.web.bind.annotation.RequestMapping;
... ... @@ -19,36 +21,39 @@ import org.springframework.web.bind.annotation.RestController;
19 21  
20 22 import javax.annotation.Resource;
21 23 import javax.servlet.http.HttpServletResponse;
  24 +import javax.validation.Valid;
22 25 import java.io.IOException;
23 26 import java.util.List;
24 27  
  28 +import static cn.iocoder.dashboard.framework.logger.operatelog.core.enums.OperateTypeEnum.EXPORT;
  29 +
25 30 @Api(tags = "登陆日志")
26 31 @RestController
27 32 @RequestMapping("/system/login-log")
  33 +@Validated
28 34 public class SysLoginLogController {
29 35  
30 36 @Resource
31 37 private SysLoginLogService loginLogService;
32 38  
33   - @ApiOperation("获得登陆日志分页列表")
34 39 @GetMapping("/page")
35   -// @PreAuthorize("@ss.hasPermi('system:login-log:query')")
36   - public CommonResult<PageResult<SysLoginLogRespVO>> getLoginLogPage(@Validated SysLoginLogPageReqVO reqVO) {
  40 + @ApiOperation("获得登陆日志分页列表")
  41 + @PreAuthorize("@ss.hasPermission('system:login-log:query')")
  42 + public CommonResult<PageResult<SysLoginLogRespVO>> getLoginLogPage(@Valid SysLoginLogPageReqVO reqVO) {
37 43 PageResult<SysLoginLogDO> page = loginLogService.getLoginLogPage(reqVO);
38 44 return CommonResult.success(SysLoginLogConvert.INSTANCE.convertPage(page));
39 45 }
40 46  
41   - @ApiOperation("导出登陆日志 Excel")
42 47 @GetMapping("/export")
43   -// @Log(title = "登录日志", businessType = BusinessType.EXPORT)
44   -// @PreAuthorize("@ss.hasPermi('monitor:logininfor:export')")
45   - public void exportLoginLog(HttpServletResponse response, @Validated SysLoginLogExportReqVO reqVO) throws IOException {
  48 + @ApiOperation("导出登陆日志 Excel")
  49 + @PreAuthorize("@ss.hasPermission('system:login-log:export')")
  50 + @OperateLog(type = EXPORT)
  51 + public void exportLoginLog(HttpServletResponse response, @Valid SysLoginLogExportReqVO reqVO) throws IOException {
46 52 List<SysLoginLogDO> list = loginLogService.getLoginLogList(reqVO);
47 53 // 拼接数据
48   - List<SysLoginLogExcelVO> excelDataList = SysLoginLogConvert.INSTANCE.convertList(list);
  54 + List<SysLoginLogExcelVO> data = SysLoginLogConvert.INSTANCE.convertList(list);
49 55 // 输出
50   - ExcelUtils.write(response, "登陆日志.xls", "数据列表",
51   - SysLoginLogExcelVO.class, excelDataList);
  56 + ExcelUtils.write(response, "登陆日志.xls", "数据列表", SysLoginLogExcelVO.class, data);
52 57 }
53 58  
54 59 }
... ...
src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/SysOperateLogController.java
... ... @@ -4,8 +4,6 @@ import cn.iocoder.dashboard.common.pojo.CommonResult;
4 4 import cn.iocoder.dashboard.common.pojo.PageResult;
5 5 import cn.iocoder.dashboard.framework.excel.core.util.ExcelUtils;
6 6 import cn.iocoder.dashboard.framework.logger.operatelog.core.annotations.OperateLog;
7   -import cn.iocoder.dashboard.framework.logger.operatelog.core.enums.OperateTypeEnum;
8   -import cn.iocoder.dashboard.framework.logger.operatelog.core.util.OperateLogUtils;
9 7 import cn.iocoder.dashboard.modules.system.controller.logger.vo.operatelog.SysOperateLogExcelVO;
10 8 import cn.iocoder.dashboard.modules.system.controller.logger.vo.operatelog.SysOperateLogExportReqVO;
11 9 import cn.iocoder.dashboard.modules.system.controller.logger.vo.operatelog.SysOperateLogPageReqVO;
... ... @@ -19,6 +17,7 @@ import cn.iocoder.dashboard.util.collection.CollectionUtils;
19 17 import cn.iocoder.dashboard.util.collection.MapUtils;
20 18 import io.swagger.annotations.Api;
21 19 import io.swagger.annotations.ApiOperation;
  20 +import org.springframework.security.access.prepost.PreAuthorize;
22 21 import org.springframework.validation.annotation.Validated;
23 22 import org.springframework.web.bind.annotation.GetMapping;
24 23 import org.springframework.web.bind.annotation.RequestMapping;
... ... @@ -26,6 +25,7 @@ import org.springframework.web.bind.annotation.RestController;
26 25  
27 26 import javax.annotation.Resource;
28 27 import javax.servlet.http.HttpServletResponse;
  28 +import javax.validation.Valid;
29 29 import java.io.IOException;
30 30 import java.util.ArrayList;
31 31 import java.util.Collection;
... ... @@ -38,32 +38,18 @@ import static cn.iocoder.dashboard.framework.logger.operatelog.core.enums.Operat
38 38 @Api(tags = "操作日志")
39 39 @RestController
40 40 @RequestMapping("/system/operate-log")
  41 +@Validated
41 42 public class SysOperateLogController {
42 43  
43 44 @Resource
44 45 private SysOperateLogService operateLogService;
45   -
46 46 @Resource
47 47 private SysUserService userService;
48 48  
49   - @ApiOperation("示例")
50   - @OperateLog(type = OperateTypeEnum.OTHER)
51   - @GetMapping("/demo")
52   - public CommonResult<Boolean> demo() {
53   - // 这里可以调用业务逻辑
54   -
55   - // 补全操作日志的明细
56   - OperateLogUtils.setContent("将编号 1 的数据,xxx 字段修改成了 yyyy");
57   - OperateLogUtils.addExt("orderId", 1);
58   -
59   - // 响应
60   - return success(true);
61   - }
62   -
63   - @ApiOperation("查看操作日志分页列表")
64 49 @GetMapping("/page")
65   -// @PreAuthorize("@ss.hasPermi('system:operate-log:query')")
66   - public CommonResult<PageResult<SysOperateLogRespVO>> pageOperateLog(@Validated SysOperateLogPageReqVO reqVO) {
  50 + @ApiOperation("查看操作日志分页列表")
  51 + @PreAuthorize("@ss.hasPermission('system:operate-log:query')")
  52 + public CommonResult<PageResult<SysOperateLogRespVO>> pageOperateLog(@Valid SysOperateLogPageReqVO reqVO) {
67 53 PageResult<SysOperateLogDO> pageResult = operateLogService.pageOperateLog(reqVO);
68 54  
69 55 // 获得拼接需要的数据
... ... @@ -82,10 +68,9 @@ public class SysOperateLogController {
82 68  
83 69 @ApiOperation("导出操作日志")
84 70 @GetMapping("/export")
  71 + @PreAuthorize("@ss.hasPermission('system:operate-log:export')")
85 72 @OperateLog(type = EXPORT)
86   -// @PreAuthorize("@ss.hasPermi('system:operate-log:export')")
87   - public void exportOperateLog(HttpServletResponse response, @Validated SysOperateLogExportReqVO reqVO)
88   - throws IOException {
  73 + public void exportOperateLog(HttpServletResponse response, @Valid SysOperateLogExportReqVO reqVO) throws IOException {
89 74 List<SysOperateLogDO> list = operateLogService.listOperateLogs(reqVO);
90 75  
91 76 // 获得拼接需要的数据
... ... @@ -94,8 +79,7 @@ public class SysOperateLogController {
94 79 // 拼接数据
95 80 List<SysOperateLogExcelVO> excelDataList = SysOperateLogConvert.INSTANCE.convertList(list, userMap);
96 81 // 输出
97   - ExcelUtils.write(response, "操作日志.xls", "数据列表",
98   - SysOperateLogExcelVO.class, excelDataList);
  82 + ExcelUtils.write(response, "操作日志.xls", "数据列表", SysOperateLogExcelVO.class, excelDataList);
99 83 }
100 84  
101 85 }
... ...
src/main/java/cn/iocoder/dashboard/modules/system/controller/notice/SysNoticeController.java
... ... @@ -11,62 +11,62 @@ import cn.iocoder.dashboard.modules.system.service.notice.SysNoticeService;
11 11 import io.swagger.annotations.Api;
12 12 import io.swagger.annotations.ApiImplicitParam;
13 13 import io.swagger.annotations.ApiOperation;
  14 +import org.springframework.security.access.prepost.PreAuthorize;
14 15 import org.springframework.validation.annotation.Validated;
15 16 import org.springframework.web.bind.annotation.*;
16 17  
17 18 import javax.annotation.Resource;
  19 +import javax.validation.Valid;
18 20  
19 21 import static cn.iocoder.dashboard.common.pojo.CommonResult.success;
20 22  
21 23 @Api(tags = "通知公告")
22 24 @RestController
23 25 @RequestMapping("/system/notice")
  26 +@Validated
24 27 public class SysNoticeController {
25 28  
26 29 @Resource
27 30 private SysNoticeService noticeService;
28 31  
29   - @ApiOperation("获取通知公告列表")
30   - @GetMapping("/page")
31   -// @PreAuthorize("@ss.hasPermi('system:notice:list')")
32   - public CommonResult<PageResult<SysNoticeRespVO>> pageNotices(@Validated SysNoticePageReqVO reqVO) {
33   - return success(SysNoticeConvert.INSTANCE.convertPage(noticeService.pageNotices(reqVO)));
34   - }
35   -
36   - @ApiOperation("获得通知公告")
37   - @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
38   -// @PreAuthorize("@ss.hasPermi('system:notice:query')")
39   - @GetMapping(value = "/get")
40   - public CommonResult<SysNoticeRespVO> getNotice(@RequestParam("id") Long id) {
41   - return success(SysNoticeConvert.INSTANCE.convert(noticeService.getNotice(id)));
42   - }
43   -
44   - @ApiOperation("新增通知公告")
45   -// @PreAuthorize("@ss.hasPermi('system:notice:add')")
46   -// @Log(title = "通知公告", businessType = BusinessType.INSERT)
47 32 @PostMapping("/create")
48   - public CommonResult<Long> createNotice(@Validated @RequestBody SysNoticeCreateReqVO reqVO) {
  33 + @ApiOperation("创建通知公告")
  34 + @PreAuthorize("@ss.hasPermission('system:notice:create')")
  35 + public CommonResult<Long> createNotice(@Valid @RequestBody SysNoticeCreateReqVO reqVO) {
49 36 Long noticeId = noticeService.createNotice(reqVO);
50 37 return success(noticeId);
51 38 }
52 39  
  40 + @PutMapping("/update")
53 41 @ApiOperation("修改通知公告")
54   -// @PreAuthorize("@ss.hasPermi('system:notice:edit')")
55   -// @Log(title = "通知公告", businessType = BusinessType.UPDATE)
56   - @PostMapping("/update")
57   - public CommonResult<Boolean> updateNotice(@Validated @RequestBody SysNoticeUpdateReqVO reqVO) {
  42 + @PreAuthorize("@ss.hasPermission('system:notice:update')")
  43 + public CommonResult<Boolean> updateNotice(@Valid @RequestBody SysNoticeUpdateReqVO reqVO) {
58 44 noticeService.updateNotice(reqVO);
59 45 return success(true);
60 46 }
61 47  
  48 + @DeleteMapping("/delete")
62 49 @ApiOperation("删除通知公告")
63 50 @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
64   -// @PreAuthorize("@ss.hasPermi('system:notice:remove')")
65   -// @Log(title = "通知公告", businessType = BusinessType.DELETE)
66   - @PostMapping("/delete")
  51 + @PreAuthorize("@ss.hasPermission('system:notice:delete')")
67 52 public CommonResult<Boolean> deleteNotice(@RequestParam("id") Long id) {
68 53 noticeService.deleteNotice(id);
69 54 return success(true);
70 55 }
71 56  
  57 + @GetMapping("/page")
  58 + @ApiOperation("获取通知公告列表")
  59 + @PreAuthorize("@ss.hasPermission('system:notice:quey')")
  60 + public CommonResult<PageResult<SysNoticeRespVO>> pageNotices(@Validated SysNoticePageReqVO reqVO) {
  61 + return success(SysNoticeConvert.INSTANCE.convertPage(noticeService.pageNotices(reqVO)));
  62 + }
  63 +
  64 + @GetMapping("/get")
  65 + @ApiOperation("获得通知公告")
  66 + @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
  67 + @PreAuthorize("@ss.hasPermission('system:notice:quey')")
  68 + public CommonResult<SysNoticeRespVO> getNotice(@RequestParam("id") Long id) {
  69 + return success(SysNoticeConvert.INSTANCE.convert(noticeService.getNotice(id)));
  70 + }
  71 +
72 72 }
... ...
src/main/java/cn/iocoder/dashboard/modules/system/service/notice/SysNoticeService.java
... ... @@ -12,22 +12,6 @@ import cn.iocoder.dashboard.modules.system.dal.dataobject.notice.SysNoticeDO;
12 12 public interface SysNoticeService {
13 13  
14 14 /**
15   - * 获得岗位公告公告分页列表
16   - *
17   - * @param reqVO 分页条件
18   - * @return 部门分页列表
19   - */
20   - PageResult<SysNoticeDO> pageNotices(SysNoticePageReqVO reqVO);
21   -
22   - /**
23   - * 获得岗位公告公告信息
24   - *
25   - * @param id 岗位公告公告编号
26   - * @return 岗位公告公告信息
27   - */
28   - SysNoticeDO getNotice(Long id);
29   -
30   - /**
31 15 * 创建岗位公告公告
32 16 *
33 17 * @param reqVO 岗位公告公告信息
... ... @@ -48,4 +32,21 @@ public interface SysNoticeService {
48 32 * @param id 岗位公告公告编号
49 33 */
50 34 void deleteNotice(Long id);
  35 +
  36 + /**
  37 + * 获得岗位公告公告分页列表
  38 + *
  39 + * @param reqVO 分页条件
  40 + * @return 部门分页列表
  41 + */
  42 + PageResult<SysNoticeDO> pageNotices(SysNoticePageReqVO reqVO);
  43 +
  44 + /**
  45 + * 获得岗位公告公告信息
  46 + *
  47 + * @param id 岗位公告公告编号
  48 + * @return 岗位公告公告信息
  49 + */
  50 + SysNoticeDO getNotice(Long id);
  51 +
51 52 }
... ...
src/main/java/cn/iocoder/dashboard/modules/system/service/notice/impl/SysNoticeServiceImpl.java
... ... @@ -28,16 +28,6 @@ public class SysNoticeServiceImpl implements SysNoticeService {
28 28 private SysNoticeMapper noticeMapper;
29 29  
30 30 @Override
31   - public PageResult<SysNoticeDO> pageNotices(SysNoticePageReqVO reqVO) {
32   - return noticeMapper.selectPage(reqVO);
33   - }
34   -
35   - @Override
36   - public SysNoticeDO getNotice(Long id) {
37   - return noticeMapper.selectById(id);
38   - }
39   -
40   - @Override
41 31 public Long createNotice(SysNoticeCreateReqVO reqVO) {
42 32 SysNoticeDO notice = SysNoticeConvert.INSTANCE.convert(reqVO);
43 33 noticeMapper.insert(notice);
... ... @@ -61,6 +51,16 @@ public class SysNoticeServiceImpl implements SysNoticeService {
61 51 noticeMapper.deleteById(id);
62 52 }
63 53  
  54 + @Override
  55 + public PageResult<SysNoticeDO> pageNotices(SysNoticePageReqVO reqVO) {
  56 + return noticeMapper.selectPage(reqVO);
  57 + }
  58 +
  59 + @Override
  60 + public SysNoticeDO getNotice(Long id) {
  61 + return noticeMapper.selectById(id);
  62 + }
  63 +
64 64 @VisibleForTesting
65 65 public void checkNoticeExists(Long id) {
66 66 if (id == null) {
... ...