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

This commit is contained in:
xierz 2020-12-22 14:46:23 +08:00
parent 493aba326a
commit 00fce71ab5
4 changed files with 17 additions and 1 deletions

View File

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

View File

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

View File

@ -219,6 +219,7 @@
<if test="contentTitle != null and contentTitle != ''"> and content_title like CONCAT(CONCAT('%',#{contentTitle}),'%')</if> <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 <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> (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="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="contentDisplay != null and contentDisplay != ''"> and content_display=#{contentDisplay}</if>
<if test="contentAuthor != null and contentAuthor != ''"> and content_author=#{contentAuthor}</if> <if test="contentAuthor != null and contentAuthor != ''"> and content_author=#{contentAuthor}</if>

View File

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