Commit b03361cd authored by sgjj's avatar sgjj

恢复标签

parent 765bfd55
...@@ -102,6 +102,7 @@ public class CategoryAction extends BaseAction{ ...@@ -102,6 +102,7 @@ public class CategoryAction extends BaseAction{
@RequestMapping("/list") @RequestMapping("/list")
@ResponseBody @ResponseBody
public ResultData list(@ModelAttribute @ApiIgnore CategoryEntity category,HttpServletResponse response, HttpServletRequest request,@ApiIgnore ModelMap model,BindingResult result) { public ResultData list(@ModelAttribute @ApiIgnore CategoryEntity category,HttpServletResponse response, HttpServletRequest request,@ApiIgnore ModelMap model,BindingResult result) {
category.setAppId(BasicUtil.getAppId());
BasicUtil.startPage(); BasicUtil.startPage();
List categoryList = categoryBiz.query(category); List categoryList = categoryBiz.query(category);
return ResultData.build().success(new EUListBean(categoryList,(int)BasicUtil.endPage(categoryList).getTotal())); return ResultData.build().success(new EUListBean(categoryList,(int)BasicUtil.endPage(categoryList).getTotal()));
...@@ -131,6 +132,7 @@ public class CategoryAction extends BaseAction{ ...@@ -131,6 +132,7 @@ public class CategoryAction extends BaseAction{
if(category.getId()==null) { if(category.getId()==null) {
return ResultData.build().error(); return ResultData.build().error();
} }
category.setAppId(BasicUtil.getAppId());
CategoryEntity _category = (CategoryEntity)categoryBiz.getEntity(Integer.parseInt(category.getId())); CategoryEntity _category = (CategoryEntity)categoryBiz.getEntity(Integer.parseInt(category.getId()));
return ResultData.build().success(_category); return ResultData.build().success(_category);
} }
...@@ -188,6 +190,7 @@ public class CategoryAction extends BaseAction{ ...@@ -188,6 +190,7 @@ public class CategoryAction extends BaseAction{
if(!StringUtil.checkLength(category.getCategoryParentId()+"", 1, 100)){ if(!StringUtil.checkLength(category.getCategoryParentId()+"", 1, 100)){
return ResultData.build().error(getResString("err.length", this.getResString("category.parent.id"), "1", "100")); return ResultData.build().error(getResString("err.length", this.getResString("category.parent.id"), "1", "100"));
} }
category.setAppId(BasicUtil.getAppId());
categoryBiz.saveEntity(category); categoryBiz.saveEntity(category);
return ResultData.build().success(category); return ResultData.build().success(category);
} }
...@@ -262,6 +265,7 @@ public class CategoryAction extends BaseAction{ ...@@ -262,6 +265,7 @@ public class CategoryAction extends BaseAction{
if(!StringUtil.checkLength(category.getCategoryParentId()+"", 0, 100)){ if(!StringUtil.checkLength(category.getCategoryParentId()+"", 0, 100)){
return ResultData.build().error(getResString("err.length", this.getResString("category.parent.id"), "1", "100")); return ResultData.build().error(getResString("err.length", this.getResString("category.parent.id"), "1", "100"));
} }
category.setAppId(BasicUtil.getAppId());
categoryBiz.updateEntity(category); categoryBiz.updateEntity(category);
return ResultData.build().success(category); return ResultData.build().success(category);
} }
......
package net.mingsoft.cms.action; package net.mingsoft.cms.action;
import java.util.List; import java.util.List;
import java.io.File;
import java.util.ArrayList;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson.JSON;
import net.mingsoft.base.entity.ResultData; import net.mingsoft.base.entity.ResultData;
import org.apache.commons.lang3.StringUtils;
import org.springframework.validation.BindingResult; import org.springframework.validation.BindingResult;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.ui.ModelMap; import org.springframework.ui.ModelMap;
...@@ -20,19 +13,15 @@ import org.springframework.stereotype.Controller; ...@@ -20,19 +13,15 @@ import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
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 net.mingsoft.base.util.JSONObject;
import net.mingsoft.base.entity.BaseEntity; import net.mingsoft.base.entity.BaseEntity;
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.base.filter.DateValueFilter;
import net.mingsoft.base.filter.DoubleValueFilter;
import net.mingsoft.basic.bean.EUListBean; import net.mingsoft.basic.bean.EUListBean;
import net.mingsoft.basic.annotation.LogAnn; import net.mingsoft.basic.annotation.LogAnn;
import net.mingsoft.basic.constant.e.BusinessTypeEnum; import net.mingsoft.basic.constant.e.BusinessTypeEnum;
...@@ -105,6 +94,7 @@ public class ContentAction extends BaseAction{ ...@@ -105,6 +94,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 ContentEntity content,HttpServletResponse response, HttpServletRequest request,@ApiIgnore ModelMap model,BindingResult result) {
content.setAppId(BasicUtil.getAppId());
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()));
...@@ -134,6 +124,7 @@ public class ContentAction extends BaseAction{ ...@@ -134,6 +124,7 @@ public class ContentAction extends BaseAction{
if(content.getId()==null) { if(content.getId()==null) {
return ResultData.build().error(); return ResultData.build().error();
} }
content.setAppId(BasicUtil.getAppId());
ContentEntity _content = (ContentEntity)contentBiz.getEntity(Integer.parseInt(content.getId())); ContentEntity _content = (ContentEntity)contentBiz.getEntity(Integer.parseInt(content.getId()));
return ResultData.build().success(_content); return ResultData.build().success(_content);
} }
...@@ -191,6 +182,7 @@ public class ContentAction extends BaseAction{ ...@@ -191,6 +182,7 @@ public class ContentAction extends BaseAction{
if(!StringUtil.checkLength(content.getContentUrl()+"", 0, 200)){ if(!StringUtil.checkLength(content.getContentUrl()+"", 0, 200)){
return ResultData.build().error(getResString("err.length", this.getResString("content.url"), "0", "200")); return ResultData.build().error(getResString("err.length", this.getResString("content.url"), "0", "200"));
} }
content.setAppId(BasicUtil.getAppId());
contentBiz.saveEntity(content); contentBiz.saveEntity(content);
return ResultData.build().success(content); return ResultData.build().success(content);
} }
...@@ -265,6 +257,7 @@ public class ContentAction extends BaseAction{ ...@@ -265,6 +257,7 @@ public class ContentAction extends BaseAction{
if(!StringUtil.checkLength(content.getContentUrl()+"", 0, 200)){ if(!StringUtil.checkLength(content.getContentUrl()+"", 0, 200)){
return ResultData.build().error(getResString("err.length", this.getResString("content.url"), "0", "200")); return ResultData.build().error(getResString("err.length", this.getResString("content.url"), "0", "200"));
} }
content.setAppId(BasicUtil.getAppId());
contentBiz.updateEntity(content); contentBiz.updateEntity(content);
return ResultData.build().success(content); return ResultData.build().success(content);
} }
......
...@@ -24,7 +24,6 @@ package net.mingsoft.cms.action; ...@@ -24,7 +24,6 @@ package net.mingsoft.cms.action;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
...@@ -32,6 +31,9 @@ import javax.servlet.http.HttpServletResponse; ...@@ -32,6 +31,9 @@ import javax.servlet.http.HttpServletResponse;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions; import cn.hutool.core.bean.copier.CopyOptions;
import net.mingsoft.cms.biz.ICategoryBiz;
import net.mingsoft.cms.entity.CategoryEntity;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
...@@ -42,13 +44,9 @@ import org.springframework.web.bind.annotation.PathVariable; ...@@ -42,13 +44,9 @@ import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import com.alibaba.fastjson.JSONArray;
import net.mingsoft.basic.action.BaseAction; import net.mingsoft.basic.action.BaseAction;
import net.mingsoft.basic.biz.IColumnBiz;
import net.mingsoft.basic.biz.IModelBiz; import net.mingsoft.basic.biz.IModelBiz;
import net.mingsoft.basic.entity.AppEntity; import net.mingsoft.basic.entity.AppEntity;
import net.mingsoft.basic.entity.CategoryEntity;
import net.mingsoft.basic.entity.ColumnEntity;
import net.mingsoft.cms.bean.ColumnArticleIdBean; import net.mingsoft.cms.bean.ColumnArticleIdBean;
import net.mingsoft.cms.biz.IArticleBiz; import net.mingsoft.cms.biz.IArticleBiz;
import net.mingsoft.cms.constant.ModelCode; import net.mingsoft.cms.constant.ModelCode;
...@@ -84,7 +82,7 @@ public class GeneraterAction extends BaseAction { ...@@ -84,7 +82,7 @@ public class GeneraterAction extends BaseAction {
* 栏目管理业务层 * 栏目管理业务层
*/ */
@Autowired @Autowired
private IColumnBiz columnBiz; private ICategoryBiz categoryBiz;
/** /**
* 模块管理业务层 * 模块管理业务层
...@@ -155,40 +153,42 @@ public class GeneraterAction extends BaseAction { ...@@ -155,40 +153,42 @@ public class GeneraterAction extends BaseAction {
* @param response * @param response
* @param columnId * @param columnId
*/ */
@RequestMapping("/{columnId}/genernateColumn") @RequestMapping("/{CategoryId}/genernateColumn")
@RequiresPermissions("cms:generate:column") @RequiresPermissions("cms:generate:column")
@ResponseBody @ResponseBody
public void genernateColumn(HttpServletRequest request, HttpServletResponse response, @PathVariable int columnId) { public void genernateColumn(HttpServletRequest request, HttpServletResponse response, @PathVariable String CategoryId) {
// 获取站点id // 获取站点id
AppEntity app = BasicUtil.getApp(); AppEntity app = BasicUtil.getApp();
List<ColumnEntity> columns = new ArrayList<ColumnEntity>(); List<CategoryEntity> columns = new ArrayList<CategoryEntity>();
// 如果栏目id小于0则更新所有的栏目,否则只更新选中的栏目 // 如果栏目id小于0则更新所有的栏目,否则只更新选中的栏目
int modelId = BasicUtil.getModelCodeId(ModelCode.CMS_COLUMN); // 查询当前模块编号 if (StringUtils.isNotBlank(CategoryId)) {
if (columnId > 0) { CategoryEntity categoryEntity = new CategoryEntity();
List<CategoryEntity> categorys = columnBiz.queryChildrenCategory(columnId, app.getAppId(), modelId); categoryEntity.setId(CategoryId);
for (CategoryEntity c : categorys) { categoryEntity.setAppId(app.getAppId());
columns.add((ColumnEntity) columnBiz.getEntity(c.getCategoryId())); columns = categoryBiz.queryChilds(categoryEntity);
}
} else { } else {
// 获取所有的内容管理栏目 // 获取所有的内容管理栏目
columns = columnBiz.queryAll(app.getAppId(), modelId); CategoryEntity categoryEntity=new CategoryEntity();
categoryEntity.setAppId(app.getAppId());
columns = categoryBiz.query(categoryEntity);
} }
List<ColumnArticleIdBean> articleIdList = null; List<ColumnArticleIdBean> articleIdList = null;
try { try {
// 1、设置模板文件夹路径 // 1、设置模板文件夹路径
// 获取栏目列表模版 // 获取栏目列表模版
for (ColumnEntity column : columns) { for (CategoryEntity column : columns) {
// 判断模板文件是否存在 // 判断模板文件是否存在
if (!FileUtil.exist(ParserUtil.buildTempletPath(column.getColumnUrl()))) { if (!FileUtil.exist(ParserUtil.buildTempletPath(column.getCategoryUrl()))) {
continue; continue;
} }
articleIdList = articleBiz.queryIdsByCategoryIdForParser(column.getCategoryId(), null, null); articleIdList = articleBiz.queryIdsByCategoryIdForParser(Integer.parseInt(column.getCategoryId()), null, null);
// 判断列表类型 // 判断列表类型
switch (column.getColumnType()) { switch (column.getCategoryType()) {
case ColumnEntity.COLUMN_TYPE_LIST: // 列表 //TODO 暂时先用字符串代替
case "1": // 列表
CmsParserUtil.generateList(column, articleIdList.size()); CmsParserUtil.generateList(column, articleIdList.size());
break; break;
case ColumnEntity.COLUMN_TYPE_COVER:// 单页 case "2":// 单页
if(articleIdList.size()==0){ if(articleIdList.size()==0){
ColumnArticleIdBean columnArticleIdBean=new ColumnArticleIdBean(); ColumnArticleIdBean columnArticleIdBean=new ColumnArticleIdBean();
CopyOptions copyOptions=CopyOptions.create(); CopyOptions copyOptions=CopyOptions.create();
...@@ -198,8 +198,6 @@ public class GeneraterAction extends BaseAction { ...@@ -198,8 +198,6 @@ public class GeneraterAction extends BaseAction {
} }
CmsParserUtil.generateBasic(articleIdList); CmsParserUtil.generateBasic(articleIdList);
break; break;
default:
throw new IllegalStateException("Unexpected value: " + column.getColumnType());
} }
} }
} catch (IOException e) { } catch (IOException e) {
......
...@@ -196,7 +196,7 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction { ...@@ -196,7 +196,7 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction {
String content = ""; String content = "";
try { try {
//根据模板路径,参数生成 //根据模板路径,参数生成
content = CmsParserUtil.generate(columnArticles.get(0).getColumnListUrl(),map, isMobileDevice(req)); content = CmsParserUtil.generate(columnArticles.get(0).getCategoryListUrl(),map, isMobileDevice(req));
} catch (TemplateNotFoundException e) { } catch (TemplateNotFoundException e) {
e.printStackTrace(); e.printStackTrace();
} catch (MalformedTemplateNameException e) { } catch (MalformedTemplateNameException e) {
...@@ -251,20 +251,20 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction { ...@@ -251,20 +251,20 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction {
continue; continue;
} }
// 文章的栏目路径 // 文章的栏目路径
String articleColumnPath = articleIdList.get(artId).getColumnPath(); String articleColumnPath = articleIdList.get(artId).getCategoryPath();
// 文章的栏目模型编号 // 文章的栏目模型编号
int columnContentModelId = articleIdList.get(artId).getColumnContentModelId(); String columnContentModelId = articleIdList.get(artId).getMdiyModelId();
Map<String, Object> parserParams = new HashMap<String, Object>(); Map<String, Object> parserParams = new HashMap<String, Object>();
parserParams.put(ParserUtil.COLUMN, articleIdList.get(artId)); parserParams.put(ParserUtil.COLUMN, articleIdList.get(artId));
// 判断当前栏目是否有自定义模型 // 判断当前栏目是否有自定义模型
if (columnContentModelId > 0) { if ( StringUtils.isNotBlank(columnContentModelId)) {
// 通过当前栏目的模型编号获取,自定义模型表名 // 通过当前栏目的模型编号获取,自定义模型表名
if (contentModelMap.containsKey(columnContentModelId)) { if (contentModelMap.containsKey(columnContentModelId)) {
parserParams.put(ParserUtil.TABLE_NAME, contentModel.getCmTableName()); parserParams.put(ParserUtil.TABLE_NAME, contentModel.getCmTableName());
} else { } else {
// 通过栏目模型编号获取自定义模型实体 // 通过栏目模型编号获取自定义模型实体
contentModel = (ContentModelEntity) SpringUtil.getBean(IContentModelBiz.class) contentModel = (ContentModelEntity) SpringUtil.getBean(IContentModelBiz.class)
.getEntity(columnContentModelId); .getEntity(Integer.parseInt(columnContentModelId));
// 将自定义模型编号设置为key值 // 将自定义模型编号设置为key值
contentModelMap.put(columnContentModelId, contentModel.getCmTableName()); contentModelMap.put(columnContentModelId, contentModel.getCmTableName());
parserParams.put(ParserUtil.TABLE_NAME, contentModel.getCmTableName()); parserParams.put(ParserUtil.TABLE_NAME, contentModel.getCmTableName());
......
...@@ -22,13 +22,14 @@ The MIT License (MIT) * Copyright (c) 2016 铭飞科技(mingsoft.net) ...@@ -22,13 +22,14 @@ The MIT License (MIT) * Copyright (c) 2016 铭飞科技(mingsoft.net)
package net.mingsoft.cms.bean; package net.mingsoft.cms.bean;
import net.mingsoft.basic.entity.ColumnEntity; import net.mingsoft.basic.entity.ColumnEntity;
import net.mingsoft.cms.entity.CategoryEntity;
/** /**
* 文章解析生成 * 文章解析生成
* @author 铭飞开源团队 * @author 铭飞开源团队
* @date 2018年12月13日 * @date 2018年12月13日
*/ */
public class ColumnArticleIdBean extends ColumnEntity{ public class ColumnArticleIdBean extends CategoryEntity {
/** /**
* 文章编号 * 文章编号
*/ */
......
package net.mingsoft.cms.biz; package net.mingsoft.cms.biz;
import net.mingsoft.base.biz.IBaseBiz; import net.mingsoft.base.biz.IBaseBiz;
import net.mingsoft.cms.entity.CategoryEntity;
import java.util.List;
/** /**
...@@ -11,4 +14,14 @@ import net.mingsoft.base.biz.IBaseBiz; ...@@ -11,4 +14,14 @@ import net.mingsoft.base.biz.IBaseBiz;
*/ */
public interface ICategoryBiz extends IBaseBiz { public interface ICategoryBiz extends IBaseBiz {
/**
* 查询当前分类下的所有子分类
* @param category
* @return
*/
List<CategoryEntity> queryChilds(CategoryEntity category);
int saveEntity(CategoryEntity entity);
void updateEntity(CategoryEntity entity);
} }
\ No newline at end of file
...@@ -21,12 +21,15 @@ The MIT License (MIT) * Copyright (c) 2019 铭飞科技 ...@@ -21,12 +21,15 @@ The MIT License (MIT) * Copyright (c) 2019 铭飞科技
package net.mingsoft.cms.biz.impl; package net.mingsoft.cms.biz.impl;
import net.mingsoft.base.entity.BaseEntity;
import net.mingsoft.cms.entity.CategoryEntity;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import net.mingsoft.base.biz.impl.BaseBizImpl; import net.mingsoft.base.biz.impl.BaseBizImpl;
import net.mingsoft.base.dao.IBaseDao; import net.mingsoft.base.dao.IBaseDao;
import java.util.*; import java.util.*;
import net.mingsoft.cms.entity.CategoryEntity;
import net.mingsoft.cms.biz.ICategoryBiz; import net.mingsoft.cms.biz.ICategoryBiz;
import net.mingsoft.cms.dao.ICategoryDao; import net.mingsoft.cms.dao.ICategoryDao;
...@@ -48,5 +51,42 @@ public class CategoryBizImpl extends BaseBizImpl implements ICategoryBiz { ...@@ -48,5 +51,42 @@ public class CategoryBizImpl extends BaseBizImpl implements ICategoryBiz {
protected IBaseDao getDao() { protected IBaseDao getDao() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return categoryDao; return categoryDao;
} }
@Override
public List<CategoryEntity> queryChilds(CategoryEntity category) {
// TODO Auto-generated method stub
return categoryDao.queryChildren(category);
}
@Override
public int saveEntity(CategoryEntity categoryEntity) {
// TODO Auto-generated method stub
setParentId(categoryEntity);
return super.saveEntity(categoryEntity);
}
private void setParentId(CategoryEntity categoryEntity) {
if(StringUtils.isNotEmpty(categoryEntity.getCategoryId())&&Integer.parseInt(categoryEntity.getCategoryId())>0) {
CategoryEntity category = (CategoryEntity)categoryDao.getEntity(Integer.parseInt(categoryEntity.getCategoryId()));
if(StringUtils.isEmpty(category.getCategoryParentId())) {
categoryEntity.setCategoryParentId(categoryEntity.getCategoryId());
} else {
categoryEntity.setCategoryParentId(category.getCategoryParentId()+","+categoryEntity.getCategoryParentId());
}
}
}
@Override
public void updateEntity(CategoryEntity entity) {
List<CategoryEntity> categoryEntities = queryChilds(entity);
setParentId(entity);
super.updateEntity(entity);
categoryEntities.forEach(x->{
setParentId(x);
if(!x.getId().equals(entity.getId())){
super.updateEntity(x);
}
});
}
} }
\ No newline at end of file
...@@ -2,7 +2,9 @@ package net.mingsoft.cms.dao; ...@@ -2,7 +2,9 @@ package net.mingsoft.cms.dao;
import net.mingsoft.base.dao.IBaseDao; import net.mingsoft.base.dao.IBaseDao;
import java.util.*; import java.util.*;
import net.mingsoft.cms.entity.CategoryEntity; import net.mingsoft.cms.entity.CategoryEntity;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
/** /**
...@@ -13,4 +15,12 @@ import org.springframework.stereotype.Component; ...@@ -13,4 +15,12 @@ import org.springframework.stereotype.Component;
*/ */
@Component("cmsCategoryDao") @Component("cmsCategoryDao")
public interface ICategoryDao extends IBaseDao { public interface ICategoryDao extends IBaseDao {
/**
* 查询当前分类下面的所有子分类
* @param category 必须存在categoryId categoryParentId
* @return
*/
public List<net.mingsoft.cms.entity.CategoryEntity> queryChildren(CategoryEntity category);
} }
\ No newline at end of file
...@@ -90,7 +90,7 @@ ...@@ -90,7 +90,7 @@
update cms_category update cms_category
<set> <set>
<if test="categoryTitle != null and categoryTitle != ''">category_title=#{categoryTitle},</if> <if test="categoryTitle != null and categoryTitle != ''">category_title=#{categoryTitle},</if>
<if test="categoryId != null and categoryId != ''">category_id=#{categoryId},</if> category_id=#{categoryId},
<if test="categoryType != null and categoryType != ''">category_type=#{categoryType},</if> <if test="categoryType != null and categoryType != ''">category_type=#{categoryType},</if>
<if test="categorySort != null">category_sort=#{categorySort},</if> <if test="categorySort != null">category_sort=#{categorySort},</if>
<if test="categoryListUrl != null and categoryListUrl != ''">category_list_url=#{categoryListUrl},</if> <if test="categoryListUrl != null and categoryListUrl != ''">category_list_url=#{categoryListUrl},</if>
...@@ -116,7 +116,7 @@ ...@@ -116,7 +116,7 @@
where id = #{id} where id = #{id}
</update> </update>
<!--根据id获取--> <!--根据id获取-->
<select id="getEntity" resultMap="resultMap" parameterType="int"> <select id="getEntity" resultMap="resultMap" parameterType="int">
select * from cms_category where id=#{id} select * from cms_category where id=#{id}
</select> </select>
...@@ -151,6 +151,41 @@ ...@@ -151,6 +151,41 @@
</where> </where>
limit 0,1 limit 0,1
</select> </select>
<sql id="queryWhereCategoryId" databaseId="mysql">
find_in_set('${id}',CATEGORY_PARENT_ID)
</sql>
<sql id="queryWhereCategoryId" databaseId="oracle" >
instr(','||'${id}'||',', ','||CATEGORY_PARENT_ID||',')>0
</sql>
<sql id="queryWhereCategoryId" databaseId="sqlServer">
CHARINDEX(','+'${id}'+',' , ','+CATEGORY_PARENT_ID +',')>0
</sql>
<!-- 模糊查询开始 -->
<select id="queryChildren" resultMap="resultMap">
select * from cms_category
<where>
<if test="appId &gt; 0">
and app_id=#{appId}
</if>
<if test="dictId &gt; 0">
and dict_id=#{dictId}
</if>
and
(
<if test="categoryParentId != null and categoryParentId!=''">
CATEGORY_PARENT_ID like '%${categoryParentId}%'
</if>
<if test="categoryParentId == null or categoryParentId ==''">
<include refid="queryWhereCategoryId"></include>
</if>
<if test="id != null">
or id=#{id}
</if>
)
and del=0
</where>
</select>
<!--删除--> <!--删除-->
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<result column="content_details" property="contentDetails" /><!--文章内容 --> <result column="content_details" property="contentDetails" /><!--文章内容 -->
<result column="content_url" property="contentUrl" /><!--文章跳转链接地址 --> <result column="content_url" property="contentUrl" /><!--文章跳转链接地址 -->
<result column="content_hit" property="contentHit" /><!--点击次数 --> <result column="content_hit" property="contentHit" /><!--点击次数 -->
<result column="appid" property="appid" /><!--文章管理的应用id --> <result column="app_id" property="appId" /><!--文章管理的应用id -->
<result column="create_by" property="createBy" /><!--创建人 --> <result column="create_by" property="createBy" /><!--创建人 -->
<result column="create_date" property="createDate" /><!--创建时间 --> <result column="create_date" property="createDate" /><!--创建时间 -->
<result column="update_by" property="updateBy" /><!--修改人 --> <result column="update_by" property="updateBy" /><!--修改人 -->
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
<if test="contentDetails != null and contentDetails != ''">content_details,</if> <if test="contentDetails != null and contentDetails != ''">content_details,</if>
<if test="contentUrl != null and contentUrl != ''">content_url,</if> <if test="contentUrl != null and contentUrl != ''">content_url,</if>
<if test="contentHit != null">content_hit,</if> <if test="contentHit != null">content_hit,</if>
<if test="appid != null">appid,</if> <if test="appId != null">app_id,</if>
<if test="createBy &gt; 0">create_by,</if> <if test="createBy &gt; 0">create_by,</if>
<if test="createDate != null">create_date,</if> <if test="createDate != null">create_date,</if>
<if test="updateBy &gt; 0">update_by,</if> <if test="updateBy &gt; 0">update_by,</if>
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
<if test="contentDetails != null and contentDetails != ''">#{contentDetails},</if> <if test="contentDetails != null and contentDetails != ''">#{contentDetails},</if>
<if test="contentUrl != null and contentUrl != ''">#{contentUrl},</if> <if test="contentUrl != null and contentUrl != ''">#{contentUrl},</if>
<if test="contentHit != null">#{contentHit},</if> <if test="contentHit != null">#{contentHit},</if>
<if test="appid != null">#{appid},</if> <if test="appId != null">#{appId},</if>
<if test="createBy &gt; 0">#{createBy},</if> <if test="createBy &gt; 0">#{createBy},</if>
<if test="createDate != null">#{createDate},</if> <if test="createDate != null">#{createDate},</if>
<if test="updateBy &gt; 0">#{updateBy},</if> <if test="updateBy &gt; 0">#{updateBy},</if>
...@@ -94,7 +94,7 @@ ...@@ -94,7 +94,7 @@
<if test="contentDetails != null and contentDetails != ''">content_details=#{contentDetails},</if> <if test="contentDetails != null and contentDetails != ''">content_details=#{contentDetails},</if>
<if test="contentUrl != null and contentUrl != ''">content_url=#{contentUrl},</if> <if test="contentUrl != null and contentUrl != ''">content_url=#{contentUrl},</if>
<if test="contentHit != null">content_hit=#{contentHit},</if> <if test="contentHit != null">content_hit=#{contentHit},</if>
<if test="appid != null">appid=#{appid},</if> <if test="appId != null">app_id=#{appId},</if>
<if test="createBy &gt; 0">create_by=#{createBy},</if> <if test="createBy &gt; 0">create_by=#{createBy},</if>
<if test="createDate != null">create_date=#{createDate},</if> <if test="createDate != null">create_date=#{createDate},</if>
<if test="updateBy &gt; 0">update_by=#{updateBy},</if> <if test="updateBy &gt; 0">update_by=#{updateBy},</if>
...@@ -127,7 +127,7 @@ ...@@ -127,7 +127,7 @@
<if test="contentDetails != null and contentDetails != ''">and content_details=#{contentDetails}</if> <if test="contentDetails != null and contentDetails != ''">and content_details=#{contentDetails}</if>
<if test="contentUrl != null and contentUrl != ''">and content_url=#{contentUrl}</if> <if test="contentUrl != null and contentUrl != ''">and content_url=#{contentUrl}</if>
<if test="contentHit != null">and content_hit=#{contentHit}</if> <if test="contentHit != null">and content_hit=#{contentHit}</if>
<if test="appid != null"> and appid=#{appid} </if> <if test="appId != null"> and app_id=#{appId} </if>
<if test="createBy &gt; 0"> and create_by=#{createBy} </if> <if test="createBy &gt; 0"> and create_by=#{createBy} </if>
<if test="createDate != null"> and create_date=#{createDate} </if> <if test="createDate != null"> and create_date=#{createDate} </if>
<if test="updateBy &gt; 0"> and update_by=#{updateBy} </if> <if test="updateBy &gt; 0"> and update_by=#{updateBy} </if>
...@@ -173,7 +173,7 @@ ...@@ -173,7 +173,7 @@
<if test="contentDetails != null and contentDetails != ''"> and content_details=#{contentDetails}</if> <if test="contentDetails != null and contentDetails != ''"> and content_details=#{contentDetails}</if>
<if test="contentUrl != null and contentUrl != ''"> and content_url=#{contentUrl}</if> <if test="contentUrl != null and contentUrl != ''"> and content_url=#{contentUrl}</if>
<if test="contentHit != null"> and content_hit=#{contentHit}</if> <if test="contentHit != null"> and content_hit=#{contentHit}</if>
<if test="appid != null"> and appid=#{appid} </if> <if test="appId != null"> and app_id=#{appId} </if>
<if test="createBy &gt; 0"> and create_by=#{createBy} </if> <if test="createBy &gt; 0"> and create_by=#{createBy} </if>
<if test="createDate != null"> and create_date=#{createDate} </if> <if test="createDate != null"> and create_date=#{createDate} </if>
<if test="updateBy &gt; 0"> and update_by=#{updateBy} </if> <if test="updateBy &gt; 0"> and update_by=#{updateBy} </if>
......
...@@ -73,7 +73,7 @@ private static final long serialVersionUID = 1574925152617L; ...@@ -73,7 +73,7 @@ private static final long serialVersionUID = 1574925152617L;
/** /**
* 文章管理的应用id * 文章管理的应用id
*/ */
private Integer appid; private Integer appId;
/** /**
* 点击次数 * 点击次数
*/ */
...@@ -259,14 +259,14 @@ private static final long serialVersionUID = 1574925152617L; ...@@ -259,14 +259,14 @@ private static final long serialVersionUID = 1574925152617L;
/** /**
* 设置文章管理的应用id * 设置文章管理的应用id
*/ */
public void setAppid(Integer appid) { public void setAppId(Integer appId) {
this.appid = appid; this.appId = appId;
} }
/** /**
* 获取文章管理的应用id * 获取文章管理的应用id
*/ */
public Integer getAppid() { public Integer getAppId() {
return this.appid; return this.appId;
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment