Quellcode durchsuchen

文章列表根据栏目类型进行筛选

xierz vor 4 Jahren
Ursprung
Commit
00fce71ab5

+ 2 - 1
src/main/java/net/mingsoft/cms/action/ContentAction.java

@@ -31,6 +31,7 @@ import net.mingsoft.basic.bean.EUListBean;
 import net.mingsoft.basic.constant.e.BusinessTypeEnum;
 import net.mingsoft.basic.util.BasicUtil;
 import net.mingsoft.basic.util.StringUtil;
+import net.mingsoft.cms.bean.ContentBean;
 import net.mingsoft.cms.biz.IContentBiz;
 import net.mingsoft.cms.entity.ContentEntity;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
@@ -108,7 +109,7 @@ public class ContentAction extends BaseAction {
     })
 	@RequestMapping("/list")
 	@ResponseBody
-	public ResultData list(@ModelAttribute @ApiIgnore ContentEntity content, HttpServletResponse response, HttpServletRequest request, @ApiIgnore ModelMap model, BindingResult result) {
+	public ResultData list(@ModelAttribute @ApiIgnore ContentBean content, HttpServletResponse response, HttpServletRequest request, @ApiIgnore ModelMap model, BindingResult result) {
 		BasicUtil.startPage();
 		List contentList = contentBiz.query(content);
 		return ResultData.build().success(new EUListBean(contentList,(int) BasicUtil.endPage(contentList).getTotal()));

+ 11 - 0
src/main/java/net/mingsoft/cms/bean/ContentBean.java

@@ -57,7 +57,18 @@ public class ContentBean extends ContentEntity {
      */
     private String noflag;
 
+    /**
+     * 栏目类型,用于筛选文章列表
+     */
+    private String categoryType;
 
+    public String getCategoryType() {
+        return categoryType;
+    }
+
+    public void setCategoryType(String categoryType) {
+        this.categoryType = categoryType;
+    }
 
     public String getBeginTime() {
         return beginTime;

+ 1 - 0
src/main/java/net/mingsoft/cms/dao/IContentDao.xml

@@ -219,6 +219,7 @@
 			<if test="contentTitle != null and contentTitle != ''"> and  content_title like CONCAT(CONCAT('%',#{contentTitle}),'%')</if>
 			<if test="categoryId != null and categoryId != ''"> 	and (ct.category_id=#{categoryId} or ct.category_id in
 				(select id FROM cms_category where find_in_set('${categoryId}',CATEGORY_PARENT_IDS)>0))</if>
+			<if test="categoryType != null and categoryType != ''">and cc.category_type=#{categoryType}</if>
 			<if test="contentType != null and contentType != ''"> and content_type LIKE CONCAT(CONCAT('%',#{contentType}),'%')</if>
 			<if test="contentDisplay != null and contentDisplay != ''"> and content_display=#{contentDisplay}</if>
 			<if test="contentAuthor != null and contentAuthor != ''"> and content_author=#{contentAuthor}</if>

+ 3 - 0
src/main/webapp/WEB-INF/manager/cms/content/main.ftl

@@ -297,7 +297,10 @@
                     form: form,
                     page: page
                 }, "");
+                //筛选栏目类型,1=列表
+                that.form.categoryType = '1';
                 ms.http.post(ms.manager + "/cms/content/list.do", form.sqlWhere ? Object.assign({}, {
+                    categoryType: '1',
                     sqlWhere: form.sqlWhere
                 }, page) : Object.assign({}, that.form, page)).then(function (res) {
                     if (that.loadState) {