添加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

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

View File

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

View File

@ -1,6 +1,8 @@
package com.bonus.base.controller; package com.bonus.base.controller;
import com.bonus.base.domain.BmProject; import com.bonus.base.domain.BmProject;
import com.bonus.base.service.BmProjectService; 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.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -8,26 +10,63 @@ import org.springframework.beans.factory.annotation.Autowired;
/** /**
* 工程项目管理(bm_project)表控制层 * 工程项目管理(bm_project)表控制层
* *
* @author xxxxx * @author 阮世耀
*/ */
@RestController @RestController
@RequestMapping("/bm_project") @RequestMapping("/bm_project")
public class BmProjectController { public class BmProjectController extends BaseController {
/**
* 服务对象 /**
*/ * 服务对象
*/
@Autowired @Autowired
private BmProjectService bmProjectService; private BmProjectService bmProjectService;
/** /**
* 通过主键查询单条数据 * 通过主键查询单条数据
* *
* @param id 主键 * @param id 主键
* @return 单条数据 * @return 单条数据
*/ */
@GetMapping("selectOne") @GetMapping("{id}")
public BmProject selectOne(Integer id) { public ResultBean<BmProject> queryById(@PathVariable("id") Integer id) {
return bmProjectService.selectByPrimaryKey(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);
} }
} }