Browse Source

Merge remote-tracking branch 'origin/master'

yfh 2 weeks ago
parent
commit
c03a9cceb4

+ 23 - 4
fs-admin/src/main/java/com/fs/his/controller/FsArticleCateController.java

@@ -1,7 +1,9 @@
 package com.fs.his.controller;
 
+import java.util.Collection;
 import java.util.List;
 
+import com.fs.common.core.redis.RedisCache;
 import com.fs.his.vo.OptionsVO;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -24,7 +26,7 @@ import com.fs.common.core.page.TableDataInfo;
 
 /**
  * 文章分类Controller
- * 
+ *
  * @author fs
  * @date 2023-07-04
  */
@@ -34,6 +36,8 @@ public class FsArticleCateController extends BaseController
 {
     @Autowired
     private IFsArticleCateService fsArticleCateService;
+    @Autowired
+    RedisCache redisCache;
 
     /**
      * 查询文章分类列表
@@ -78,7 +82,12 @@ public class FsArticleCateController extends BaseController
     @PostMapping
     public AjaxResult add(@RequestBody FsArticleCate fsArticleCate)
     {
-        return toAjax(fsArticleCateService.insertFsArticleCate(fsArticleCate));
+        int i = fsArticleCateService.insertFsArticleCate(fsArticleCate);
+        Collection<String> keys = redisCache.keys("getArticleCateList*");
+        for (String key : keys) {
+            redisCache.deleteObject(key);
+        }
+        return toAjax(i);
     }
 
     /**
@@ -89,7 +98,12 @@ public class FsArticleCateController extends BaseController
     @PutMapping
     public AjaxResult edit(@RequestBody FsArticleCate fsArticleCate)
     {
-        return toAjax(fsArticleCateService.updateFsArticleCate(fsArticleCate));
+        int i = fsArticleCateService.updateFsArticleCate(fsArticleCate);
+        Collection<String> keys = redisCache.keys("getArticleCateList*");
+        for (String key : keys) {
+            redisCache.deleteObject(key);
+        }
+        return toAjax(i);
     }
 
     /**
@@ -100,7 +114,12 @@ public class FsArticleCateController extends BaseController
 	@DeleteMapping("/{cateIds}")
     public AjaxResult remove(@PathVariable Long[] cateIds)
     {
-        return toAjax(fsArticleCateService.deleteFsArticleCateByCateIds(cateIds));
+        int i = fsArticleCateService.deleteFsArticleCateByCateIds(cateIds);
+        Collection<String> keys = redisCache.keys("getArticleCateList*");
+        for (String key : keys) {
+            redisCache.deleteObject(key);
+        }
+        return toAjax(i);
     }
 
     /**

+ 1 - 0
fs-service/src/main/resources/mapper/his/FsArticleCateMapper.xml

@@ -38,6 +38,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="params.status != null">
             and status = #{params.status}
         </if>
+        order by sort asc
     </select>
 
     <insert id="insertFsArticleCate" parameterType="FsArticleCate" useGeneratedKeys="true" keyProperty="cateId">