90 lines
2.5 KiB
Java
90 lines
2.5 KiB
Java
package com.kexue.skills.controller;
|
|
|
|
import com.kexue.skills.entity.SysLog;
|
|
import com.kexue.skills.entity.dto.SysLogDto;
|
|
import com.kexue.skills.service.SysLogService;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
import javax.annotation.Resource;
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.kexue.skills.common.CommonResult;
|
|
import com.kexue.skills.entity.base.IdDto;
|
|
|
|
/**
|
|
* (SysLog)表控制层
|
|
*
|
|
* @author 王志维
|
|
* @since 2025-02-21 23:01:48
|
|
*/
|
|
@RestController
|
|
@RequestMapping("api/sysLog")
|
|
@Tag(name = "系统日志 Api")
|
|
@CrossOrigin(origins = "*")
|
|
public class SysLogController {
|
|
/**
|
|
* 服务对象
|
|
*/
|
|
@Resource
|
|
private SysLogService sysLogService;
|
|
/**
|
|
* 分页查询
|
|
*
|
|
* @param queryDto 筛选条件
|
|
* @return 查询结果
|
|
*/
|
|
@PostMapping("/getPageList")
|
|
@Operation(summary = "查询分页列表", description = "查询分页列表")
|
|
public CommonResult<PageInfo<SysLog>> getPageList(@RequestBody SysLogDto queryDto) {
|
|
return CommonResult.success(sysLogService.getPageList(queryDto));
|
|
}
|
|
|
|
/**
|
|
* 通过主键查询单条数据
|
|
*
|
|
* @param id 主键
|
|
* @return 单条数据
|
|
*/
|
|
@PostMapping("queryById/{id}")
|
|
@Operation(summary = "通过ID查询日志", description = "通过ID查询日志")
|
|
public CommonResult<SysLog> queryById(@PathVariable("id") Long id) {
|
|
return CommonResult.success(sysLogService.queryById(id));
|
|
}
|
|
|
|
/**
|
|
* 新增数据
|
|
*
|
|
* @param SysLog 实体
|
|
* @return 新增结果
|
|
*/
|
|
@PostMapping("/insert")
|
|
@Operation(summary = "新增日志", description = "新增日志")
|
|
public CommonResult<SysLog> insert(@RequestBody SysLog SysLog) {
|
|
return CommonResult.success(sysLogService.insert(SysLog));
|
|
}
|
|
|
|
/**
|
|
* 编辑数据
|
|
*
|
|
* @param SysLog 实体
|
|
* @return 编辑结果
|
|
*/
|
|
@PostMapping("/update")
|
|
@Operation(summary = "更新日志", description = "更新日志")
|
|
public CommonResult<SysLog> update(@RequestBody SysLog SysLog) {
|
|
return CommonResult.success(sysLogService.update(SysLog));
|
|
}
|
|
|
|
/**
|
|
* 删除数据
|
|
*
|
|
* @param id
|
|
* @return 删除数据
|
|
*/
|
|
@PostMapping("deleteById/{id}")
|
|
@Operation(summary = "删除日志", description = "删除日志")
|
|
public CommonResult<Boolean> deleteById(@PathVariable("id") Long id) {
|
|
return CommonResult.success(sysLogService.deleteById(id));
|
|
}
|
|
}
|