From aeb379749ad10eabd54086e93231228a48c69843 Mon Sep 17 00:00:00 2001
From: mitao <2763622819@qq.com>
Date: 星期一, 12 八月 2024 18:35:02 +0800
Subject: [PATCH] 修改bug
---
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/AgreementController.java | 48 +++++++++++++++++++++++++++++++++++++++---------
1 files changed, 39 insertions(+), 9 deletions(-)
diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/AgreementController.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/AgreementController.java
index 67b808d..c5d1970 100644
--- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/AgreementController.java
+++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/AgreementController.java
@@ -2,17 +2,22 @@
import com.ruoyi.common.core.domain.R;
+import com.ruoyi.common.core.utils.page.BeanUtils;
import com.ruoyi.system.domain.Agreement;
+import com.ruoyi.system.domain.dto.AgreementDTO;
import com.ruoyi.system.service.IAgreementService;
+import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-
-import org.springframework.web.bind.annotation.ResponseBody;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.annotation.Resource;
import java.util.List;
+import javax.annotation.Resource;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
/**
* <p>
@@ -24,13 +29,38 @@
*/
@RestController
@RequestMapping("/agreement")
+@Api(tags = "系统管理相关接口")
public class AgreementController {
@Resource
private IAgreementService iAgreementService;
- @RequestMapping("/getAgreement")
- @ResponseBody
+
+ @RequestMapping(value = "/getAgreement/{agreementType}", method = RequestMethod.GET)
@ApiOperation(value = "获取用户协议/隐私协议")
public R<Agreement> getAgreement(@PathVariable("agreementType") Integer agreementType) {
return R.ok(iAgreementService.getAgreement(agreementType));
}
+
+ /**
+ * 管理后台-获取协议列表
+ *
+ * @return List<AgreementDTO>
+ */
+ @ApiOperation("管理后台-获取协议列表")
+ @GetMapping("/list")
+ public R<List<AgreementDTO>> getAgreementList() {
+ List<Agreement> list = iAgreementService.lambdaQuery().last("limit 2").list();
+ return R.ok(BeanUtils.copyList(list, AgreementDTO.class));
+ }
+
+ /**
+ * 保存协议
+ *
+ * @param dto 协议对象
+ */
+ @ApiOperation(value = "管理后台-保存用户协议", notes = "接收一个包含多个AgreementDTO的列表")
+ @PostMapping("/save")
+ public R<?> saveAgreement(@Validated @RequestBody AgreementDTO dto) {
+ iAgreementService.saveAgreement(dto);
+ return R.ok();
+ }
}
--
Gitblit v1.7.1