| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- package com.xunmei.system.controller;
- import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
- import com.xunmei.common.core.web.domain.AjaxResult;
- import com.xunmei.common.security.annotation.InnerAuth;
- import io.swagger.annotations.ApiImplicitParam;
- import io.swagger.annotations.ApiImplicitParams;
- import org.springframework.web.bind.annotation.*;
- import com.xunmei.system.service.IOperLogService;
- import com.xunmei.system.domain.OperLog;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import org.slf4j.Logger;
- import org.slf4j.LoggerFactory;
- import static com.xunmei.common.core.web.domain.AjaxResult.success;
- import static com.xunmei.common.core.web.domain.AjaxResult.error;
- import javax.annotation.Resource;
- import com.xunmei.common.security.annotation.RequiresPermissions;
- import org.springframework.web.bind.annotation.RestController;
- /**
- * <p>
- * OperLogController 前端控制器
- * </p>
- *
- * @author gaoxiong
- * @since 2023-08-04
- */
- @Api(tags = {"OperLogController"})
- @RestController
- @RequestMapping("/operLog")
- public class OperLogController {
- private Logger log = LoggerFactory.getLogger(getClass());
- @Resource
- private IOperLogService operLogService;
- @ApiOperation(value = "新增操作日志记录")
- @InnerAuth
- @PostMapping
- public AjaxResult add(@RequestBody OperLog operLog){
- try {
- return operLogService.add(operLog);
- } catch (Exception e) {
- log.error(e.getMessage(), e);
- return error();
- }
- }
- @ApiOperation(value = "删除操作日志记录")
- @RequiresPermissions("system:operLog:delete")
- @DeleteMapping("/{id}")
- public AjaxResult delete(@PathVariable("id") Long id){
- try {
- return operLogService.delete(id);
- } catch (Exception e) {
- log.error(e.getMessage(), e);
- return error();
- }
- }
- @ApiOperation(value = "更新操作日志记录")
- @RequiresPermissions("system:operLog:update")
- @PutMapping("/update")
- public AjaxResult update(@RequestBody OperLog operLog){
- try {
- return operLogService.updateData(operLog);
- } catch (Exception e) {
- log.error(e.getMessage(), e);
- return error();
- }
- }
- @ApiOperation(value = "查询操作日志记录分页数据")
- @RequiresPermissions("system:operLog:findByPage")
- @GetMapping("/findByPage")
- public AjaxResult findListByPage(Page<OperLog> page,OperLog operLog){
- try {
- return operLogService.findListByPage(page, operLog);
- } catch (Exception e) {
- log.error(e.getMessage(), e);
- return error();
- }
- }
- @ApiOperation(value = "id查询操作日志记录")
- @RequiresPermissions("system:operLog:findById")
- @GetMapping("/{id}")
- public AjaxResult findById(@PathVariable Long id){
- try {
- return operLogService.findById(id);
- } catch (Exception e) {
- log.error(e.getMessage(), e);
- return error();
- }
- }
- }
|