Commit 378f5834ccc94e1fef23bc0d5d2e7d0b58c61dc5

Authored by YunaiV
1 parent 9f9c63a2

整理 logger、notice 的 url

ruoyi-ui/src/views/system/loginlog/index.vue
@@ -2,56 +2,22 @@ @@ -2,56 +2,22 @@
2 <div class="app-container"> 2 <div class="app-container">
3 <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> 3 <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
4 <el-form-item label="登录地址" prop="userIp"> 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 </el-form-item> 7 </el-form-item>
14 <el-form-item label="用户名称" prop="username"> 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 </el-form-item> 11 </el-form-item>
24 <el-form-item label="状态" prop="status"> 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 </el-select> 16 </el-select>
43 </el-form-item> 17 </el-form-item>
44 <el-form-item label="登录时间"> 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 </el-form-item> 21 </el-form-item>
56 <el-form-item> 22 <el-form-item>
57 <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> 23 <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
@@ -61,13 +27,8 @@ @@ -61,13 +27,8 @@
61 27
62 <el-row :gutter="10" class="mb8"> 28 <el-row :gutter="10" class="mb8">
63 <el-col :span="1.5"> 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 </el-col> 32 </el-col>
72 <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> 33 <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
73 </el-row> 34 </el-row>
@@ -76,7 +37,7 @@ @@ -76,7 +37,7 @@
76 <el-table-column label="访问编号" align="center" prop="id" /> 37 <el-table-column label="访问编号" align="center" prop="id" />
77 <el-table-column label="日志类型" align="center" prop="logType"> 38 <el-table-column label="日志类型" align="center" prop="logType">
78 <template slot-scope="scope"> 39 <template slot-scope="scope">
79 - <span>{{ scope.row.logType === 1 ? '登录' : '退出' }}</span> 40 + <span>{{ scope.row.logType === 100 ? '登录' : '退出' }}</span>
80 </template> 41 </template>
81 </el-table-column> 42 </el-table-column>
82 <el-table-column label="用户名称" align="center" prop="username" /> 43 <el-table-column label="用户名称" align="center" prop="username" />
@@ -95,13 +56,8 @@ @@ -95,13 +56,8 @@
95 </el-table-column> 56 </el-table-column>
96 </el-table> 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 </div> 61 </div>
106 </template> 62 </template>
107 63
ruoyi-ui/src/views/system/notice/index.vue
@@ -2,31 +2,14 @@ @@ -2,31 +2,14 @@
2 <div class="app-container"> 2 <div class="app-container">
3 <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> 3 <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
4 <el-form-item label="公告标题" prop="title"> 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 </el-form-item> 6 </el-form-item>
13 <el-form-item label="操作人员" prop="createBy"> 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 </el-form-item> 9 </el-form-item>
22 <el-form-item label="类型" prop="type"> 10 <el-form-item label="类型" prop="type">
23 <el-select v-model="queryParams.type" placeholder="公告类型" clearable size="small"> 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 </el-select> 13 </el-select>
31 </el-form-item> 14 </el-form-item>
32 <el-form-item> 15 <el-form-item>
@@ -37,39 +20,16 @@ @@ -37,39 +20,16 @@
37 20
38 <el-row :gutter="10" class="mb8"> 21 <el-row :gutter="10" class="mb8">
39 <el-col :span="1.5"> 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 </el-col> 24 </el-col>
48 <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> 25 <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
49 </el-row> 26 </el-row>
50 27
51 <el-table v-loading="loading" :data="noticeList"> 28 <el-table v-loading="loading" :data="noticeList">
52 <el-table-column label="序号" align="center" prop="id" width="100" /> 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 <el-table-column label="创建者" align="center" prop="createBy" width="100" /> 33 <el-table-column label="创建者" align="center" prop="createBy" width="100" />
74 <el-table-column label="创建时间" align="center" prop="createTime" width="100"> 34 <el-table-column label="创建时间" align="center" prop="createTime" width="100">
75 <template slot-scope="scope"> 35 <template slot-scope="scope">
@@ -78,31 +38,16 @@ @@ -78,31 +38,16 @@
78 </el-table-column> 38 </el-table-column>
79 <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> 39 <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
80 <template slot-scope="scope"> 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 </template> 45 </template>
96 </el-table-column> 46 </el-table-column>
97 </el-table> 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 <el-dialog :title="title" :visible.sync="open" width="780px" append-to-body> 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,72 +2,28 @@
2 <div class="app-container"> 2 <div class="app-container">
3 <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> 3 <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
4 <el-form-item label="系统模块" prop="title"> 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 </el-form-item> 7 </el-form-item>
14 <el-form-item label="操作人员" prop="operName"> 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 </el-form-item> 11 </el-form-item>
24 <el-form-item label="类型" prop="type"> 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 </el-select> 16 </el-select>
39 </el-form-item> 17 </el-form-item>
40 <el-form-item label="状态" prop="status"> 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 </el-select> 22 </el-select>
59 </el-form-item> 23 </el-form-item>
60 <el-form-item label="操作时间"> 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 </el-form-item> 27 </el-form-item>
72 <el-form-item> 28 <el-form-item>
73 <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> 29 <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
@@ -77,13 +33,8 @@ @@ -77,13 +33,8 @@
77 33
78 <el-row :gutter="10" class="mb8"> 34 <el-row :gutter="10" class="mb8">
79 <el-col :span="1.5"> 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 </el-col> 38 </el-col>
88 <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> 39 <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
89 </el-row> 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,7 +5,6 @@ import cn.iocoder.dashboard.framework.jackson.ser.LocalDateTimeSerializer;
5 import cn.iocoder.dashboard.util.json.JsonUtils; 5 import cn.iocoder.dashboard.util.json.JsonUtils;
6 import com.fasterxml.jackson.databind.ObjectMapper; 6 import com.fasterxml.jackson.databind.ObjectMapper;
7 import com.fasterxml.jackson.databind.module.SimpleModule; 7 import com.fasterxml.jackson.databind.module.SimpleModule;
8 -import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;  
9 import org.springframework.context.annotation.Bean; 8 import org.springframework.context.annotation.Bean;
10 import org.springframework.context.annotation.Configuration; 9 import org.springframework.context.annotation.Configuration;
11 10
@@ -22,8 +21,9 @@ public class JacksonConfig { @@ -22,8 +21,9 @@ public class JacksonConfig {
22 * 1. 新增Long类型序列化规则,数值超过2^53-1,在JS会出现精度丢失问题,因此Long自动序列化为字符串类型 21 * 1. 新增Long类型序列化规则,数值超过2^53-1,在JS会出现精度丢失问题,因此Long自动序列化为字符串类型
23 * 2. 新增LocalDateTime序列化、反序列化规则 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 .addSerializer(LocalDateTime.class, LocalDateTimeSerializer.INSTANCE) 27 .addSerializer(LocalDateTime.class, LocalDateTimeSerializer.INSTANCE)
28 .addDeserializer(LocalDateTime.class, LocalDateTimeDeserializer.INSTANCE); 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,6 +3,7 @@ package cn.iocoder.dashboard.modules.system.controller.logger;
3 import cn.iocoder.dashboard.common.pojo.CommonResult; 3 import cn.iocoder.dashboard.common.pojo.CommonResult;
4 import cn.iocoder.dashboard.common.pojo.PageResult; 4 import cn.iocoder.dashboard.common.pojo.PageResult;
5 import cn.iocoder.dashboard.framework.excel.core.util.ExcelUtils; 5 import cn.iocoder.dashboard.framework.excel.core.util.ExcelUtils;
  6 +import cn.iocoder.dashboard.framework.logger.operatelog.core.annotations.OperateLog;
6 import cn.iocoder.dashboard.modules.system.controller.logger.vo.loginlog.SysLoginLogExcelVO; 7 import cn.iocoder.dashboard.modules.system.controller.logger.vo.loginlog.SysLoginLogExcelVO;
7 import cn.iocoder.dashboard.modules.system.controller.logger.vo.loginlog.SysLoginLogExportReqVO; 8 import cn.iocoder.dashboard.modules.system.controller.logger.vo.loginlog.SysLoginLogExportReqVO;
8 import cn.iocoder.dashboard.modules.system.controller.logger.vo.loginlog.SysLoginLogPageReqVO; 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,6 +13,7 @@ import cn.iocoder.dashboard.modules.system.dal.dataobject.logger.SysLoginLogDO;
12 import cn.iocoder.dashboard.modules.system.service.logger.SysLoginLogService; 13 import cn.iocoder.dashboard.modules.system.service.logger.SysLoginLogService;
13 import io.swagger.annotations.Api; 14 import io.swagger.annotations.Api;
14 import io.swagger.annotations.ApiOperation; 15 import io.swagger.annotations.ApiOperation;
  16 +import org.springframework.security.access.prepost.PreAuthorize;
15 import org.springframework.validation.annotation.Validated; 17 import org.springframework.validation.annotation.Validated;
16 import org.springframework.web.bind.annotation.GetMapping; 18 import org.springframework.web.bind.annotation.GetMapping;
17 import org.springframework.web.bind.annotation.RequestMapping; 19 import org.springframework.web.bind.annotation.RequestMapping;
@@ -19,36 +21,39 @@ import org.springframework.web.bind.annotation.RestController; @@ -19,36 +21,39 @@ import org.springframework.web.bind.annotation.RestController;
19 21
20 import javax.annotation.Resource; 22 import javax.annotation.Resource;
21 import javax.servlet.http.HttpServletResponse; 23 import javax.servlet.http.HttpServletResponse;
  24 +import javax.validation.Valid;
22 import java.io.IOException; 25 import java.io.IOException;
23 import java.util.List; 26 import java.util.List;
24 27
  28 +import static cn.iocoder.dashboard.framework.logger.operatelog.core.enums.OperateTypeEnum.EXPORT;
  29 +
25 @Api(tags = "登陆日志") 30 @Api(tags = "登陆日志")
26 @RestController 31 @RestController
27 @RequestMapping("/system/login-log") 32 @RequestMapping("/system/login-log")
  33 +@Validated
28 public class SysLoginLogController { 34 public class SysLoginLogController {
29 35
30 @Resource 36 @Resource
31 private SysLoginLogService loginLogService; 37 private SysLoginLogService loginLogService;
32 38
33 - @ApiOperation("获得登陆日志分页列表")  
34 @GetMapping("/page") 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 PageResult<SysLoginLogDO> page = loginLogService.getLoginLogPage(reqVO); 43 PageResult<SysLoginLogDO> page = loginLogService.getLoginLogPage(reqVO);
38 return CommonResult.success(SysLoginLogConvert.INSTANCE.convertPage(page)); 44 return CommonResult.success(SysLoginLogConvert.INSTANCE.convertPage(page));
39 } 45 }
40 46
41 - @ApiOperation("导出登陆日志 Excel")  
42 @GetMapping("/export") 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 List<SysLoginLogDO> list = loginLogService.getLoginLogList(reqVO); 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,8 +4,6 @@ import cn.iocoder.dashboard.common.pojo.CommonResult;
4 import cn.iocoder.dashboard.common.pojo.PageResult; 4 import cn.iocoder.dashboard.common.pojo.PageResult;
5 import cn.iocoder.dashboard.framework.excel.core.util.ExcelUtils; 5 import cn.iocoder.dashboard.framework.excel.core.util.ExcelUtils;
6 import cn.iocoder.dashboard.framework.logger.operatelog.core.annotations.OperateLog; 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 import cn.iocoder.dashboard.modules.system.controller.logger.vo.operatelog.SysOperateLogExcelVO; 7 import cn.iocoder.dashboard.modules.system.controller.logger.vo.operatelog.SysOperateLogExcelVO;
10 import cn.iocoder.dashboard.modules.system.controller.logger.vo.operatelog.SysOperateLogExportReqVO; 8 import cn.iocoder.dashboard.modules.system.controller.logger.vo.operatelog.SysOperateLogExportReqVO;
11 import cn.iocoder.dashboard.modules.system.controller.logger.vo.operatelog.SysOperateLogPageReqVO; 9 import cn.iocoder.dashboard.modules.system.controller.logger.vo.operatelog.SysOperateLogPageReqVO;
@@ -19,6 +17,7 @@ import cn.iocoder.dashboard.util.collection.CollectionUtils; @@ -19,6 +17,7 @@ import cn.iocoder.dashboard.util.collection.CollectionUtils;
19 import cn.iocoder.dashboard.util.collection.MapUtils; 17 import cn.iocoder.dashboard.util.collection.MapUtils;
20 import io.swagger.annotations.Api; 18 import io.swagger.annotations.Api;
21 import io.swagger.annotations.ApiOperation; 19 import io.swagger.annotations.ApiOperation;
  20 +import org.springframework.security.access.prepost.PreAuthorize;
22 import org.springframework.validation.annotation.Validated; 21 import org.springframework.validation.annotation.Validated;
23 import org.springframework.web.bind.annotation.GetMapping; 22 import org.springframework.web.bind.annotation.GetMapping;
24 import org.springframework.web.bind.annotation.RequestMapping; 23 import org.springframework.web.bind.annotation.RequestMapping;
@@ -26,6 +25,7 @@ import org.springframework.web.bind.annotation.RestController; @@ -26,6 +25,7 @@ import org.springframework.web.bind.annotation.RestController;
26 25
27 import javax.annotation.Resource; 26 import javax.annotation.Resource;
28 import javax.servlet.http.HttpServletResponse; 27 import javax.servlet.http.HttpServletResponse;
  28 +import javax.validation.Valid;
29 import java.io.IOException; 29 import java.io.IOException;
30 import java.util.ArrayList; 30 import java.util.ArrayList;
31 import java.util.Collection; 31 import java.util.Collection;
@@ -38,32 +38,18 @@ import static cn.iocoder.dashboard.framework.logger.operatelog.core.enums.Operat @@ -38,32 +38,18 @@ import static cn.iocoder.dashboard.framework.logger.operatelog.core.enums.Operat
38 @Api(tags = "操作日志") 38 @Api(tags = "操作日志")
39 @RestController 39 @RestController
40 @RequestMapping("/system/operate-log") 40 @RequestMapping("/system/operate-log")
  41 +@Validated
41 public class SysOperateLogController { 42 public class SysOperateLogController {
42 43
43 @Resource 44 @Resource
44 private SysOperateLogService operateLogService; 45 private SysOperateLogService operateLogService;
45 -  
46 @Resource 46 @Resource
47 private SysUserService userService; 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 @GetMapping("/page") 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 PageResult<SysOperateLogDO> pageResult = operateLogService.pageOperateLog(reqVO); 53 PageResult<SysOperateLogDO> pageResult = operateLogService.pageOperateLog(reqVO);
68 54
69 // 获得拼接需要的数据 55 // 获得拼接需要的数据
@@ -82,10 +68,9 @@ public class SysOperateLogController { @@ -82,10 +68,9 @@ public class SysOperateLogController {
82 68
83 @ApiOperation("导出操作日志") 69 @ApiOperation("导出操作日志")
84 @GetMapping("/export") 70 @GetMapping("/export")
  71 + @PreAuthorize("@ss.hasPermission('system:operate-log:export')")
85 @OperateLog(type = EXPORT) 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 List<SysOperateLogDO> list = operateLogService.listOperateLogs(reqVO); 74 List<SysOperateLogDO> list = operateLogService.listOperateLogs(reqVO);
90 75
91 // 获得拼接需要的数据 76 // 获得拼接需要的数据
@@ -94,8 +79,7 @@ public class SysOperateLogController { @@ -94,8 +79,7 @@ public class SysOperateLogController {
94 // 拼接数据 79 // 拼接数据
95 List<SysOperateLogExcelVO> excelDataList = SysOperateLogConvert.INSTANCE.convertList(list, userMap); 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,62 +11,62 @@ import cn.iocoder.dashboard.modules.system.service.notice.SysNoticeService;
11 import io.swagger.annotations.Api; 11 import io.swagger.annotations.Api;
12 import io.swagger.annotations.ApiImplicitParam; 12 import io.swagger.annotations.ApiImplicitParam;
13 import io.swagger.annotations.ApiOperation; 13 import io.swagger.annotations.ApiOperation;
  14 +import org.springframework.security.access.prepost.PreAuthorize;
14 import org.springframework.validation.annotation.Validated; 15 import org.springframework.validation.annotation.Validated;
15 import org.springframework.web.bind.annotation.*; 16 import org.springframework.web.bind.annotation.*;
16 17
17 import javax.annotation.Resource; 18 import javax.annotation.Resource;
  19 +import javax.validation.Valid;
18 20
19 import static cn.iocoder.dashboard.common.pojo.CommonResult.success; 21 import static cn.iocoder.dashboard.common.pojo.CommonResult.success;
20 22
21 @Api(tags = "通知公告") 23 @Api(tags = "通知公告")
22 @RestController 24 @RestController
23 @RequestMapping("/system/notice") 25 @RequestMapping("/system/notice")
  26 +@Validated
24 public class SysNoticeController { 27 public class SysNoticeController {
25 28
26 @Resource 29 @Resource
27 private SysNoticeService noticeService; 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 @PostMapping("/create") 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 Long noticeId = noticeService.createNotice(reqVO); 36 Long noticeId = noticeService.createNotice(reqVO);
50 return success(noticeId); 37 return success(noticeId);
51 } 38 }
52 39
  40 + @PutMapping("/update")
53 @ApiOperation("修改通知公告") 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 noticeService.updateNotice(reqVO); 44 noticeService.updateNotice(reqVO);
59 return success(true); 45 return success(true);
60 } 46 }
61 47
  48 + @DeleteMapping("/delete")
62 @ApiOperation("删除通知公告") 49 @ApiOperation("删除通知公告")
63 @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) 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 public CommonResult<Boolean> deleteNotice(@RequestParam("id") Long id) { 52 public CommonResult<Boolean> deleteNotice(@RequestParam("id") Long id) {
68 noticeService.deleteNotice(id); 53 noticeService.deleteNotice(id);
69 return success(true); 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,22 +12,6 @@ import cn.iocoder.dashboard.modules.system.dal.dataobject.notice.SysNoticeDO;
12 public interface SysNoticeService { 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 * @param reqVO 岗位公告公告信息 17 * @param reqVO 岗位公告公告信息
@@ -48,4 +32,21 @@ public interface SysNoticeService { @@ -48,4 +32,21 @@ public interface SysNoticeService {
48 * @param id 岗位公告公告编号 32 * @param id 岗位公告公告编号
49 */ 33 */
50 void deleteNotice(Long id); 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,16 +28,6 @@ public class SysNoticeServiceImpl implements SysNoticeService {
28 private SysNoticeMapper noticeMapper; 28 private SysNoticeMapper noticeMapper;
29 29
30 @Override 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 public Long createNotice(SysNoticeCreateReqVO reqVO) { 31 public Long createNotice(SysNoticeCreateReqVO reqVO) {
42 SysNoticeDO notice = SysNoticeConvert.INSTANCE.convert(reqVO); 32 SysNoticeDO notice = SysNoticeConvert.INSTANCE.convert(reqVO);
43 noticeMapper.insert(notice); 33 noticeMapper.insert(notice);
@@ -61,6 +51,16 @@ public class SysNoticeServiceImpl implements SysNoticeService { @@ -61,6 +51,16 @@ public class SysNoticeServiceImpl implements SysNoticeService {
61 noticeMapper.deleteById(id); 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 @VisibleForTesting 64 @VisibleForTesting
65 public void checkNoticeExists(Long id) { 65 public void checkNoticeExists(Long id) {
66 if (id == null) { 66 if (id == null) {