Bläddra i källkod

整理 logger、notice 的 url

YunaiV 4 år sedan
förälder
incheckning
378f5834cc

+ 14 - 58
ruoyi-ui/src/views/system/loginlog/index.vue

@@ -2,56 +2,22 @@
   <div class="app-container">
     <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
       <el-form-item label="登录地址" prop="userIp">
-        <el-input
-          v-model="queryParams.userIp"
-          placeholder="请输入登录地址"
-          clearable
-          style="width: 240px;"
-          size="small"
-          @keyup.enter.native="handleQuery"
-        />
+        <el-input v-model="queryParams.userIp" placeholder="请输入登录地址" clearable style="width: 240px;" size="small"
+                  @keyup.enter.native="handleQuery"/>
       </el-form-item>
       <el-form-item label="用户名称" prop="username">
-        <el-input
-          v-model="queryParams.username"
-          placeholder="请输入用户名称"
-          clearable
-          style="width: 240px;"
-          size="small"
-          @keyup.enter.native="handleQuery"
-        />
+        <el-input v-model="queryParams.username" placeholder="请输入用户名称" clearable style="width: 240px;" size="small"
+                  @keyup.enter.native="handleQuery"/>
       </el-form-item>
       <el-form-item label="状态" prop="status">
-        <el-select
-          v-model="queryParams.status"
-          placeholder="结果"
-          clearable
-          size="small"
-          style="width: 240px"
-        >
-          <el-option
-              :key="true"
-              label="成功"
-              :value="true"
-          />
-          <el-option
-              :key="false"
-              label="失败"
-              :value="false"
-          />
+        <el-select v-model="queryParams.status" placeholder="结果" clearable size="small" style="width: 240px">
+          <el-option :key="true" label="成功" :value="true"/>
+          <el-option :key="false" label="失败" :value="false"/>
         </el-select>
       </el-form-item>
       <el-form-item label="登录时间">
-        <el-date-picker
-          v-model="dateRange"
-          size="small"
-          style="width: 240px"
-          value-format="yyyy-MM-dd"
-          type="daterange"
-          range-separator="-"
-          start-placeholder="开始日期"
-          end-placeholder="结束日期"
-        ></el-date-picker>
+        <el-date-picker v-model="dateRange" size="small" style="width: 240px" value-format="yyyy-MM-dd"
+          type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
       </el-form-item>
       <el-form-item>
         <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
@@ -61,13 +27,8 @@
 
     <el-row :gutter="10" class="mb8">
       <el-col :span="1.5">
-        <el-button
-          type="warning"
-          icon="el-icon-download"
-          size="mini"
-          @click="handleExport"
-          v-hasPermi="['system:login-log:export']"
-        >导出</el-button>
+        <el-button type="warning" icon="el-icon-download" size="mini" @click="handleExport"
+                   v-hasPermi="['system:login-log:export']">导出</el-button>
       </el-col>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
@@ -76,7 +37,7 @@
       <el-table-column label="访问编号" align="center" prop="id" />
       <el-table-column label="日志类型" align="center" prop="logType">
         <template slot-scope="scope">
-          <span>{{ scope.row.logType === 1 ? '登录' : '退出' }}</span>
+          <span>{{ scope.row.logType === 100 ? '登录' : '退出' }}</span>
         </template>
       </el-table-column>
       <el-table-column label="用户名称" align="center" prop="username" />
@@ -95,13 +56,8 @@
       </el-table-column>
     </el-table>
 
-    <pagination
-      v-show="total>0"
-      :total="total"
-      :page.sync="queryParams.pageNo"
-      :limit.sync="queryParams.pageSize"
-      @pagination="getList"
-    />
+    <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
+                @pagination="getList"/>
   </div>
 </template>
 

+ 13 - 68
ruoyi-ui/src/views/system/notice/index.vue

@@ -2,31 +2,14 @@
   <div class="app-container">
     <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
       <el-form-item label="公告标题" prop="title">
-        <el-input
-          v-model="queryParams.title"
-          placeholder="请输入公告标题"
-          clearable
-          size="small"
-          @keyup.enter.native="handleQuery"
-        />
+        <el-input v-model="queryParams.title" placeholder="请输入公告标题" clearable size="small" @keyup.enter.native="handleQuery"/>
       </el-form-item>
       <el-form-item label="操作人员" prop="createBy">
-        <el-input
-          v-model="queryParams.createBy"
-          placeholder="请输入操作人员"
-          clearable
-          size="small"
-          @keyup.enter.native="handleQuery"
-        />
+        <el-input v-model="queryParams.createBy" placeholder="请输入操作人员" clearable size="small" @keyup.enter.native="handleQuery"/>
       </el-form-item>
       <el-form-item label="类型" prop="type">
         <el-select v-model="queryParams.type" placeholder="公告类型" clearable size="small">
-          <el-option
-              v-for="dict in noticeTypeDictDatas"
-              :key="parseInt(dict.value)"
-              :label="dict.label"
-              :value="parseInt(dict.value)"
-          />
+          <el-option v-for="dict in noticeTypeDictDatas" :key="parseInt(dict.value)" :label="dict.label" :value="parseInt(dict.value)"/>
         </el-select>
       </el-form-item>
       <el-form-item>
@@ -37,39 +20,16 @@
 
     <el-row :gutter="10" class="mb8">
       <el-col :span="1.5">
-        <el-button
-          type="primary"
-          icon="el-icon-plus"
-          size="mini"
-          @click="handleAdd"
-          v-hasPermi="['system:notice:add']"
-        >新增</el-button>
+        <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['system:notice:create']"s>新增</el-button>
       </el-col>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
     <el-table v-loading="loading" :data="noticeList">
       <el-table-column label="序号" align="center" prop="id" width="100" />
-      <el-table-column
-        label="公告标题"
-        align="center"
-        prop="title"
-        :show-overflow-tooltip="true"
-      />
-      <el-table-column
-        label="公告类型"
-        align="center"
-        prop="type"
-        :formatter="typeFormat"
-        width="100"
-      />
-      <el-table-column
-        label="状态"
-        align="center"
-        prop="status"
-        :formatter="statusFormat"
-        width="100"
-      />
+      <el-table-column label="公告标题" align="center" prop="title" :show-overflow-tooltip="true"/>
+      <el-table-column label="公告类型" align="center" prop="type" :formatter="typeFormat" width="100"/>
+      <el-table-column label="状态" align="center" prop="status" :formatter="statusFormat" width="100"/>
       <el-table-column label="创建者" align="center" prop="createBy" width="100" />
       <el-table-column label="创建时间" align="center" prop="createTime" width="100">
         <template slot-scope="scope">
@@ -78,31 +38,16 @@
       </el-table-column>
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
-          <el-button
-            size="mini"
-            type="text"
-            icon="el-icon-edit"
-            @click="handleUpdate(scope.row)"
-            v-hasPermi="['system:notice:edit']"
-          >修改</el-button>
-          <el-button
-            size="mini"
-            type="text"
-            icon="el-icon-delete"
-            @click="handleDelete(scope.row)"
-            v-hasPermi="['system:notice:remove']"
-          >删除</el-button>
+          <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
+                     v-hasPermi="['system:notice:update']">修改</el-button>
+          <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
+                     v-hasPermi="['system:notice:delete']">删除</el-button>
         </template>
       </el-table-column>
     </el-table>
 
-    <pagination
-      v-show="total>0"
-      :total="total"
-      :page.sync="queryParams.pageNo"
-      :limit.sync="queryParams.pageSize"
-      @pagination="getList"
-    />
+    <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
+                @pagination="getList"/>
 
     <!-- 添加或修改公告对话框 -->
     <el-dialog :title="title" :visible.sync="open" width="780px" append-to-body>

+ 14 - 63
ruoyi-ui/src/views/system/operatelog/index.vue

@@ -2,72 +2,28 @@
   <div class="app-container">
     <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
       <el-form-item label="系统模块" prop="title">
-        <el-input
-          v-model="queryParams.title"
-          placeholder="请输入系统模块"
-          clearable
-          style="width: 240px;"
-          size="small"
-          @keyup.enter.native="handleQuery"
-        />
+        <el-input v-model="queryParams.title" placeholder="请输入系统模块" clearable style="width: 240px;" size="small"
+                  @keyup.enter.native="handleQuery"/>
       </el-form-item>
       <el-form-item label="操作人员" prop="operName">
-        <el-input
-          v-model="queryParams.operName"
-          placeholder="请输入操作人员"
-          clearable
-          style="width: 240px;"
-          size="small"
-          @keyup.enter.native="handleQuery"
-        />
+        <el-input v-model="queryParams.operName" placeholder="请输入操作人员" clearable style="width: 240px;" size="small"
+                  @keyup.enter.native="handleQuery"/>
       </el-form-item>
       <el-form-item label="类型" prop="type">
-        <el-select
-          v-model="queryParams.type"
-          placeholder="操作类型"
-          clearable
-          size="small"
-          style="width: 240px"
-        >
-          <el-option
-            v-for="dict in this.getDictDatas(DICT_TYPE.SYS_OPERATE_TYPE)"
-            :key="parseInt(dict.value)"
-            :label="dict.label"
-            :value="parseInt(dict.value)"
-          />
+        <el-select v-model="queryParams.type" placeholder="操作类型" clearable size="small" style="width: 240px">
+          <el-option v-for="dict in this.getDictDatas(DICT_TYPE.SYS_OPERATE_TYPE)" :key="parseInt(dict.value)"
+                     :label="dict.label" :value="parseInt(dict.value)"/>
         </el-select>
       </el-form-item>
       <el-form-item label="状态" prop="status">
-        <el-select
-          v-model="queryParams.success"
-          placeholder="操作状态"
-          clearable
-          size="small"
-          style="width: 240px"
-        >
-          <el-option
-              :key="true"
-              label="成功"
-              :value="true"
-          />
-          <el-option
-              :key="false"
-              label="失败"
-              :value="false"
-          />
+        <el-select v-model="queryParams.success" placeholder="操作状态" clearable size="small" style="width: 240px">
+          <el-option :key="true" label="成功" :value="true"/>
+          <el-option :key="false" label="失败" :value="false"/>
         </el-select>
       </el-form-item>
       <el-form-item label="操作时间">
-        <el-date-picker
-          v-model="dateRange"
-          size="small"
-          style="width: 240px"
-          value-format="yyyy-MM-dd"
-          type="daterange"
-          range-separator="-"
-          start-placeholder="开始日期"
-          end-placeholder="结束日期"
-        ></el-date-picker>
+        <el-date-picker v-model="dateRange" size="small" style="width: 240px" value-format="yyyy-MM-dd"
+          type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
       </el-form-item>
       <el-form-item>
         <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
@@ -77,13 +33,8 @@
 
     <el-row :gutter="10" class="mb8">
       <el-col :span="1.5">
-        <el-button
-          type="warning"
-          icon="el-icon-download"
-          size="mini"
-          @click="handleExport"
-          v-hasPermi="['system:config:export']"
-        >导出</el-button>
+        <el-button type="warning" icon="el-icon-download" size="mini" @click="handleExport"
+                   v-hasPermi="['system:operate-log:export']">导出</el-button>
       </el-col>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>

+ 3 - 3
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);
 

+ 15 - 10
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<PageResult<SysLoginLogRespVO>> getLoginLogPage(@Validated SysLoginLogPageReqVO reqVO) {
+    @ApiOperation("获得登陆日志分页列表")
+    @PreAuthorize("@ss.hasPermission('system:login-log:query')")
+    public CommonResult<PageResult<SysLoginLogRespVO>> getLoginLogPage(@Valid SysLoginLogPageReqVO reqVO) {
         PageResult<SysLoginLogDO> 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<SysLoginLogDO> list = loginLogService.getLoginLogList(reqVO);
         // 拼接数据
-        List<SysLoginLogExcelVO> excelDataList = SysLoginLogConvert.INSTANCE.convertList(list);
+        List<SysLoginLogExcelVO> data = SysLoginLogConvert.INSTANCE.convertList(list);
         // 输出
-        ExcelUtils.write(response, "登陆日志.xls", "数据列表",
-                SysLoginLogExcelVO.class, excelDataList);
+        ExcelUtils.write(response, "登陆日志.xls", "数据列表", SysLoginLogExcelVO.class, data);
     }
 
 }

+ 9 - 25
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<Boolean> 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<PageResult<SysOperateLogRespVO>> pageOperateLog(@Validated SysOperateLogPageReqVO reqVO) {
+    @ApiOperation("查看操作日志分页列表")
+    @PreAuthorize("@ss.hasPermission('system:operate-log:query')")
+    public CommonResult<PageResult<SysOperateLogRespVO>> pageOperateLog(@Valid SysOperateLogPageReqVO reqVO) {
         PageResult<SysOperateLogDO> 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<SysOperateLogDO> list = operateLogService.listOperateLogs(reqVO);
 
         // 获得拼接需要的数据
@@ -94,8 +79,7 @@ public class SysOperateLogController {
         // 拼接数据
         List<SysOperateLogExcelVO> excelDataList = SysOperateLogConvert.INSTANCE.convertList(list, userMap);
         // 输出
-        ExcelUtils.write(response, "操作日志.xls", "数据列表",
-                SysOperateLogExcelVO.class, excelDataList);
+        ExcelUtils.write(response, "操作日志.xls", "数据列表", SysOperateLogExcelVO.class, excelDataList);
     }
 
 }

+ 26 - 26
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<PageResult<SysNoticeRespVO>> 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<SysNoticeRespVO> 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<Long> createNotice(@Validated @RequestBody SysNoticeCreateReqVO reqVO) {
+    @ApiOperation("创建通知公告")
+    @PreAuthorize("@ss.hasPermission('system:notice:create')")
+    public CommonResult<Long> 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<Boolean> updateNotice(@Validated @RequestBody SysNoticeUpdateReqVO reqVO) {
+    @PreAuthorize("@ss.hasPermission('system:notice:update')")
+    public CommonResult<Boolean> 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<Boolean> deleteNotice(@RequestParam("id") Long id) {
         noticeService.deleteNotice(id);
         return success(true);
     }
 
+    @GetMapping("/page")
+    @ApiOperation("获取通知公告列表")
+    @PreAuthorize("@ss.hasPermission('system:notice:quey')")
+    public CommonResult<PageResult<SysNoticeRespVO>> 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<SysNoticeRespVO> getNotice(@RequestParam("id") Long id) {
+        return success(SysNoticeConvert.INSTANCE.convert(noticeService.getNotice(id)));
+    }
+
 }

+ 17 - 16
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<SysNoticeDO> 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<SysNoticeDO> pageNotices(SysNoticePageReqVO reqVO);
+
+    /**
+     * 获得岗位公告公告信息
+     *
+     * @param id 岗位公告公告编号
+     * @return 岗位公告公告信息
+     */
+    SysNoticeDO getNotice(Long id);
+
 }

+ 10 - 10
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<SysNoticeDO> 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<SysNoticeDO> 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) {