整理 logger、notice 的 url

pull/2/head
YunaiV 2021-03-14 21:54:23 +08:00
parent 9f9c63a221
commit 378f5834cc
9 changed files with 121 additions and 279 deletions

View File

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

View File

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

View File

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

View File

@ -5,7 +5,6 @@ import cn.iocoder.dashboard.framework.jackson.ser.LocalDateTimeSerializer;
import cn.iocoder.dashboard.util.json.JsonUtils; import cn.iocoder.dashboard.util.json.JsonUtils;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.module.SimpleModule; 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.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
@ -22,8 +21,9 @@ public class JacksonConfig {
* 1. Long2^53-1JSLong * 1. Long2^53-1JSLong
* 2. LocalDateTime * 2. LocalDateTime
*/ */
simpleModule.addSerializer(Long.class, ToStringSerializer.instance) simpleModule
.addSerializer(Long.TYPE, ToStringSerializer.instance) // .addSerializer(Long.class, ToStringSerializer.instance)
// .addSerializer(Long.TYPE, ToStringSerializer.instance)
.addSerializer(LocalDateTime.class, LocalDateTimeSerializer.INSTANCE) .addSerializer(LocalDateTime.class, LocalDateTimeSerializer.INSTANCE)
.addDeserializer(LocalDateTime.class, LocalDateTimeDeserializer.INSTANCE); .addDeserializer(LocalDateTime.class, LocalDateTimeDeserializer.INSTANCE);

View File

@ -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.CommonResult;
import cn.iocoder.dashboard.common.pojo.PageResult; import cn.iocoder.dashboard.common.pojo.PageResult;
import cn.iocoder.dashboard.framework.excel.core.util.ExcelUtils; 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.SysLoginLogExcelVO;
import cn.iocoder.dashboard.modules.system.controller.logger.vo.loginlog.SysLoginLogExportReqVO; import cn.iocoder.dashboard.modules.system.controller.logger.vo.loginlog.SysLoginLogExportReqVO;
import cn.iocoder.dashboard.modules.system.controller.logger.vo.loginlog.SysLoginLogPageReqVO; 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 cn.iocoder.dashboard.modules.system.service.logger.SysLoginLogService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@ -19,36 +21,39 @@ import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
import static cn.iocoder.dashboard.framework.logger.operatelog.core.enums.OperateTypeEnum.EXPORT;
@Api(tags = "登陆日志") @Api(tags = "登陆日志")
@RestController @RestController
@RequestMapping("/system/login-log") @RequestMapping("/system/login-log")
@Validated
public class SysLoginLogController { public class SysLoginLogController {
@Resource @Resource
private SysLoginLogService loginLogService; private SysLoginLogService loginLogService;
@ApiOperation("获得登陆日志分页列表")
@GetMapping("/page") @GetMapping("/page")
// @PreAuthorize("@ss.hasPermi('system:login-log:query')") @ApiOperation("获得登陆日志分页列表")
public CommonResult<PageResult<SysLoginLogRespVO>> getLoginLogPage(@Validated SysLoginLogPageReqVO reqVO) { @PreAuthorize("@ss.hasPermission('system:login-log:query')")
public CommonResult<PageResult<SysLoginLogRespVO>> getLoginLogPage(@Valid SysLoginLogPageReqVO reqVO) {
PageResult<SysLoginLogDO> page = loginLogService.getLoginLogPage(reqVO); PageResult<SysLoginLogDO> page = loginLogService.getLoginLogPage(reqVO);
return CommonResult.success(SysLoginLogConvert.INSTANCE.convertPage(page)); return CommonResult.success(SysLoginLogConvert.INSTANCE.convertPage(page));
} }
@ApiOperation("导出登陆日志 Excel")
@GetMapping("/export") @GetMapping("/export")
// @Log(title = "登录日志", businessType = BusinessType.EXPORT) @ApiOperation("导出登陆日志 Excel")
// @PreAuthorize("@ss.hasPermi('monitor:logininfor:export')") @PreAuthorize("@ss.hasPermission('system:login-log:export')")
public void exportLoginLog(HttpServletResponse response, @Validated SysLoginLogExportReqVO reqVO) throws IOException { @OperateLog(type = EXPORT)
public void exportLoginLog(HttpServletResponse response, @Valid SysLoginLogExportReqVO reqVO) throws IOException {
List<SysLoginLogDO> list = loginLogService.getLoginLogList(reqVO); List<SysLoginLogDO> list = loginLogService.getLoginLogList(reqVO);
// 拼接数据 // 拼接数据
List<SysLoginLogExcelVO> excelDataList = SysLoginLogConvert.INSTANCE.convertList(list); List<SysLoginLogExcelVO> data = SysLoginLogConvert.INSTANCE.convertList(list);
// 输出 // 输出
ExcelUtils.write(response, "登陆日志.xls", "数据列表", ExcelUtils.write(response, "登陆日志.xls", "数据列表", SysLoginLogExcelVO.class, data);
SysLoginLogExcelVO.class, excelDataList);
} }
} }

View File

@ -4,8 +4,6 @@ import cn.iocoder.dashboard.common.pojo.CommonResult;
import cn.iocoder.dashboard.common.pojo.PageResult; import cn.iocoder.dashboard.common.pojo.PageResult;
import cn.iocoder.dashboard.framework.excel.core.util.ExcelUtils; 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.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.SysOperateLogExcelVO;
import cn.iocoder.dashboard.modules.system.controller.logger.vo.operatelog.SysOperateLogExportReqVO; import cn.iocoder.dashboard.modules.system.controller.logger.vo.operatelog.SysOperateLogExportReqVO;
import cn.iocoder.dashboard.modules.system.controller.logger.vo.operatelog.SysOperateLogPageReqVO; 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 cn.iocoder.dashboard.util.collection.MapUtils;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@ -26,6 +25,7 @@ import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
@ -38,32 +38,18 @@ import static cn.iocoder.dashboard.framework.logger.operatelog.core.enums.Operat
@Api(tags = "操作日志") @Api(tags = "操作日志")
@RestController @RestController
@RequestMapping("/system/operate-log") @RequestMapping("/system/operate-log")
@Validated
public class SysOperateLogController { public class SysOperateLogController {
@Resource @Resource
private SysOperateLogService operateLogService; private SysOperateLogService operateLogService;
@Resource @Resource
private SysUserService userService; 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") @GetMapping("/page")
// @PreAuthorize("@ss.hasPermi('system:operate-log:query')") @ApiOperation("查看操作日志分页列表")
public CommonResult<PageResult<SysOperateLogRespVO>> pageOperateLog(@Validated SysOperateLogPageReqVO reqVO) { @PreAuthorize("@ss.hasPermission('system:operate-log:query')")
public CommonResult<PageResult<SysOperateLogRespVO>> pageOperateLog(@Valid SysOperateLogPageReqVO reqVO) {
PageResult<SysOperateLogDO> pageResult = operateLogService.pageOperateLog(reqVO); PageResult<SysOperateLogDO> pageResult = operateLogService.pageOperateLog(reqVO);
// 获得拼接需要的数据 // 获得拼接需要的数据
@ -82,10 +68,9 @@ public class SysOperateLogController {
@ApiOperation("导出操作日志") @ApiOperation("导出操作日志")
@GetMapping("/export") @GetMapping("/export")
@PreAuthorize("@ss.hasPermission('system:operate-log:export')")
@OperateLog(type = EXPORT) @OperateLog(type = EXPORT)
// @PreAuthorize("@ss.hasPermi('system:operate-log:export')") public void exportOperateLog(HttpServletResponse response, @Valid SysOperateLogExportReqVO reqVO) throws IOException {
public void exportOperateLog(HttpServletResponse response, @Validated SysOperateLogExportReqVO reqVO)
throws IOException {
List<SysOperateLogDO> list = operateLogService.listOperateLogs(reqVO); List<SysOperateLogDO> list = operateLogService.listOperateLogs(reqVO);
// 获得拼接需要的数据 // 获得拼接需要的数据
@ -94,8 +79,7 @@ public class SysOperateLogController {
// 拼接数据 // 拼接数据
List<SysOperateLogExcelVO> excelDataList = SysOperateLogConvert.INSTANCE.convertList(list, userMap); List<SysOperateLogExcelVO> excelDataList = SysOperateLogConvert.INSTANCE.convertList(list, userMap);
// 输出 // 输出
ExcelUtils.write(response, "操作日志.xls", "数据列表", ExcelUtils.write(response, "操作日志.xls", "数据列表", SysOperateLogExcelVO.class, excelDataList);
SysOperateLogExcelVO.class, excelDataList);
} }
} }

View File

@ -11,62 +11,62 @@ import cn.iocoder.dashboard.modules.system.service.notice.SysNoticeService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.validation.Valid;
import static cn.iocoder.dashboard.common.pojo.CommonResult.success; import static cn.iocoder.dashboard.common.pojo.CommonResult.success;
@Api(tags = "通知公告") @Api(tags = "通知公告")
@RestController @RestController
@RequestMapping("/system/notice") @RequestMapping("/system/notice")
@Validated
public class SysNoticeController { public class SysNoticeController {
@Resource @Resource
private SysNoticeService noticeService; 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") @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); Long noticeId = noticeService.createNotice(reqVO);
return success(noticeId); return success(noticeId);
} }
@PutMapping("/update")
@ApiOperation("修改通知公告") @ApiOperation("修改通知公告")
// @PreAuthorize("@ss.hasPermi('system:notice:edit')") @PreAuthorize("@ss.hasPermission('system:notice:update')")
// @Log(title = "通知公告", businessType = BusinessType.UPDATE) public CommonResult<Boolean> updateNotice(@Valid @RequestBody SysNoticeUpdateReqVO reqVO) {
@PostMapping("/update")
public CommonResult<Boolean> updateNotice(@Validated @RequestBody SysNoticeUpdateReqVO reqVO) {
noticeService.updateNotice(reqVO); noticeService.updateNotice(reqVO);
return success(true); return success(true);
} }
@DeleteMapping("/delete")
@ApiOperation("删除通知公告") @ApiOperation("删除通知公告")
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
// @PreAuthorize("@ss.hasPermi('system:notice:remove')") @PreAuthorize("@ss.hasPermission('system:notice:delete')")
// @Log(title = "通知公告", businessType = BusinessType.DELETE)
@PostMapping("/delete")
public CommonResult<Boolean> deleteNotice(@RequestParam("id") Long id) { public CommonResult<Boolean> deleteNotice(@RequestParam("id") Long id) {
noticeService.deleteNotice(id); noticeService.deleteNotice(id);
return success(true); 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)));
}
} }

View File

@ -11,22 +11,6 @@ import cn.iocoder.dashboard.modules.system.dal.dataobject.notice.SysNoticeDO;
*/ */
public interface SysNoticeService { 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 * @param id
*/ */
void deleteNotice(Long id); void deleteNotice(Long id);
/**
*
*
* @param reqVO
* @return
*/
PageResult<SysNoticeDO> pageNotices(SysNoticePageReqVO reqVO);
/**
*
*
* @param id
* @return
*/
SysNoticeDO getNotice(Long id);
} }

View File

@ -27,16 +27,6 @@ public class SysNoticeServiceImpl implements SysNoticeService {
@Resource @Resource
private SysNoticeMapper noticeMapper; 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 @Override
public Long createNotice(SysNoticeCreateReqVO reqVO) { public Long createNotice(SysNoticeCreateReqVO reqVO) {
SysNoticeDO notice = SysNoticeConvert.INSTANCE.convert(reqVO); SysNoticeDO notice = SysNoticeConvert.INSTANCE.convert(reqVO);
@ -61,6 +51,16 @@ public class SysNoticeServiceImpl implements SysNoticeService {
noticeMapper.deleteById(id); 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 @VisibleForTesting
public void checkNoticeExists(Long id) { public void checkNoticeExists(Long id) {
if (id == null) { if (id == null) {