Browse Source

新增查询条件

cy 3 years ago
parent
commit
a574d6c5ed

+ 5 - 3
cms/src/main/java/com/ym/mec/cms/controller/NewsController.java

@@ -2,6 +2,7 @@ package com.ym.mec.cms.controller;
 
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 
 import java.util.ArrayList;
@@ -185,9 +186,10 @@ public class NewsController extends BaseController {
 	}
 
 	@ApiOperation("查询资讯详情")
-	@ApiImplicitParam(name = "id", value = "资讯ID编号", required = true, dataType = "Long")
+	@ApiImplicitParams({@ApiImplicitParam(name = "id", value = "资讯ID编号", required = true, dataType = "Long"),
+						@ApiImplicitParam(name = "memo", value = "版本号",  dataType = "String") })
 	@GetMapping("/list/tree")
-	public Object listWithTree(Integer id) {
-		return succeed(sysNewsTypeService.listWithTree(id));
+	public Object listWithTree(Integer id,String memo) {
+		return succeed(sysNewsTypeService.listWithTree(id,memo));
 	}
 }

+ 2 - 0
cms/src/main/java/com/ym/mec/cms/dal/dao/SysNewsInformationDao.java

@@ -35,4 +35,6 @@ public interface SysNewsInformationDao extends BaseDAO<Long, SysNewsInformation>
 	List<SysNewsInformation> queryNeedUpdateStatusList();
 	
 	SysNewsInformationDto queryById(Long id);
+
+	List<SysNewsInformation> queryBySubType(@Param("subType") Integer subType,@Param("memo") String memo);
 }

+ 1 - 1
cms/src/main/java/com/ym/mec/cms/service/SysNewsTypeService.java

@@ -13,5 +13,5 @@ public interface SysNewsTypeService extends BaseService<Integer, SysNewsType> {
 	//根据父级查询子集
 	List<SysNewsTypeTree> queryByParentId(Integer parentId);
 
-	List<SysNewsType> listWithTree(Integer id);
+	List<SysNewsType> listWithTree(Integer id,String memo);
 }

+ 2 - 2
cms/src/main/java/com/ym/mec/cms/service/impl/SysNewsTypeServiceImpl.java

@@ -51,12 +51,12 @@ public class SysNewsTypeServiceImpl extends BaseServiceImpl<Integer, SysNewsType
         return sysNewsTypeDao.queryByParentId(parentId);
     }
 
-    public List<SysNewsType> listWithTree(Integer id) {
+    public List<SysNewsType> listWithTree(Integer id,String memo) {
         SysNewsType newsType = sysNewsTypeDao.get(id);
         List<SysNewsType> all = sysNewsTypeDao.findAll(null);
 
         all.forEach(e -> {
-            List<SysNewsInformation> list = informationDao.queryByType(null,e.getId());
+            List<SysNewsInformation> list = informationDao.queryBySubType(e.getId(),memo);
             if (CollectionUtils.isNotEmpty(list)) {
                 e.setInformationList(list);
             }

+ 11 - 0
cms/src/main/resources/config/mybatis/SysNewsInformationMapper.xml

@@ -306,4 +306,15 @@
 		left join sys_news_type snts on sni.sub_type_ = snts.id_
 		where sni.id_ = #{id}
 	</select>
+	<select id="queryBySubType" resultMap="SysNewsInformation">
+		SELECT * FROM sys_news_information
+		WHERE del_flag_=0
+		AND status_=1
+		<if test="subType != null">
+			AND sub_type_ = #{subType}
+		</if>
+		<if test="memo != null and memo !=''">
+			AND memo_ = #{memo}
+		</if>
+	</select>
 </mapper>