master
ck 5 years ago
parent bd3bb75a8d
commit a709715328

@ -16,8 +16,7 @@ public interface ArticleMapper extends CommonMapper<Article> {
List<ArticleVo> getArticleListByCondition(@Param("title") String title, List<ArticleVo> getArticleListByCondition(@Param("title") String title,
@Param("firstCategory") Long firstCategory, @Param("firstCategory") Long firstCategory,
@Param("secondCategory") Long secondCategory, @Param("secondCategory") Long secondCategory,
@Param("fileType") Integer fileType, @Param("fileType") Integer fileType);
@Param("state") Integer state);
List<Category> getFirstCategory(); List<Category> getFirstCategory();
List<Category> getSecondCategory(@Param("firstCategory") Long firstCategory); List<Category> getSecondCategory(@Param("firstCategory") Long firstCategory);

@ -127,8 +127,7 @@ public class ArticleSerivceImpl implements ArticleSerive {
Long firstCategory = jsonObject.getLong("firstCategory"); Long firstCategory = jsonObject.getLong("firstCategory");
Long secondCategory = jsonObject.getLong("secondCategory"); Long secondCategory = jsonObject.getLong("secondCategory");
Integer fileType = jsonObject.getInteger("fileType"); Integer fileType = jsonObject.getInteger("fileType");
Integer state = jsonObject.getInteger("state") == null ? 1 : jsonObject.getInteger("state"); List<ArticleVo> CategoryList = articleMapper.getArticleListByCondition(title,firstCategory,secondCategory,fileType);
List<ArticleVo> CategoryList = articleMapper.getArticleListByCondition(title,firstCategory,secondCategory,fileType,state);
JSONObject pageJson = PageUtils.page(CategoryList,pageNum,pageSize); JSONObject pageJson = PageUtils.page(CategoryList,pageNum,pageSize);
return pageJson; return pageJson;
} }

@ -20,7 +20,7 @@
on on
ar.second_category = c2.id and c2.level = 2 ar.second_category = c2.id and c2.level = 2
where where
1 = 1 1 = 1 and (ar.state = 1 OR ar.state = 2)
<if test="title != null and title != ''"> <if test="title != null and title != ''">
and ar.title like #{title} and ar.title like #{title}
</if> </if>
@ -33,9 +33,6 @@
<if test="fileType != null "> <if test="fileType != null ">
and ar.file_type = #{fileType} and ar.file_type = #{fileType}
</if> </if>
<if test="state != null ">
and ar.state = #{state}
</if>
ORDER BY is_recommend Desc ORDER BY is_recommend Desc
</select> </select>

Loading…
Cancel
Save