diff --git a/ruoyi-ui/src/views/system/loginlog/index.vue b/ruoyi-ui/src/views/system/loginlog/index.vue
index 601c9420f..5e572aa94 100644
--- a/ruoyi-ui/src/views/system/loginlog/index.vue
+++ b/ruoyi-ui/src/views/system/loginlog/index.vue
@@ -2,56 +2,22 @@
-
+
-
+
-
-
-
+
+
+
-
+
搜索
@@ -61,13 +27,8 @@
- 导出
+ 导出
@@ -76,7 +37,7 @@
- {{ scope.row.logType === 1 ? '登录' : '退出' }}
+ {{ scope.row.logType === 100 ? '登录' : '退出' }}
@@ -95,13 +56,8 @@
-
+
diff --git a/ruoyi-ui/src/views/system/notice/index.vue b/ruoyi-ui/src/views/system/notice/index.vue
index bc46b0d1b..30f17bcf2 100644
--- a/ruoyi-ui/src/views/system/notice/index.vue
+++ b/ruoyi-ui/src/views/system/notice/index.vue
@@ -2,31 +2,14 @@
-
+
-
+
-
+
@@ -37,39 +20,16 @@
- 新增
+ 新增
-
-
-
+
+
+
@@ -78,31 +38,16 @@
- 修改
- 删除
+ 修改
+ 删除
-
+
diff --git a/ruoyi-ui/src/views/system/operatelog/index.vue b/ruoyi-ui/src/views/system/operatelog/index.vue
index 0ba07c6c8..8833a749e 100644
--- a/ruoyi-ui/src/views/system/operatelog/index.vue
+++ b/ruoyi-ui/src/views/system/operatelog/index.vue
@@ -2,72 +2,28 @@
-
+
-
+
-
-
+
+
-
-
-
+
+
+
-
+
搜索
@@ -77,13 +33,8 @@
- 导出
+ 导出
diff --git a/src/main/java/cn/iocoder/dashboard/framework/jackson/config/JacksonConfig.java b/src/main/java/cn/iocoder/dashboard/framework/jackson/config/JacksonConfig.java
index 483d956f8..5a263ca58 100644
--- a/src/main/java/cn/iocoder/dashboard/framework/jackson/config/JacksonConfig.java
+++ b/src/main/java/cn/iocoder/dashboard/framework/jackson/config/JacksonConfig.java
@@ -5,7 +5,6 @@ import cn.iocoder.dashboard.framework.jackson.ser.LocalDateTimeSerializer;
import cn.iocoder.dashboard.util.json.JsonUtils;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.module.SimpleModule;
-import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -22,8 +21,9 @@ public class JacksonConfig {
* 1. 新增Long类型序列化规则,数值超过2^53-1,在JS会出现精度丢失问题,因此Long自动序列化为字符串类型
* 2. 新增LocalDateTime序列化、反序列化规则
*/
- simpleModule.addSerializer(Long.class, ToStringSerializer.instance)
- .addSerializer(Long.TYPE, ToStringSerializer.instance)
+ simpleModule
+// .addSerializer(Long.class, ToStringSerializer.instance)
+// .addSerializer(Long.TYPE, ToStringSerializer.instance)
.addSerializer(LocalDateTime.class, LocalDateTimeSerializer.INSTANCE)
.addDeserializer(LocalDateTime.class, LocalDateTimeDeserializer.INSTANCE);
diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/SysLoginLogController.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/SysLoginLogController.java
index 00f5b7205..21159ab74 100644
--- a/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/SysLoginLogController.java
+++ b/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/SysLoginLogController.java
@@ -3,6 +3,7 @@ package cn.iocoder.dashboard.modules.system.controller.logger;
import cn.iocoder.dashboard.common.pojo.CommonResult;
import cn.iocoder.dashboard.common.pojo.PageResult;
import cn.iocoder.dashboard.framework.excel.core.util.ExcelUtils;
+import cn.iocoder.dashboard.framework.logger.operatelog.core.annotations.OperateLog;
import cn.iocoder.dashboard.modules.system.controller.logger.vo.loginlog.SysLoginLogExcelVO;
import cn.iocoder.dashboard.modules.system.controller.logger.vo.loginlog.SysLoginLogExportReqVO;
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;
import cn.iocoder.dashboard.modules.system.service.logger.SysLoginLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
+import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -19,36 +21,39 @@ import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
+import javax.validation.Valid;
import java.io.IOException;
import java.util.List;
+import static cn.iocoder.dashboard.framework.logger.operatelog.core.enums.OperateTypeEnum.EXPORT;
+
@Api(tags = "登陆日志")
@RestController
@RequestMapping("/system/login-log")
+@Validated
public class SysLoginLogController {
@Resource
private SysLoginLogService loginLogService;
- @ApiOperation("获得登陆日志分页列表")
@GetMapping("/page")
-// @PreAuthorize("@ss.hasPermi('system:login-log:query')")
- public CommonResult> getLoginLogPage(@Validated SysLoginLogPageReqVO reqVO) {
+ @ApiOperation("获得登陆日志分页列表")
+ @PreAuthorize("@ss.hasPermission('system:login-log:query')")
+ public CommonResult> getLoginLogPage(@Valid SysLoginLogPageReqVO reqVO) {
PageResult page = loginLogService.getLoginLogPage(reqVO);
return CommonResult.success(SysLoginLogConvert.INSTANCE.convertPage(page));
}
- @ApiOperation("导出登陆日志 Excel")
@GetMapping("/export")
-// @Log(title = "登录日志", businessType = BusinessType.EXPORT)
-// @PreAuthorize("@ss.hasPermi('monitor:logininfor:export')")
- public void exportLoginLog(HttpServletResponse response, @Validated SysLoginLogExportReqVO reqVO) throws IOException {
+ @ApiOperation("导出登陆日志 Excel")
+ @PreAuthorize("@ss.hasPermission('system:login-log:export')")
+ @OperateLog(type = EXPORT)
+ public void exportLoginLog(HttpServletResponse response, @Valid SysLoginLogExportReqVO reqVO) throws IOException {
List list = loginLogService.getLoginLogList(reqVO);
// 拼接数据
- List excelDataList = SysLoginLogConvert.INSTANCE.convertList(list);
+ List data = SysLoginLogConvert.INSTANCE.convertList(list);
// 输出
- ExcelUtils.write(response, "登陆日志.xls", "数据列表",
- SysLoginLogExcelVO.class, excelDataList);
+ ExcelUtils.write(response, "登陆日志.xls", "数据列表", SysLoginLogExcelVO.class, data);
}
}
diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/SysOperateLogController.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/SysOperateLogController.java
index 939d8b607..42cbef57a 100644
--- a/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/SysOperateLogController.java
+++ b/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/SysOperateLogController.java
@@ -4,8 +4,6 @@ import cn.iocoder.dashboard.common.pojo.CommonResult;
import cn.iocoder.dashboard.common.pojo.PageResult;
import cn.iocoder.dashboard.framework.excel.core.util.ExcelUtils;
import cn.iocoder.dashboard.framework.logger.operatelog.core.annotations.OperateLog;
-import cn.iocoder.dashboard.framework.logger.operatelog.core.enums.OperateTypeEnum;
-import cn.iocoder.dashboard.framework.logger.operatelog.core.util.OperateLogUtils;
import cn.iocoder.dashboard.modules.system.controller.logger.vo.operatelog.SysOperateLogExcelVO;
import cn.iocoder.dashboard.modules.system.controller.logger.vo.operatelog.SysOperateLogExportReqVO;
import cn.iocoder.dashboard.modules.system.controller.logger.vo.operatelog.SysOperateLogPageReqVO;
@@ -19,6 +17,7 @@ import cn.iocoder.dashboard.util.collection.CollectionUtils;
import cn.iocoder.dashboard.util.collection.MapUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
+import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -26,6 +25,7 @@ import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
+import javax.validation.Valid;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
@@ -38,32 +38,18 @@ import static cn.iocoder.dashboard.framework.logger.operatelog.core.enums.Operat
@Api(tags = "操作日志")
@RestController
@RequestMapping("/system/operate-log")
+@Validated
public class SysOperateLogController {
@Resource
private SysOperateLogService operateLogService;
-
@Resource
private SysUserService userService;
- @ApiOperation("示例")
- @OperateLog(type = OperateTypeEnum.OTHER)
- @GetMapping("/demo")
- public CommonResult demo() {
- // 这里可以调用业务逻辑
-
- // 补全操作日志的明细
- OperateLogUtils.setContent("将编号 1 的数据,xxx 字段修改成了 yyyy");
- OperateLogUtils.addExt("orderId", 1);
-
- // 响应
- return success(true);
- }
-
- @ApiOperation("查看操作日志分页列表")
@GetMapping("/page")
-// @PreAuthorize("@ss.hasPermi('system:operate-log:query')")
- public CommonResult> pageOperateLog(@Validated SysOperateLogPageReqVO reqVO) {
+ @ApiOperation("查看操作日志分页列表")
+ @PreAuthorize("@ss.hasPermission('system:operate-log:query')")
+ public CommonResult> pageOperateLog(@Valid SysOperateLogPageReqVO reqVO) {
PageResult pageResult = operateLogService.pageOperateLog(reqVO);
// 获得拼接需要的数据
@@ -82,10 +68,9 @@ public class SysOperateLogController {
@ApiOperation("导出操作日志")
@GetMapping("/export")
+ @PreAuthorize("@ss.hasPermission('system:operate-log:export')")
@OperateLog(type = EXPORT)
-// @PreAuthorize("@ss.hasPermi('system:operate-log:export')")
- public void exportOperateLog(HttpServletResponse response, @Validated SysOperateLogExportReqVO reqVO)
- throws IOException {
+ public void exportOperateLog(HttpServletResponse response, @Valid SysOperateLogExportReqVO reqVO) throws IOException {
List list = operateLogService.listOperateLogs(reqVO);
// 获得拼接需要的数据
@@ -94,8 +79,7 @@ public class SysOperateLogController {
// 拼接数据
List excelDataList = SysOperateLogConvert.INSTANCE.convertList(list, userMap);
// 输出
- ExcelUtils.write(response, "操作日志.xls", "数据列表",
- SysOperateLogExcelVO.class, excelDataList);
+ ExcelUtils.write(response, "操作日志.xls", "数据列表", SysOperateLogExcelVO.class, excelDataList);
}
}
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 da23d1bfe..8a3f17032 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
@@ -11,62 +11,62 @@ import cn.iocoder.dashboard.modules.system.service.notice.SysNoticeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
+import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
+import javax.validation.Valid;
import static cn.iocoder.dashboard.common.pojo.CommonResult.success;
@Api(tags = "通知公告")
@RestController
@RequestMapping("/system/notice")
+@Validated
public class SysNoticeController {
@Resource
private SysNoticeService noticeService;
- @ApiOperation("获取通知公告列表")
- @GetMapping("/page")
-// @PreAuthorize("@ss.hasPermi('system:notice:list')")
- public CommonResult> pageNotices(@Validated SysNoticePageReqVO reqVO) {
- return success(SysNoticeConvert.INSTANCE.convertPage(noticeService.pageNotices(reqVO)));
- }
-
- @ApiOperation("获得通知公告")
- @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) {
- return success(SysNoticeConvert.INSTANCE.convert(noticeService.getNotice(id)));
- }
-
- @ApiOperation("新增通知公告")
-// @PreAuthorize("@ss.hasPermi('system:notice:add')")
-// @Log(title = "通知公告", businessType = BusinessType.INSERT)
@PostMapping("/create")
- public CommonResult createNotice(@Validated @RequestBody SysNoticeCreateReqVO reqVO) {
+ @ApiOperation("创建通知公告")
+ @PreAuthorize("@ss.hasPermission('system:notice:create')")
+ public CommonResult createNotice(@Valid @RequestBody SysNoticeCreateReqVO reqVO) {
Long noticeId = noticeService.createNotice(reqVO);
return success(noticeId);
}
+ @PutMapping("/update")
@ApiOperation("修改通知公告")
-// @PreAuthorize("@ss.hasPermi('system:notice:edit')")
-// @Log(title = "通知公告", businessType = BusinessType.UPDATE)
- @PostMapping("/update")
- public CommonResult updateNotice(@Validated @RequestBody SysNoticeUpdateReqVO reqVO) {
+ @PreAuthorize("@ss.hasPermission('system:notice:update')")
+ public CommonResult updateNotice(@Valid @RequestBody SysNoticeUpdateReqVO reqVO) {
noticeService.updateNotice(reqVO);
return success(true);
}
+ @DeleteMapping("/delete")
@ApiOperation("删除通知公告")
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
-// @PreAuthorize("@ss.hasPermi('system:notice:remove')")
-// @Log(title = "通知公告", businessType = BusinessType.DELETE)
- @PostMapping("/delete")
+ @PreAuthorize("@ss.hasPermission('system:notice:delete')")
public CommonResult deleteNotice(@RequestParam("id") Long id) {
noticeService.deleteNotice(id);
return success(true);
}
+ @GetMapping("/page")
+ @ApiOperation("获取通知公告列表")
+ @PreAuthorize("@ss.hasPermission('system:notice:quey')")
+ public CommonResult> pageNotices(@Validated SysNoticePageReqVO reqVO) {
+ return success(SysNoticeConvert.INSTANCE.convertPage(noticeService.pageNotices(reqVO)));
+ }
+
+ @GetMapping("/get")
+ @ApiOperation("获得通知公告")
+ @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
+ @PreAuthorize("@ss.hasPermission('system:notice:quey')")
+ public CommonResult getNotice(@RequestParam("id") Long id) {
+ return success(SysNoticeConvert.INSTANCE.convert(noticeService.getNotice(id)));
+ }
+
}
diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/service/notice/SysNoticeService.java b/src/main/java/cn/iocoder/dashboard/modules/system/service/notice/SysNoticeService.java
index 6663060a9..37a92267b 100644
--- a/src/main/java/cn/iocoder/dashboard/modules/system/service/notice/SysNoticeService.java
+++ b/src/main/java/cn/iocoder/dashboard/modules/system/service/notice/SysNoticeService.java
@@ -11,22 +11,6 @@ import cn.iocoder.dashboard.modules.system.dal.dataobject.notice.SysNoticeDO;
*/
public interface SysNoticeService {
- /**
- * 获得岗位公告公告分页列表
- *
- * @param reqVO 分页条件
- * @return 部门分页列表
- */
- PageResult pageNotices(SysNoticePageReqVO reqVO);
-
- /**
- * 获得岗位公告公告信息
- *
- * @param id 岗位公告公告编号
- * @return 岗位公告公告信息
- */
- SysNoticeDO getNotice(Long id);
-
/**
* 创建岗位公告公告
*
@@ -48,4 +32,21 @@ public interface SysNoticeService {
* @param id 岗位公告公告编号
*/
void deleteNotice(Long id);
+
+ /**
+ * 获得岗位公告公告分页列表
+ *
+ * @param reqVO 分页条件
+ * @return 部门分页列表
+ */
+ PageResult pageNotices(SysNoticePageReqVO reqVO);
+
+ /**
+ * 获得岗位公告公告信息
+ *
+ * @param id 岗位公告公告编号
+ * @return 岗位公告公告信息
+ */
+ SysNoticeDO getNotice(Long id);
+
}
diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/service/notice/impl/SysNoticeServiceImpl.java b/src/main/java/cn/iocoder/dashboard/modules/system/service/notice/impl/SysNoticeServiceImpl.java
index b2e083f78..502f43c3b 100644
--- a/src/main/java/cn/iocoder/dashboard/modules/system/service/notice/impl/SysNoticeServiceImpl.java
+++ b/src/main/java/cn/iocoder/dashboard/modules/system/service/notice/impl/SysNoticeServiceImpl.java
@@ -27,16 +27,6 @@ public class SysNoticeServiceImpl implements SysNoticeService {
@Resource
private SysNoticeMapper noticeMapper;
- @Override
- public PageResult pageNotices(SysNoticePageReqVO reqVO) {
- return noticeMapper.selectPage(reqVO);
- }
-
- @Override
- public SysNoticeDO getNotice(Long id) {
- return noticeMapper.selectById(id);
- }
-
@Override
public Long createNotice(SysNoticeCreateReqVO reqVO) {
SysNoticeDO notice = SysNoticeConvert.INSTANCE.convert(reqVO);
@@ -61,6 +51,16 @@ public class SysNoticeServiceImpl implements SysNoticeService {
noticeMapper.deleteById(id);
}
+ @Override
+ public PageResult pageNotices(SysNoticePageReqVO reqVO) {
+ return noticeMapper.selectPage(reqVO);
+ }
+
+ @Override
+ public SysNoticeDO getNotice(Long id) {
+ return noticeMapper.selectById(id);
+ }
+
@VisibleForTesting
public void checkNoticeExists(Long id) {
if (id == null) {