From c5462d60b99823adb10d9e9eda671920118538f7 Mon Sep 17 00:00:00 2001
From: luodangjia <luodangjia>
Date: 星期四, 12 九月 2024 09:06:35 +0800
Subject: [PATCH] 9.12

---
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/THtmlController.java |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/THtmlController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/THtmlController.java
index 46b995a..e36b5d6 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/THtmlController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/THtmlController.java
@@ -1,6 +1,7 @@
 package com.ruoyi.other.controller;
 
 
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.ruoyi.common.core.web.domain.AjaxResult;
 import com.ruoyi.other.api.domain.THtml;
 import com.ruoyi.other.api.domain.TNotice;
@@ -23,15 +24,24 @@
 public class THtmlController {
     @Resource
     private THtmlService htmlService;
+
+
+
     @ApiOperation(tags = {"后台-内容设置-协议服务"},value = "新增修改")
     @PostMapping(value = "/saveOrUpdate")
     public AjaxResult saveOrUpdate(@RequestBody THtml tHtml) {
-        htmlService.saveOrUpdate(tHtml);
+        THtml one = htmlService.lambdaQuery().eq(THtml::getType, tHtml.getType()).one();
+        if(one!=null){
+            one.setContent(tHtml.getContent());
+            htmlService.updateById(one);
+        }else {
+            htmlService.save(tHtml);
+        }
     return AjaxResult.success();
     }
 
     @ApiOperation(tags = {"后台-内容设置-协议服务"},value = "查询")
-    @PostMapping(value = "/selectByType/{type}")
+    @GetMapping(value = "/selectByType/{type}")
     public AjaxResult selectByType(@PathVariable Integer type) {
         THtml one = htmlService.lambdaQuery().eq(THtml::getType, type).last("limit 1").one();
         return AjaxResult.success(one);

--
Gitblit v1.7.1