Ver código fonte

95:红德堂APP调试

获取文章分类列表添加状态参数
Long 1 dia atrás
pai
commit
787e9e14be

+ 5 - 2
fs-service/src/main/java/com/fs/his/mapper/FsArticleCateMapper.java

@@ -1,8 +1,11 @@
 package com.fs.his.mapper;
 
 import java.util.List;
+import java.util.Map;
+
 import com.fs.his.domain.FsArticleCate;
 import com.fs.his.vo.OptionsVO;
+import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 
 /**
@@ -63,6 +66,6 @@ public interface FsArticleCateMapper
 
     @Select("select cate_id dictValue,cate_name dictLabel FROM fs_article_cate")
     List<OptionsVO> selectFsArticleCateAllList();
-    @Select("select * FROM fs_article_cate where is_del=0")
-    List<FsArticleCate> selectFsArticleCateAllListVO();
+
+    List<FsArticleCate> selectFsArticleCateAllListVO(@Param("params") Map<String, Object> params);
 }

+ 3 - 1
fs-service/src/main/java/com/fs/his/service/IFsArticleCateService.java

@@ -1,6 +1,8 @@
 package com.fs.his.service;
 
 import java.util.List;
+import java.util.Map;
+
 import com.fs.his.domain.FsArticleCate;
 import com.fs.his.vo.OptionsVO;
 
@@ -62,6 +64,6 @@ public interface IFsArticleCateService
 
     List<OptionsVO> selectFsArticleCateAllList();
 
-    List<FsArticleCate> selectFsArticleCateAllListVO();
+    List<FsArticleCate> selectFsArticleCateAllListVO(Map<String, Object> params);
 
 }

+ 3 - 3
fs-service/src/main/java/com/fs/his/service/impl/FsArticleCateServiceImpl.java

@@ -1,7 +1,7 @@
 package com.fs.his.service.impl;
 
-import java.util.Collections;
 import java.util.List;
+import java.util.Map;
 
 import com.fs.his.vo.OptionsVO;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -100,8 +100,8 @@ public class FsArticleCateServiceImpl implements IFsArticleCateService
     }
 
     @Override
-    public List<FsArticleCate> selectFsArticleCateAllListVO() {
+    public List<FsArticleCate> selectFsArticleCateAllListVO(Map<String, Object> params) {
 
-       return fsArticleCateMapper.selectFsArticleCateAllListVO();
+       return fsArticleCateMapper.selectFsArticleCateAllListVO(params);
     }
 }

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

@@ -33,6 +33,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where cate_id = #{cateId}
     </select>
 
+    <select id="selectFsArticleCateAllListVO" resultType="com.fs.his.domain.FsArticleCate">
+        select * FROM fs_article_cate where is_del=0
+        <if test="params.status != null">
+            and status = #{params.status}
+        </if>
+    </select>
+
     <insert id="insertFsArticleCate" parameterType="FsArticleCate" useGeneratedKeys="true" keyProperty="cateId">
         insert into fs_article_cate
         <trim prefix="(" suffix=")" suffixOverrides=",">

+ 7 - 4
fs-user-app/src/main/java/com/fs/app/controller/ArticleController.java

@@ -26,7 +26,9 @@ import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.servlet.http.HttpServletRequest;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 
 @Api("文章接口")
@@ -41,12 +43,13 @@ public class ArticleController {
 	@Autowired
 	private IFsArticleCateService articleCateService;
 
-	@Cacheable(value="getArticleCateList")
+	@Cacheable(value="getArticleCateList", key = "#status")
 	@ApiOperation("获取文章分类列表")
 	@GetMapping("/getArticleCateList")
-	public R getArticleCateList(){
-
-		List<FsArticleCate> list=articleCateService.selectFsArticleCateAllListVO();
+	public R getArticleCateList(@RequestParam(required = false) Integer status){
+		Map<String,Object> params = new HashMap<>();
+		params.put("status", status);
+		List<FsArticleCate> list=articleCateService.selectFsArticleCateAllListVO(params);
 		return R.ok().put("data",list);
 	}
 	@ApiOperation("获取文章列表")