添加log依赖

This commit is contained in:
syruan 2024-08-09 13:20:23 +08:00
parent 069dc08cf4
commit 69068dea81
4 changed files with 80 additions and 60 deletions

View File

@ -9,13 +9,11 @@ import java.lang.annotation.*;
* 自定义操作日志记录注解
*
* @author bonus
*
*/
@Target({ElementType.PARAMETER, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface SysLog
{
public @interface SysLog {
/**
* 模块
*/
@ -23,15 +21,18 @@ public @interface SysLog
/**
* 业务类型 默认 0 系统日志 1 业务日志 2 异常日志
*
* @return
*/
public int logType() default 1;
/**
* 操作模块
*
* @return
*/
public String module();
/**
* 功能 ->新增修改删除
*/

View File

@ -2,54 +2,30 @@ package com.bonus.common.log.enums;
/**
* 操作类型
*
* @author 黑子
*/
public class OperaType {
/**
* 备份
*/
public final static String COPY_LOG = "备份";
/**
* 查询
*/
public final static String QUERY = "查询";
/**
* 修改
*/
public final static String UPDATE = "修改";
/**
* 新增"
*/
public final static String INSERT = "新增";
/**
* 删除
*/
public final static String DELETE = "删除";
/**
* 删除
*/
public final static String DOWNLOAD = "下载";
/**
* 导出
*/
public final static String EXPORT = "导出";
public final static String GRANT = "授权";
/**
* 下载
*/
public final static String IMPORT = "导入";
/**
* 其他
*/
public final static String OTHER = "其他";
/**
* 其他
*/
public final static String FLASH = "刷新";
}

View File

@ -77,6 +77,10 @@
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.bonus</groupId>
<artifactId>bonus-common-log</artifactId>
</dependency>
</dependencies>
<build>

View File

@ -1,6 +1,8 @@
package com.bonus.base.controller;
import com.bonus.base.domain.BmProject;
import com.bonus.base.service.BmProjectService;
import com.bonus.base.utils.ResultBean;
import com.bonus.common.core.web.controller.BaseController;
import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;
@ -8,11 +10,12 @@ import org.springframework.beans.factory.annotation.Autowired;
/**
* 工程项目管理(bm_project)表控制层
*
* @author xxxxx
* @author 阮世耀
*/
@RestController
@RequestMapping("/bm_project")
public class BmProjectController {
public class BmProjectController extends BaseController {
/**
* 服务对象
*/
@ -25,9 +28,45 @@ public class BmProjectController {
* @param id 主键
* @return 单条数据
*/
@GetMapping("selectOne")
public BmProject selectOne(Integer id) {
return bmProjectService.selectByPrimaryKey(id);
@GetMapping("{id}")
public ResultBean<BmProject> queryById(@PathVariable("id") Integer id) {
return ResultBean.success(this.bmProjectService.selectByPrimaryKey(id));
}
/**
* 新增数据
*
* @param obj 实体
* @return 新增结果
*/
@PostMapping(value = "/add")
public ResultBean<Boolean> add(BmProject obj) {
int result = this.bmProjectService.insertSelective(obj);
return result > 0 ? ResultBean.success(true) : ResultBean.error(0, "增加失败");
}
/**
* 修改数据
*
* @param obj 实体
* @return 编辑结果
*/
@PutMapping(value = "/update")
public ResultBean<Boolean> edit(BmProject obj) {
this.bmProjectService.updateByPrimaryKeySelective(obj);
return ResultBean.success(true);
}
/**
* 删除数据
*
* @param id 主键
* @return 删除是否成功
*/
@PostMapping(value = "/delete/{id}")
public ResultBean<Boolean> deleteById(@PathVariable("id") Integer id) {
this.bmProjectService.deleteByPrimaryKey(id);
return ResultBean.success(true);
}
}