From 69068dea81a1240cb60ccabf810da9bf9e9eb27b Mon Sep 17 00:00:00 2001
From: syruan <321359594@qq.com>
Date: Fri, 9 Aug 2024 13:20:23 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0log=E4=BE=9D=E8=B5=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../bonus/common/log/annotation/SysLog.java | 13 ++--
.../com/bonus/common/log/enums/OperaType.java | 58 +++++------------
bonus-modules/bonus-base/pom.xml | 4 ++
.../base/controller/BmProjectController.java | 65 +++++++++++++++----
4 files changed, 80 insertions(+), 60 deletions(-)
diff --git a/bonus-common/bonus-common-log/src/main/java/com/bonus/common/log/annotation/SysLog.java b/bonus-common/bonus-common-log/src/main/java/com/bonus/common/log/annotation/SysLog.java
index 330c6a9..d775631 100644
--- a/bonus-common/bonus-common-log/src/main/java/com/bonus/common/log/annotation/SysLog.java
+++ b/bonus-common/bonus-common-log/src/main/java/com/bonus/common/log/annotation/SysLog.java
@@ -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)
@Documented
-public @interface SysLog
-{
+public @interface SysLog {
/**
* 模块
*/
@@ -23,15 +21,18 @@ public @interface SysLog
/**
* 业务类型 默认 0 系统日志 1 业务日志 2 异常日志
+ *
* @return
*/
- public int logType() default 1;
+ public int logType() default 1;
/**
* 操作模块
+ *
* @return
*/
public String module();
+
/**
* 功能 ->新增、修改、删除
*/
diff --git a/bonus-common/bonus-common-log/src/main/java/com/bonus/common/log/enums/OperaType.java b/bonus-common/bonus-common-log/src/main/java/com/bonus/common/log/enums/OperaType.java
index d93cc5c..fb8442b 100644
--- a/bonus-common/bonus-common-log/src/main/java/com/bonus/common/log/enums/OperaType.java
+++ b/bonus-common/bonus-common-log/src/main/java/com/bonus/common/log/enums/OperaType.java
@@ -2,54 +2,30 @@ package com.bonus.common.log.enums;
/**
* 操作类型
+ *
* @author 黑子
*/
public class OperaType {
+ public final static String COPY_LOG = "备份";
- /**
- * 备份
- */
- public final static String COPY_LOG="备份";
- /**
- * 查询
- */
- public final static String QUERY="查询";
+ 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 UPDATE = "修改";
- /**
- * 导出
- */
- public final static String EXPORT="导出";
+ public final static String INSERT = "新增";
- public final static String GRANT="授权";
- /**
- * 下载
- */
- public final static String IMPORT="导入";
- /**
- * 其他
- */
- public final static String OTHER="其他";
+ public final static String DELETE = "删除";
- /**
- * 其他
- */
- public final static String FLASH="刷新";
+ 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 = "刷新";
}
diff --git a/bonus-modules/bonus-base/pom.xml b/bonus-modules/bonus-base/pom.xml
index 19a3785..74bfee2 100644
--- a/bonus-modules/bonus-base/pom.xml
+++ b/bonus-modules/bonus-base/pom.xml
@@ -77,6 +77,10 @@
lombok
provided
+
+ com.bonus
+ bonus-common-log
+
diff --git a/bonus-modules/bonus-base/src/main/java/com/bonus/base/controller/BmProjectController.java b/bonus-modules/bonus-base/src/main/java/com/bonus/base/controller/BmProjectController.java
index f9fa427..9f7892d 100644
--- a/bonus-modules/bonus-base/src/main/java/com/bonus/base/controller/BmProjectController.java
+++ b/bonus-modules/bonus-base/src/main/java/com/bonus/base/controller/BmProjectController.java
@@ -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,26 +10,63 @@ import org.springframework.beans.factory.annotation.Autowired;
/**
* 工程项目管理(bm_project)表控制层
*
-* @author xxxxx
+* @author 阮世耀
*/
@RestController
@RequestMapping("/bm_project")
-public class BmProjectController {
-/**
-* 服务对象
-*/
+public class BmProjectController extends BaseController {
+
+ /**
+ * 服务对象
+ */
@Autowired
private BmProjectService bmProjectService;
/**
- * 通过主键查询单条数据
- *
- * @param id 主键
- * @return 单条数据
- */
- @GetMapping("selectOne")
- public BmProject selectOne(Integer id) {
- return bmProjectService.selectByPrimaryKey(id);
+ * 通过主键查询单条数据
+ *
+ * @param id 主键
+ * @return 单条数据
+ */
+ @GetMapping("{id}")
+ public ResultBean queryById(@PathVariable("id") Integer id) {
+ return ResultBean.success(this.bmProjectService.selectByPrimaryKey(id));
+ }
+
+ /**
+ * 新增数据
+ *
+ * @param obj 实体
+ * @return 新增结果
+ */
+ @PostMapping(value = "/add")
+ public ResultBean 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 edit(BmProject obj) {
+ this.bmProjectService.updateByPrimaryKeySelective(obj);
+ return ResultBean.success(true);
+ }
+
+ /**
+ * 删除数据
+ *
+ * @param id 主键
+ * @return 删除是否成功
+ */
+ @PostMapping(value = "/delete/{id}")
+ public ResultBean deleteById(@PathVariable("id") Integer id) {
+ this.bmProjectService.deleteByPrimaryKey(id);
+ return ResultBean.success(true);
}
}