Commit 6a59a6d7 authored by msgroup's avatar msgroup Committed by mingsoft
Browse files

fix: 5.3

parent 672d5545
Showing with 1677 additions and 430 deletions
+1677 -430
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -17,7 +17,7 @@
<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<log4j.version>2.19.0</log4j.version>
<log4j.version>2.20.0</log4j.version>
</properties>
<repositories>
<repository>
......@@ -44,24 +44,24 @@
<dependency>
<groupId>net.mingsoft</groupId>
<artifactId>ms-base</artifactId>
<version>2.1.18.3</version>
<version>2.1.19</version>
</dependency>
<dependency>
<groupId>net.mingsoft</groupId>
<artifactId>ms-basic</artifactId>
<version>2.1.18.3</version>
<version>2.1.19</version>
</dependency>
<dependency>
<groupId>net.mingsoft</groupId>
<artifactId>ms-mdiy</artifactId>
<version>2.1.18</version>
<version>2.1.19</version>
</dependency>
<!--store入口依赖(源码不开发),如果不需要MStore可以直接去掉依赖-->
<dependency>
<groupId>net.mingsoft</groupId>
<artifactId>store-client</artifactId>
<version>2.1.18</version>
<version>2.1.19</version>
</dependency>
<dependency>
<groupId>com.github.oshi</groupId>
......
......@@ -323,11 +323,11 @@ public class CategoryAction extends BaseAction {
}
/**
* 批量更新模
* 批量更新模
* @param category 栏目实体
* @return
*/
@ApiOperation(value = "批量更新模")
@ApiOperation(value = "批量更新模")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "编号", required = true, paramType = "query"),
@ApiImplicitParam(name = "dictId", value = "字典", required = true, paramType = "query")
......
......@@ -26,9 +26,15 @@ package net.mingsoft.cms.action;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateException;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.ZipUtil;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import io.swagger.annotations.ApiOperation;
import net.mingsoft.base.entity.ResultData;
import net.mingsoft.basic.annotation.LogAnn;
import net.mingsoft.basic.biz.IModelBiz;
......@@ -39,8 +45,10 @@ import net.mingsoft.cms.bean.CategoryBean;
import net.mingsoft.cms.bean.ContentBean;
import net.mingsoft.cms.biz.ICategoryBiz;
import net.mingsoft.cms.biz.IContentBiz;
import net.mingsoft.cms.constant.e.CategoryDisplayEnum;
import net.mingsoft.cms.constant.e.CategoryTypeEnum;
import net.mingsoft.cms.entity.CategoryEntity;
import net.mingsoft.cms.entity.ContentEntity;
import net.mingsoft.cms.util.CmsParserUtil;
import net.mingsoft.mdiy.util.ParserUtil;
import org.apache.commons.lang3.StringUtils;
......@@ -53,15 +61,16 @@ import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* @ClassName: GeneraterAction
......@@ -70,7 +79,7 @@ import java.util.List;
* @date: 2018年1月31日 下午2:52:07
* @Copyright: 2018 www.mingsoft.net Inc. All rights reserved.
*/
@ApiIgnore
@ApiOperation("静态化")
@Controller("cmsGenerater")
@RequestMapping("/${ms.manager.path}/cms/generate")
@Scope("request")
......@@ -127,12 +136,12 @@ public class GeneraterAction extends BaseAction {
@LogAnn(title = "生成主页", businessType = BusinessTypeEnum.UPDATE)
@ResponseBody
public ResultData generateIndex(HttpServletRequest request, HttpServletResponse response) throws IOException {
// 模文件名称
// 模文件名称
String tmpFileName = request.getParameter("url");
// 生成后的文件名称
String generateFileName = request.getParameter("position");
// 获取文件所在路径 首先判断用户输入的模文件是否存在
// 获取文件所在路径 首先判断用户输入的模文件是否存在
if (!FileUtil.exist(ParserUtil.buildTemplatePath())) {
return ResultData.build().error(getResString("template.file"));
} else {
......@@ -173,8 +182,12 @@ public class GeneraterAction extends BaseAction {
//文章列表
List<CategoryBean> articleIdList = null;
// 获取栏目列表模
// 获取栏目列表模
for (CategoryEntity column : columns) {
// 如果栏目被禁用则跳过
if (CategoryDisplayEnum.DISABLE.toString().equalsIgnoreCase(column.getCategoryDisplay())){
continue;
}
//如果是链接就跳过生成
if (column.getCategoryType().equals(CategoryTypeEnum.LINK.toString())) {
continue;
......@@ -255,6 +268,10 @@ public class GeneraterAction extends BaseAction {
}
for (CategoryEntity category : categoryList) {
// 如果栏目被禁用则跳过
if (CategoryDisplayEnum.DISABLE.toString().equalsIgnoreCase(category.getCategoryDisplay())){
continue;
}
//如果是链接就跳过生成
if (category.getCategoryType().equals(CategoryTypeEnum.LINK.toString())) {
continue;
......@@ -299,4 +316,6 @@ public class GeneraterAction extends BaseAction {
+ File.separator + position + ParserUtil.HTML_SUFFIX;
return "redirect:" + indexPosition;
}
}
......@@ -252,6 +252,12 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction {
params.put(ParserUtil.URL, BasicUtil.getUrl());
params.put(ParserUtil.APP_DIR, BasicUtil.getApp().getAppDir());
}
//对项目名预处理
String contextPath = BasicUtil.getContextPath();
if (StringUtils.isNotBlank(contextPath) && "/".equalsIgnoreCase(contextPath) ){
contextPath = "";
}
params.putIfAbsent(ParserUtil.CONTEXT_PATH, contextPath);
searchMap.put("pageNo", 0);
// ParserUtil.read(search, map, page);
......@@ -268,8 +274,7 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction {
page.setPageNo(pageNo);
//设置分页的统一链接
String url = params.get(ParserUtil.URL).toString();
url = url + request.getServletPath() + "?" + urlParams;
String url = request.getServletPath() + "?" + urlParams;
String pageNoStr = "size=" + page.getSize() + "&pageNo=";
//下一页
String nextUrl = url + pageNoStr + ((pageNo + 1 > total) ? total : pageNo + 1);
......
......@@ -13,6 +13,7 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import net.mingsoft.base.entity.ResultData;
import net.mingsoft.basic.exception.BusinessException;
import net.mingsoft.basic.util.BasicUtil;
import net.mingsoft.cms.constant.e.CategoryDisplayEnum;
import net.mingsoft.cms.constant.e.CategoryTypeEnum;
import net.mingsoft.cms.dao.ICategoryDao;
import net.mingsoft.cms.dao.IContentDao;
......@@ -31,6 +32,7 @@ import org.springframework.stereotype.Component;
import java.io.File;
import java.util.List;
import java.util.stream.Collectors;
/**
......@@ -76,6 +78,15 @@ public class CategoryAop extends net.mingsoft.basic.aop.BaseAop {
throw new BusinessException("栏目不存在!");
}
// 如果栏目被设置为不显示,将栏目下所有子栏目也设置为不显示
if (CategoryDisplayEnum.DISABLE.toString().equalsIgnoreCase(category.getCategoryDisplay())){
List<String> ids = categoryDao.queryChildren(category).stream().map(CategoryEntity::getId).collect(Collectors.toList());
LambdaUpdateWrapper<CategoryEntity> wrapper = new UpdateWrapper<CategoryEntity>().lambda();
wrapper.set(CategoryEntity::getCategoryDisplay,CategoryDisplayEnum.DISABLE.toString());
wrapper.in(CategoryEntity::getId,ids);
categoryDao.update(new CategoryEntity(),wrapper);
}
// 获取返回值
Object obj = pjp.proceed(pjp.getArgs());
ResultData resultData = JSONUtil.toBean(JSONUtil.toJsonStr(obj), ResultData.class);
......@@ -83,6 +94,7 @@ public class CategoryAop extends net.mingsoft.basic.aop.BaseAop {
if (parent == null) {
return resultData;
}
// 用于判断父级栏目之前是否是子栏目
// 只有父节点之前为子节点 && 父栏目类型为列表 && 子栏目为列表
boolean flag = parent.getLeaf() && StringUtils.equals(parent.getCategoryType(), CategoryTypeEnum.LIST.toString());
......
......@@ -99,28 +99,20 @@ public class ContentAop extends BaseAop {
return pjp.proceed();
}
//查询判断该ip是否已经有浏览记录了
HistoryLogEntity historyLog = new HistoryLogEntity();
historyLog.setContentId(content.getId());
historyLog.setHlIp(BasicUtil.getIp());
historyLog.setHlIsMobile(BasicUtil.isMobileDevice());
HistoryLogEntity _historyLog = (HistoryLogEntity) historyLogBiz.getEntity(historyLog);
//如果该ip该文章没有浏览记录则保存浏览记录
//并且更新点击数
if (_historyLog == null || StringUtils.isBlank(_historyLog.getId())) {
historyLog.setCreateDate(new Date());
historyLogBiz.saveEntity(historyLog);
//更新点击数
ContentEntity updateContent = new ContentEntity();
updateContent.setId(content.getId());
if (content.getContentHit() == null) {
updateContent.setContentHit(1);
} else {
updateContent.setContentHit(content.getContentHit() + 1);
}
contentBiz.updateEntity(updateContent);
historyLog.setCreateDate(new Date());
//保存浏览记录
historyLogBiz.saveEntity(historyLog);
//更新点击数
if (content.getContentHit() == null) {
content.setContentHit(1);
} else {
content.setContentHit(content.getContentHit() + 1);
}
contentBiz.updateById(content);
return pjp.proceed();
}
......@@ -131,6 +123,7 @@ public class ContentAop extends BaseAop {
/**
* 删除文章后并删除文章对应的静态化文件
*
* @param jp
*/
@After("delete()")
......@@ -157,8 +150,8 @@ public class ContentAop extends BaseAop {
/**
* @param categoryPath 栏目目录
* @param contentId 文章ID
* 根据文章实体删除静态文件
* @param contentId 文章ID
* 根据文章实体删除静态文件
*/
private void deleteHtml(String categoryPath, String contentId) {
// html真实路径
......
/**
* Copyright (c) 2012-present 铭软科技(mingsoft.net)
* 本软件及相关文档文件(以下简称“软件”)的版权归 铭软科技 所有
* 遵循铭软科技《保密协议》
*/
package net.mingsoft.cms.constant.e;
import net.mingsoft.base.constant.e.BaseEnum;
/**
* @Author: 铭飞团队
* @Description: 栏目是否显示枚举类
* @Date: Create in 2023/03/24 14:18
*/
public enum CategoryDisplayEnum implements BaseEnum {
/**
* 启用
*/
ENABLE("enable"),
/**
* 禁用
*/
DISABLE("disable");
CategoryDisplayEnum(String status) {
this.status = status;
}
private String status;
@Override
public int toInt() {
return 0;
}
@Override
public String toString() {
return status;
}
}
......@@ -3,98 +3,110 @@
<mapper namespace="net.mingsoft.cms.dao.ICategoryDao">
<resultMap id="resultMap" type="net.mingsoft.cms.entity.CategoryEntity">
<id column="id" property="id" /><!--编号 -->
<result column="category_title" property="categoryTitle" /><!--栏目管理名称 -->
<result column="category_pinyin" property="categoryPinyin" /><!--栏目管理名称 -->
<result column="category_id" property="categoryId" /><!--所属栏目 -->
<result column="category_type" property="categoryType" /><!--栏目管理属性 -->
<result column="category_sort" property="categorySort" /><!--自定义顺序 -->
<result column="category_list_url" property="categoryListUrl" /><!--列表模板 -->
<result column="category_url" property="categoryUrl" /><!--内容模板 -->
<result column="category_keyword" property="categoryKeyword" /><!--栏目管理关键字 -->
<result column="category_descrip" property="categoryDescrip" /><!--栏目管理描述 -->
<result column="category_img" property="categoryImg" /><!--缩略图 -->
<result column="category_diy_url" property="categoryDiyUrl" /><!--自定义链接 -->
<result column="mdiy_model_id" property="mdiyModelId" /><!--栏目管理的内容模型id -->
<result column="dict_id" property="dictId" /><!--字典对应编号 -->
<result column="category_flag" property="categoryFlag" /><!--栏目属性 -->
<result column="category_path" property="categoryPath" /><!--栏目路径 -->
<result column="category_parent_ids" property="categoryParentIds" /><!--父类型编号 -->
<result column="create_by" property="createBy" /><!--创建人 -->
<result column="create_date" property="createDate" /><!--创建时间 -->
<result column="update_by" property="updateBy" /><!--修改人 -->
<result column="update_date" property="updateDate" /><!--修改时间 -->
<result column="del" property="del" /><!--删除标记 -->
<result column="top_id" property="topId" /><!--删除标记 -->
<result column="leaf" property="leaf" /><!--删除标记 -->
<id column="id" property="id" /><!--编号 -->
<result column="category_title" property="categoryTitle" /><!--栏目管理名称 -->
<result column="category_short_title" property="categoryShortTitle" /><!--副标题 -->
<result column="category_pinyin" property="categoryPinyin" /><!--栏目管理名称 -->
<result column="category_id" property="categoryId" /><!--所属栏目 -->
<result column="category_type" property="categoryType" /><!--栏目管理属性 -->
<result column="category_sort" property="categorySort" /><!--自定义顺序 -->
<result column="category_list_url" property="categoryListUrl" /><!--列表模板 -->
<result column="category_url" property="categoryUrl" /><!--内容模板 -->
<result column="category_keyword" property="categoryKeyword" /><!--栏目管理关键字 -->
<result column="category_descrip" property="categoryDescrip" /><!--栏目管理描述 -->
<result column="category_display" property="categoryDisplay" /><!--栏目是否显示 -->
<result column="category_img" property="categoryImg" /><!--栏目banner图 -->
<result column="category_ico" property="categoryIco" /><!--栏目小图 -->
<result column="category_diy_url" property="categoryDiyUrl" /><!--自定义链接 -->
<result column="mdiy_model_id" property="mdiyModelId" /><!--文章管理的内容模型id -->
<result column="mdiy_category_model_id" property="mdiyCategoryModelId" /><!--栏目管理的内容模型id -->
<result column="dict_id" property="dictId" /><!--字典对应编号 -->
<result column="category_flag" property="categoryFlag" /><!--栏目属性 -->
<result column="category_path" property="categoryPath" /><!--栏目路径 -->
<result column="category_parent_ids" property="categoryParentIds" /><!--父类型编号 -->
<result column="create_by" property="createBy" /><!--创建人 -->
<result column="create_date" property="createDate" /><!--创建时间 -->
<result column="update_by" property="updateBy" /><!--修改人 -->
<result column="update_date" property="updateDate" /><!--修改时间 -->
<result column="del" property="del" /><!--删除标记 -->
<result column="top_id" property="topId" /><!--删除标记 -->
<result column="leaf" property="leaf" /><!--删除标记 -->
</resultMap>
<!--更新-->
<update id="updateEntity" parameterType="net.mingsoft.cms.entity.CategoryEntity">
update cms_category
<set>
<if test="categoryTitle != null and categoryTitle != ''">category_title=#{categoryTitle},</if>
<if test="categoryPinyin != null and categoryPinyin != ''">category_pinyin=#{categoryPinyin},</if>
<if test="topId != null and topId != ''">top_id=#{topId},</if>
<if test="leaf != null">leaf=#{leaf},</if>
category_id=#{categoryId},
category_parent_ids=#{categoryParentIds},
mdiy_model_id=#{mdiyModelId},
<if test="categoryType != null and categoryType != ''">category_type=#{categoryType},</if>
<if test="categorySort != null">category_sort=#{categorySort},</if>
category_list_url=#{categoryListUrl},
category_url=#{categoryUrl},
<if test="categoryKeyword != null ">category_keyword=#{categoryKeyword},</if>
<if test="categoryDescrip != null ">category_descrip=#{categoryDescrip},</if>
<if test="categoryImg != null and categoryImg != ''">category_img=#{categoryImg},</if>
<if test="categoryDiyUrl != null">category_diy_url=#{categoryDiyUrl},</if>
<if test="dictId != null">dict_id=#{dictId},</if>
<if test="categoryFlag != null ">category_flag=#{categoryFlag},</if>
<if test="categoryPath != null and categoryPath != ''">category_path=#{categoryPath},</if>
<if test="createBy &gt; 0">create_by=#{createBy},</if>
<if test="createDate != null">create_date=#{createDate},</if>
<if test="updateBy &gt; 0">update_by=#{updateBy},</if>
<if test="updateDate != null">update_date=#{updateDate},</if>
<if test="del != null">del=#{del},</if>
</set>
where id = #{id}
</update>
<!--更新-->
<update id="updateEntity" parameterType="net.mingsoft.cms.entity.CategoryEntity">
update cms_category
<set>
<if test="categoryTitle != null and categoryTitle != ''">category_title=#{categoryTitle},</if>
<if test="categoryShortTitle != null and categoryShortTitle != ''">category_short_title=#{categoryShortTitle},</if>
<if test="categoryPinyin != null and categoryPinyin != ''">category_pinyin=#{categoryPinyin},</if>
<if test="topId != null and topId != ''">top_id=#{topId},</if>
<if test="leaf != null">leaf=#{leaf},</if>
category_id=#{categoryId},
category_parent_ids=#{categoryParentIds},
mdiy_model_id=#{mdiyModelId},
mdiy_category_model_id=#{mdiyCategoryModelId},
<if test="categoryType != null and categoryType != ''">category_type=#{categoryType},</if>
<if test="categorySort != null">category_sort=#{categorySort},</if>
category_list_url=#{categoryListUrl},
category_url=#{categoryUrl},
<if test="categoryKeyword != null ">category_keyword=#{categoryKeyword},</if>
<if test="categoryDescrip != null ">category_descrip=#{categoryDescrip},</if>
<if test="categoryImg != null and categoryImg != ''">category_img=#{categoryImg},</if>
<if test="categoryDisplay != null and categoryDisplay != ''">category_display=#{categoryDisplay},</if>
<if test="categoryIco != null and categoryIco != ''">category_ico=#{categoryIco},</if>
<if test="categoryDiyUrl != null">category_diy_url=#{categoryDiyUrl},</if>
<if test="dictId != null">dict_id=#{dictId},</if>
<if test="categoryFlag != null ">category_flag=#{categoryFlag},</if>
<if test="categoryPath != null and categoryPath != ''">category_path=#{categoryPath},</if>
<if test="createBy &gt; 0">create_by=#{createBy},</if>
<if test="createDate != null">create_date=#{createDate},</if>
<if test="updateBy &gt; 0">update_by=#{updateBy},</if>
<if test="updateDate != null">update_date=#{updateDate},</if>
<if test="del != null">del=#{del},</if>
</set>
where id = #{id}
</update>
<!--根据id获取-->
<select id="getEntity" resultMap="resultMap" parameterType="int">
select * from cms_category where id=#{id}
</select>
<select id="getEntity" resultMap="resultMap" parameterType="int">
select * from cms_category where id=#{id}
</select>
<!--根据实体获取-->
<select id="getByEntity" resultMap="resultMap" parameterType="net.mingsoft.cms.entity.CategoryEntity">
select * from cms_category
<where>
<if test="categoryTitle != null and categoryTitle != ''">and category_title=#{categoryTitle}</if>
<if test="categoryPinyin != null and categoryPinyin != ''">and category_pinyin=#{categoryPinyin}</if>
<if test="categoryId != null and categoryId != ''">and category_id=#{categoryId}</if>
<if test="categoryType != null and categoryType != ''">and category_type=#{categoryType}</if>
<if test="categorySort != null"> and category_sort=#{categorySort} </if>
<if test="categoryListUrl != null and categoryListUrl != ''">and category_list_url=#{categoryListUrl}</if>
<if test="categoryUrl != null and categoryUrl != ''">and category_url=#{categoryUrl}</if>
<if test="categoryKeyword != null and categoryKeyword != ''">and category_keyword=#{categoryKeyword}</if>
<if test="categoryDescrip != null and categoryDescrip != ''">and category_descrip=#{categoryDescrip}</if>
<if test="categoryImg != null and categoryImg != ''">and category_img=#{categoryImg}</if>
<if test="categoryDiyUrl != null and categoryDiyUrl != ''">and category_diy_url=#{categoryDiyUrl}</if>
<if test="mdiyModelId != null and mdiyModelId != ''">and mdiy_model_id=#{mdiyModelId}</if>
<if test="dictId != null"> and dict_id=#{dictId} </if>
<if test="categoryFlag != null and categoryFlag != ''">and category_flag=#{categoryFlag}</if>
<if test="categoryPath != null and categoryPath != ''">and category_path=#{categoryPath}</if>
<if test="categoryParentIds != null and categoryParentIds != ''">and category_parent_ids=#{categoryParentIds}</if>
<if test="createBy &gt; 0"> and create_by=#{createBy} </if>
<if test="createDate != null"> and create_date=#{createDate} </if>
<if test="updateBy &gt; 0"> and update_by=#{updateBy} </if>
<if test="updateDate != null"> and update_date=#{updateDate} </if>
<if test="del != null"> and del=#{del} </if>
<if test="topId != null and topId != ''"> and top_id=#{topId}</if>
<if test="leaf != null"> and leaf=#{leaf}</if>
</where>
</select>
<!--根据实体获取-->
<select id="getByEntity" resultMap="resultMap" parameterType="net.mingsoft.cms.entity.CategoryEntity">
select * from cms_category
<where>
<if test="categoryTitle != null and categoryTitle != ''">and category_title=#{categoryTitle}</if>
<if test="categoryShortTitle != null and categoryShortTitle != ''">and category_short_title=#{categoryShortTitle}</if>
<if test="categoryPinyin != null and categoryPinyin != ''">and category_pinyin=#{categoryPinyin}</if>
<if test="categoryId != null and categoryId != ''">and category_id=#{categoryId}</if>
<if test="categoryType != null and categoryType != ''">and category_type=#{categoryType}</if>
<if test="categorySort != null"> and category_sort=#{categorySort} </if>
<if test="categoryListUrl != null and categoryListUrl != ''">and category_list_url=#{categoryListUrl}</if>
<if test="categoryUrl != null and categoryUrl != ''">and category_url=#{categoryUrl}</if>
<if test="categoryKeyword != null and categoryKeyword != ''">and category_keyword=#{categoryKeyword}</if>
<if test="categoryDescrip != null and categoryDescrip != ''">and category_descrip=#{categoryDescrip}</if>
<if test="categoryImg != null and categoryImg != ''">and category_img=#{categoryImg}</if>
<if test="categoryDisplay != null and categoryDisplay != ''">and category_display=#{categoryDisplay}</if>
<if test="categoryIco != null and categoryIco != ''">and category_ico=#{categoryIco}</if>
<if test="categoryDiyUrl != null and categoryDiyUrl != ''">and category_diy_url=#{categoryDiyUrl}</if>
<if test="mdiyModelId != null and mdiyModelId != ''">and mdiy_model_id=#{mdiyModelId}</if>
<if test="mdiyCategoryModelId != null and mdiyCategoryModelId != ''">and mdiy_category_model_id=#{mdiyCategoryModelId}</if>
<if test="dictId != null"> and dict_id=#{dictId} </if>
<if test="categoryFlag != null and categoryFlag != ''">and category_flag=#{categoryFlag}</if>
<if test="categoryPath != null and categoryPath != ''">and category_path=#{categoryPath}</if>
<if test="categoryParentIds != null and categoryParentIds != ''">and category_parent_ids=#{categoryParentIds}</if>
<if test="createBy &gt; 0"> and create_by=#{createBy} </if>
<if test="createDate != null"> and create_date=#{createDate} </if>
<if test="updateBy &gt; 0"> and update_by=#{updateBy} </if>
<if test="updateDate != null"> and update_date=#{updateDate} </if>
<if test="del != null"> and del=#{del} </if>
<if test="topId != null and topId != ''"> and top_id=#{topId}</if>
<if test="leaf != null"> and leaf=#{leaf}</if>
</where>
</select>
<!-- 模糊查询开始 -->
<select id="queryChildren" resultMap="resultMap">
......@@ -116,28 +128,29 @@
</select>
<!--删除-->
<delete id="deleteEntity" parameterType="int">
delete from cms_category where id=#{id}
</delete>
<!--删除-->
<delete id="deleteEntity" parameterType="int">
delete from cms_category where id=#{id}
</delete>
<!--批量删除-->
<delete id="delete" >
delete from cms_category
<where>
id in <foreach collection="ids" item="item" index="index"
open="(" separator="," close=")">#{item}</foreach>
</where>
</delete>
<!--查询全部-->
<select id="queryAll" resultMap="resultMap">
select * from cms_category order by id desc
</select>
<!--批量删除-->
<delete id="delete" >
delete from cms_category
<where>
id in <foreach collection="ids" item="item" index="index"
open="(" separator="," close=")">#{item}</foreach>
</where>
</delete>
<!--查询全部-->
<select id="queryAll" resultMap="resultMap">
select * from cms_category order by id desc
</select>
<!--条件查询-->
<select id="query" resultMap="resultMap">
select * from cms_category
<where>
<if test="categoryTitle != null and categoryTitle != ''"> and category_title=#{categoryTitle}</if>
<if test="categoryShortTitle != null and categoryShortTitle != ''">and category_short_title=#{categoryShortTitle}</if>
<if test="categoryPinyin != null and categoryPinyin != ''">and category_pinyin=#{categoryPinyin}</if>
<if test="categoryId != null and categoryId != ''"> and category_id=#{categoryId}</if>
<if test="categoryType != null and categoryType != ''"> and category_type=#{categoryType}</if>
......@@ -147,8 +160,11 @@
<if test="categoryKeyword != null and categoryKeyword != ''"> and category_keyword=#{categoryKeyword}</if>
<if test="categoryDescrip != null and categoryDescrip != ''"> and category_descrip=#{categoryDescrip}</if>
<if test="categoryImg != null and categoryImg != ''"> and category_img=#{categoryImg}</if>
<if test="categoryDisplay != null and categoryDisplay != ''">and category_display=#{categoryDisplay}</if>
<if test="categoryIco != null and categoryIco != ''">and category_ico=#{categoryIco}</if>
<if test="categoryDiyUrl != null and categoryDiyUrl != ''"> and category_diy_url=#{categoryDiyUrl}</if>
<if test="mdiyModelId != null and mdiyModelId != ''"> and mdiy_model_id=#{mdiyModelId}</if>
<if test="mdiyCategoryModelId != null and mdiyCategoryModelId != ''"> and mdiy_category_model_id=#{mdiyCategoryModelId}</if>
<if test="dictId != null"> and dict_id=#{dictId} </if>
<if test="categoryFlag != null and categoryFlag != ''"> and category_flag=#{categoryFlag}</if>
<if test="categoryPath != null and categoryPath != ''"> and category_path=#{categoryPath}</if>
......
......@@ -5,6 +5,7 @@
<resultMap id="resultMap" type="net.mingsoft.cms.entity.ContentEntity">
<id column="id" property="id" /><!--编号 -->
<result column="content_title" property="contentTitle" /><!--文章标题 -->
<result column="content_short_title" property="contentShortTitle" /><!--文章副标题 -->
<result column="category_id" property="categoryId" /><!--所属栏目 -->
<result column="content_type" property="contentType" /><!--文章类型 -->
<result column="content_display" property="contentDisplay" /><!--是否显示 -->
......@@ -28,6 +29,7 @@
<resultMap id="resultContentMap" type="net.mingsoft.cms.bean.ContentBean">
<id column="id" property="id" /><!--编号 -->
<result column="content_title" property="contentTitle" /><!--文章标题 -->
<result column="content_short_title" property="contentShortTitle" /><!--文章副标题 -->
<result column="category_id" property="categoryId" /><!--所属栏目 -->
<result column="content_type" property="contentType" /><!--文章类型 -->
<result column="content_display" property="contentDisplay" /><!--是否显示 -->
......@@ -54,6 +56,7 @@
<id column="article_Id" property="articleId" /><!--编号 -->
<result column="content_update_date" property="contentUpdateDate" /><!--文章更新时间-->
<result column="category_title" property="categoryTitle" /><!--栏目管理名称 -->
<result column="content_short_title" property="contentShortTitle" /><!--文章副标题 -->
<result column="category_id" property="categoryId" /><!--所属栏目 -->
<result column="category_type" property="categoryType" /><!--栏目管理属性 -->
<result column="category_sort" property="categorySort" /><!--自定义顺序 -->
......@@ -81,6 +84,7 @@
insert into cms_content
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="contentTitle != null and contentTitle != ''">content_title,</if>
<if test="contentShortTitle != null and contentShortTitle != ''">content_short_title,</if>
<if test="categoryId != null and categoryId != ''">category_id,</if>
<if test="contentType != null ">content_type,</if>
<if test="contentDisplay != null and contentDisplay != ''">content_display,</if>
......@@ -102,6 +106,7 @@
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="contentTitle != null and contentTitle != ''">#{contentTitle},</if>
<if test="contentShortTitle != null and contentShortTitle != ''">#{contentShortTitle},</if>
<if test="categoryId != null and categoryId != ''">#{categoryId},</if>
<if test="contentType != null ">#{contentType},</if>
<if test="contentDisplay != null and contentDisplay != ''">#{contentDisplay},</if>
......@@ -128,6 +133,7 @@
update cms_content
<set>
<if test="contentTitle != null and contentTitle != ''">content_title=#{contentTitle},</if>
<if test="contentShortTitle != null and contentShortTitle != ''">content_short_title=#{contentShortTitle},</if>
<if test="categoryId != null and categoryId != ''">category_id=#{categoryId},</if>
<if test="contentType != null ">content_type=#{contentType},</if>
<if test="contentDisplay != null and contentDisplay != ''">content_display=#{contentDisplay},</if>
......@@ -161,6 +167,7 @@
<where>
del=0
<if test="contentTitle != null and contentTitle != ''">and content_title like CONCAT(CONCAT('%',#{contentTitle}),'%')</if>
<if test="contentShortTitle != null and contentShortTitle != ''">and content_short_title like CONCAT(CONCAT('%',#{contentShortTitle}),'%')</if>
<if test="categoryId != null and categoryId != ''">and category_id=#{categoryId}</if>
<if test="contentType != null and contentType != ''">and content_type=#{contentType}</if>
<if test="contentDisplay != null and contentDisplay != ''">and content_display=#{contentDisplay}</if>
......@@ -219,6 +226,7 @@
<where>
ct.del=0
<if test="contentTitle != null and contentTitle != ''"> and content_title like CONCAT(CONCAT('%',#{contentTitle}),'%')</if>
<if test="contentShortTitle != null and contentShortTitle != ''"> and content_short_title like CONCAT(CONCAT('%',#{contentShortTitle}),'%')</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 and cms_category.category_type != 2))</if>
<if test="contentType != null and contentType != ''">
......@@ -256,6 +264,7 @@
<where>
ct.del=0
<if test="contentTitle != null and contentTitle != ''"> and content_title like CONCAT(CONCAT('%',#{contentTitle}),'%')</if>
<if test="contentShortTitle != null and contentShortTitle != ''"> and content_short_title like CONCAT(CONCAT('%',#{contentShortTitle}),'%')</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="contentType != null and contentType != ''">
......@@ -291,7 +300,7 @@
ct.id article_id,ct.content_img litpic,c.*,ct.update_date as content_update_date
FROM cms_content ct
LEFT JOIN cms_category c ON ct.category_id = c.id
where ct.del=0 and ct.content_display=0
where ct.del=0 and ct.content_display=0 and c.category_display='enable'
<!-- 查询子栏目数据 -->
<if test="categoryId!=null and categoryId!='' and categoryType==1">
......@@ -342,7 +351,7 @@
ct.id article_id,ct.content_img litpic,c.*
FROM cms_content ct
LEFT JOIN cms_category c ON ct.category_id = c.id
where ct.del=0
where ct.del=0 and ct.content_display=0 and c.category_display='enable'
<!-- 查询子栏目数据 -->
<if test="categoryId!=null and categoryId!='' and categoryType==1">
......
......@@ -28,6 +28,8 @@ import net.mingsoft.basic.util.BasicUtil;
import net.mingsoft.config.MSProperties;
import net.mingsoft.mdiy.util.ConfigUtil;
import java.io.File;
/**
* 分类实体
*
......@@ -59,6 +61,10 @@ public class CategoryEntity extends BaseEntity {
* 栏目管理名称
*/
private String categoryTitle;
/**
* 栏目副标题
*/
private String categoryShortTitle;
/**
* 栏目别名
*/
......@@ -93,20 +99,34 @@ public class CategoryEntity extends BaseEntity {
*/
private String categoryDescrip;
/**
* 缩略
* banner
*/
private String categoryImg;
/**
* 栏目小图
*/
private String categoryIco;
/**
* 是否显示
*/
private String categoryDisplay;
/**
* 自定义链接
*/
private String categoryDiyUrl;
/**
* 栏目管理的内容模型id
* 文章管理的内容模型id
*/
private String mdiyModelId;
/**
* 栏目管理的内容模型id
*/
private String mdiyCategoryModelId;
/**
* 字典对应编号
*/
......@@ -287,19 +307,55 @@ public class CategoryEntity extends BaseEntity {
}
/**
* 设置缩略
* 设置banner
*/
public void setCategoryImg(String categoryImg) {
this.categoryImg = categoryImg;
}
/**
* 获取缩略
* 获取banner
*/
public String getCategoryImg() {
return this.categoryImg;
}
/**
* 获取副标题
*/
public String getCategoryShortTitle() {
return categoryShortTitle;
}
/**
* 设置副标题
*/
public void setCategoryShortTitle(String categoryShortTitle) {
this.categoryShortTitle = categoryShortTitle;
}
/**
* 获取栏目小图
*/
public String getCategoryIco() {
return categoryIco;
}
/**
* 设置栏目小图
*/
public void setCategoryIco(String categoryIco) {
this.categoryIco = categoryIco;
}
public String getCategoryDisplay() {
return categoryDisplay;
}
public void setCategoryDisplay(String categoryDisplay) {
this.categoryDisplay = categoryDisplay;
}
/**
* 设置自定义链接
*/
......@@ -413,6 +469,12 @@ public class CategoryEntity extends BaseEntity {
return this.categoryFlag;
}
/**
* 获取父栏目id
*/
public String getParentid(){
return this.categoryId;
}
/**
* 获取栏目父级Id (标签使用)
*/
......@@ -483,6 +545,14 @@ public class CategoryEntity extends BaseEntity {
this.childsize = childsize;
}
public String getMdiyCategoryModelId() {
return mdiyCategoryModelId;
}
public void setMdiyCategoryModelId(String mdiyCategoryModelId) {
this.mdiyCategoryModelId = mdiyCategoryModelId;
}
/**
* 获取url路径
*
......
......@@ -58,6 +58,11 @@ private static final long serialVersionUID = 1574925152617L;
* 文章标题
*/
private String contentTitle;
/**
* 文章副标题
*/
private String contentShortTitle;
/**
* 所属栏目
*/
......@@ -135,6 +140,14 @@ private static final long serialVersionUID = 1574925152617L;
return this.contentTitle;
}
public String getContentShortTitle() {
return contentShortTitle;
}
public void setContentShortTitle(String contentShortTitle) {
this.contentShortTitle = contentShortTitle;
}
public String getCategoryId() {
return categoryId;
}
......
package net.mingsoft.cms.upgrade;
import net.mingsoft.basic.util.SpringUtil;
import net.mingsoft.cms.biz.ICategoryBiz;
import net.mingsoft.cms.entity.CategoryEntity;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author by 铭飞开源团队
* @Description
* @date 2020/6/19 15:58
*/
public class UpgradeCategory {
/**
* 更新栏目分类的顶级节点和叶子节点
*/
public void UpgradeCategory(){
ICategoryBiz categoryBiz = SpringUtil.getBean(ICategoryBiz.class);
List<CategoryEntity> list = categoryBiz.queryAll();
list.forEach(x->{
//将parentId第一行设为顶级节点
String topId = "0";
String parentId = x.getParentids();
if (parentId != null) {
topId = parentId.split(",")[0];
}
x.setTopId(topId);
String id = x.getId();
boolean leaf = true;
//判断是否叶子,循环查找,如果有节点的父节点中包含该节点的id则判断为否跳出循环
for (int i = 0; i< list.size(); i++) {
String pId = list.get(i).getParentids();
if (pId == null) {
continue;
}
leaf = !pId.contains(id);
//如果不是叶子就跳出循环,不需要再判断了
if (!leaf) {
break;
}
}
x.setLeaf(leaf);
//更新
Map<String, String> fields = new HashMap<>();
fields.put("leaf", x.getLeaf()?"1":"0");
fields.put("top_id", x.getTopId());
Map<String, String> where = new HashMap<>();
where.put("id", x.getId());
categoryBiz.updateBySQL("cms_category", fields, where);
});
}
}
......@@ -38,6 +38,7 @@ import net.mingsoft.mdiy.bean.PageBean;
import net.mingsoft.mdiy.biz.IModelBiz;
import net.mingsoft.mdiy.biz.impl.ModelBizImpl;
import net.mingsoft.mdiy.entity.ModelEntity;
import net.mingsoft.mdiy.util.ConfigUtil;
import net.mingsoft.mdiy.util.ParserUtil;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
......@@ -82,6 +83,13 @@ public class CmsParserUtil {
map.put(ParserUtil.APP_DIR, BasicUtil.getApp().getAppDir());
}
//对项目名预处理
String contextPath = BasicUtil.getContextPath();
if (StringUtils.isNotBlank(contextPath) && "/".equalsIgnoreCase(contextPath) ){
contextPath = "";
}
map.putIfAbsent(ParserUtil.CONTEXT_PATH, contextPath);
String content = ParserUtil.rendering(templatePath, map);
FileUtil.writeString(content, ParserUtil.buildHtmlPath(targetPath, htmlDir, map.get(ParserUtil.APP_DIR).toString()), Const.UTF8);
}
......@@ -130,6 +138,13 @@ public class CmsParserUtil {
parserParams.put(ParserUtil.FIELD, column);
//对项目名预处理
String contextPath = BasicUtil.getContextPath();
if (StringUtils.isNotBlank(contextPath) && "/".equalsIgnoreCase(contextPath) ){
contextPath = "";
}
parserParams.putIfAbsent(ParserUtil.CONTEXT_PATH, contextPath);
String columnListPath;
ModelEntity contentModel = null;
// 判断当前栏目是否有自定义模型
......@@ -204,6 +219,13 @@ public class CmsParserUtil {
parserParams.put(ParserUtil.HTML, htmlDir);
//对项目名预处理
String contextPath = BasicUtil.getContextPath();
if (StringUtils.isNotBlank(contextPath) && "/".equalsIgnoreCase(contextPath) ){
contextPath = "";
}
parserParams.putIfAbsent(ParserUtil.CONTEXT_PATH, contextPath);
Map<Object, Object> contentModelMap = new HashMap<Object, Object>();
ModelEntity contentModel = null;
......
spring:
datasource:
url: jdbc:mysql://localhost:3306/mcms?useUnicode=true&serverTimezone=Asia/Shanghai&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&autoReconnect=true&allowMultiQueries=true&useSSL=true
url: jdbc:mysql://192.168.0.6:3306/mcms?useUnicode=true&serverTimezone=Asia/Shanghai&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&autoReconnect=true&allowMultiQueries=true&useSSL=true
username: root
password: root
filters: wall,mergeStat
type: com.alibaba.druid.pool.DruidDataSource
ms:
mwebsite:
tables: cms_category,cms_content,mdiy_dict,mdiy_model,mdiy_page,role
\ No newline at end of file
......@@ -49,11 +49,11 @@ ms:
back-up: /upload_back
multipart:
#最大上传文件大小 单位:KB
max-file-size: 1024
max-file-size: 10240
#文件暂存临时目录
upload-temp-dir: temp
#临时文件大小
max-in-memory-size: 102400
max-in-memory-size: 10240
#总上传最大大小 单位:KB -1禁用
max-request-size: -1
......@@ -65,10 +65,6 @@ ms:
circle: 10 #干扰线条数,值越大越不容易辨别
spring:
data:
elasticsearch:
repositories:
enabled: false
main:
allow-circular-references: true
datasource:
......@@ -124,9 +120,11 @@ spring:
number_format: 0.##
mybatis-plus:
#因为IBaseDao是一个抽象类,没有实体,所以自动注入的时候不会注入,需要手动映射
mapper-locations: classpath*:/net/mingsoft/base/dao/IBaseDao.xml
global-config:
db-config:
id-type: auto
where-strategy: not_empty
where-strategy: not_empty #防止空串及null拼接条件
configuration:
database-id: mysql
This diff is collapsed.
......@@ -333,9 +333,11 @@
//新增
save: function (id, childId) {
if (id) {
location.href = this.manager + "/cms/category/form.do?id=" + id + "&childId=" + childId;
// location.href = this.manager + "/cms/category/form.do?id=" + id + "&childId=" + childId;
ms.util.openSystemUrl("/cms/category/form.do?id=" + id + "&childId=" + childId);
} else {
location.href = this.manager + "/cms/category/form.do";
// location.href = this.manager + "/cms/category/form.do";
ms.util.openSystemUrl("/cms/category/form.do");
}
},
//重置表单
......
Supports Markdown
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