up: 更新优化

master
msgroup 2 years ago committed by mingsoft
parent a6c139d591
commit 3e0571f8cb
  1. 6
      pom.xml
  2. 1
      src/main/java/net/mingsoft/cms/action/CategoryAction.java
  3. 14
      src/main/java/net/mingsoft/cms/aop/CategoryAop.java
  4. 4
      src/main/java/net/mingsoft/cms/biz/impl/CategoryBizImpl.java
  5. 2
      src/main/java/net/mingsoft/cms/dao/ICategoryDao.xml
  6. 6
      src/main/java/net/mingsoft/cms/entity/CategoryEntity.java
  7. 45
      src/main/webapp/template/1/default/head-file.htm

@ -49,19 +49,19 @@
<dependency>
<groupId>net.mingsoft</groupId>
<artifactId>ms-basic</artifactId>
<version>2.1.20</version>
<version>2.1.20.1</version>
</dependency>
<dependency>
<groupId>net.mingsoft</groupId>
<artifactId>ms-mdiy</artifactId>
<version>2.1.20</version>
<version>2.1.20.1</version>
</dependency>
<!--store入口依赖(源码不开发),如果不需要MStore可以直接去掉依赖-->
<dependency>
<groupId>net.mingsoft</groupId>
<artifactId>store-client</artifactId>
<version>2.1.20</version>
<version>2.1.20.1</version>
</dependency>
<dependency>
<groupId>com.github.oshi</groupId>

@ -40,6 +40,7 @@ import net.mingsoft.basic.util.StringUtil;
import net.mingsoft.cms.biz.ICategoryBiz;
import net.mingsoft.cms.constant.e.CategoryTypeEnum;
import net.mingsoft.cms.entity.CategoryEntity;
import net.mingsoft.cms.entity.ContentEntity;
import net.mingsoft.mdiy.util.ParserUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;

@ -6,8 +6,13 @@
package net.mingsoft.cms.aop;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.Query;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import net.mingsoft.base.entity.ResultData;
@ -32,6 +37,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.io.File;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
@ -126,9 +132,13 @@ public class CategoryAop extends net.mingsoft.basic.aop.BaseAop {
? returnCategory.getId() : parent.getCategoryParentIds() + "," + returnCategory.getId();
if (!StringUtils.equals(returnCategory.getCategoryType(), CategoryTypeEnum.LIST.toString())) {
// 如果子栏目不为列表,将直接删除父栏目下的文章
LambdaUpdateWrapper<ContentEntity> contentDeleteWrapper = new UpdateWrapper<ContentEntity>().lambda();
LambdaQueryWrapper<ContentEntity> contentDeleteWrapper = new QueryWrapper<ContentEntity>().lambda();
contentDeleteWrapper.eq(ContentEntity::getCategoryId, parent.getId());
contentDao.delete(contentDeleteWrapper);
List<ContentEntity> list = contentDao.selectList(contentDeleteWrapper);
if (CollectionUtil.isNotEmpty(list)) {
String[] ids = ArrayUtil.toArray(list.stream().map(ContentEntity::getId).collect(Collectors.toList()), String.class);
contentDao.delete(ids);
}
}
// 将父栏目下的文章移动到子栏目下
LambdaUpdateWrapper<ContentEntity> contentWrapper = new UpdateWrapper<ContentEntity>().lambda();

@ -188,8 +188,8 @@ public class CategoryBizImpl extends BaseBizImpl<ICategoryDao, CategoryEntity> i
if (StringUtils.isEmpty(entity.getCategoryParentIds())) {
entity.setCategoryParentIds(null);
}
// categoryDao.updateEntity(entity);
categoryDao.updateById(entity);
categoryDao.updateEntity(entity);
// categoryDao.updateById(entity);
//更新子节点所有父节点id和topid
//如果本节点的topid为0(顶级栏目),则把自身的id作为子栏目的topid,非0所有的子栏目和本栏目使用同一个topid
String topId = entity.getTopId();

@ -40,7 +40,7 @@
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>
category_short_title=#{categoryShortTitle},
<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>

@ -71,7 +71,7 @@ public class CategoryEntity extends BaseEntity {
/**
* 所属栏目
*/
@TableField(insertStrategy = FieldStrategy.NOT_EMPTY, updateStrategy = FieldStrategy.NOT_EMPTY, whereStrategy = FieldStrategy.NOT_EMPTY)
@TableField(insertStrategy = FieldStrategy.IGNORED, updateStrategy = FieldStrategy.IGNORED, whereStrategy = FieldStrategy.NOT_EMPTY)
private String categoryId;
/**
* 栏目管理属性
@ -84,10 +84,12 @@ public class CategoryEntity extends BaseEntity {
/**
* 列表模板
*/
@TableField(updateStrategy = FieldStrategy.IGNORED)
private String categoryListUrl;
/**
* 内容模板
*/
@TableField(updateStrategy = FieldStrategy.IGNORED)
private String categoryUrl;
/**
* 栏目管理关键字
@ -125,11 +127,13 @@ public class CategoryEntity extends BaseEntity {
/**
* 文章管理的内容模型id
*/
@TableField(updateStrategy = FieldStrategy.IGNORED)
private String mdiyModelId;
/**
* 栏目管理的内容模型id
*/
@TableField(updateStrategy = FieldStrategy.IGNORED)
private String mdiyCategoryModelId;
/**

@ -0,0 +1,45 @@
<meta http-equiv="content-type" content="text/html">
<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
<meta name="viewport" content="initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no,width=device-width">
<meta name="format-detection" content="telephone=no">
<meta name="app-mobile-web-app-capable" content="yes">
<meta name="app-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="keywords" content="{ms:global.keyword/}">
<meta name="description" content="{ms:global.descrip/}">
<script type="text/javascript" src="{ms:global.host/}static/plugins/vue/2.6.9/vue.min.js"></script>
<link rel="stylesheet" href="{ms:global.host/}static/plugins/minireset/0.0.2/minireset.min.css">
<link rel="stylesheet" href="{ms:global.host/}static/plugins/iconfont/1.0.0/iconfont.css">
<link rel="stylesheet" href="{ms:global.host/}static/plugins/animate/4.1.0/animate.min.css">
<script src="{ms:global.host/}static/plugins/element-ui/2.15.7/index.min.js"></script>
<link rel="stylesheet" href="{ms:global.host/}static/plugins/element-ui/2.15.7/theme-chalk/index.min.css">
<link rel="stylesheet" href="{ms:global.host/}{ms:global.style/}/css/app.css">
<!--网络请求框架-->
<script src="{ms:global.host/}static/plugins/axios/0.18.0/axios.min.js"></script>
<script src="{ms:global.host/}static/plugins/qs/6.6.0/qs.min.js"></script>
<script src="{ms:global.host/}static/plugins/ms/2.0/ms.umd.js"></script>
<script src="{ms:global.host/}static/plugins/swiper/6.4.1/swiper-bundle.js"></script>
<link rel="stylesheet" href="{ms:global.host/}static/plugins/swiper/6.4.1/swiper-bundle.css">
<script>
SwiperClass = Swiper
</script>
<script src="{ms:global.host/}static/plugins/vue-awesome-swiper/4.1.1/vue-awesome-swiper.min.js"></script>
<script>
Vue.use(VueAwesomeSwiper)
</script>
<style>
:root {
--swiper-theme-color:$ {
component.config.color.value
};
}
</style>
<script>
ms.base = "";
</script>
<style>
[v-cloak]{
display: none;
}
</style>
Loading…
Cancel
Save