diff --git a/src/main/java/net/mingsoft/cms/biz/impl/CategoryBizImpl.java b/src/main/java/net/mingsoft/cms/biz/impl/CategoryBizImpl.java index a3e33ada..1beb738e 100644 --- a/src/main/java/net/mingsoft/cms/biz/impl/CategoryBizImpl.java +++ b/src/main/java/net/mingsoft/cms/biz/impl/CategoryBizImpl.java @@ -22,21 +22,18 @@ The MIT License (MIT) * Copyright (c) 2019 铭飞科技 package net.mingsoft.cms.biz.impl; import cn.hutool.core.util.ObjectUtil; -import net.mingsoft.base.entity.BaseEntity; +import net.mingsoft.base.biz.impl.BaseBizImpl; +import net.mingsoft.base.dao.IBaseDao; import net.mingsoft.basic.util.BasicUtil; +import net.mingsoft.cms.biz.ICategoryBiz; +import net.mingsoft.cms.dao.ICategoryDao; import net.mingsoft.cms.entity.CategoryEntity; import net.mingsoft.cms.util.PinYinUtil; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import net.mingsoft.base.biz.impl.BaseBizImpl; -import net.mingsoft.base.dao.IBaseDao; -import java.io.File; -import java.util.*; - -import net.mingsoft.cms.biz.ICategoryBiz; -import net.mingsoft.cms.dao.ICategoryDao; +import java.util.List; /** * 分类管理持久化层 @@ -78,9 +75,12 @@ public class CategoryBizImpl extends BaseBizImpl implements ICategoryBiz { if(categoryBizEntity!=null){ categoryEntity.setCategoryPinyin(pingYin+categoryEntity.getId()); } - CategoryEntity parentCategory = (CategoryEntity)categoryDao.getEntity(Integer.parseInt(categoryEntity.getCategoryId())); + CategoryEntity parentCategory = null; + if (StringUtils.isNotBlank(categoryEntity.getCategoryId())) { + parentCategory = (CategoryEntity)categoryDao.getEntity(Integer.parseInt(categoryEntity.getCategoryId())); + } //保存链接地址 - String path=ObjectUtil.isNotNull(parentCategory)?categoryEntity.getCategoryPath():""; + String path=ObjectUtil.isNotNull(parentCategory)?parentCategory.getCategoryPath():""; categoryEntity.setCategoryPath( path+"/" + categoryEntity.getCategoryPinyin()); super.updateEntity(categoryEntity); } diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 3845212d..c9593846 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -19,6 +19,7 @@ ms: chcek-code: true #默认开启验证码验证,false验证码不验证 upload: + template: template path: upload #文件上传路径,可以根据实际写绝对路径 mapping: /upload/** #修改需要谨慎,系统第一次部署可以随意修改,如果已经有了上传数据,再次修改会导致之前上传的文件404 denied: .exe,.jsp diff --git a/src/main/webapp/WEB-INF/manager/cms/content/form.ftl b/src/main/webapp/WEB-INF/manager/cms/content/form.ftl index 083d6b59..891dde7b 100644 --- a/src/main/webapp/WEB-INF/manager/cms/content/form.ftl +++ b/src/main/webapp/WEB-INF/manager/cms/content/form.ftl @@ -369,7 +369,7 @@ var data = JSON.parse(JSON.stringify(that.form)); - if (data.contentType != null) { + if (data.contentType) { data.contentType = data.contentType.join(','); } @@ -390,7 +390,11 @@ if (that.returnIsShow) { javascript: history.go(-1); + }else { + //如果是顶级封面或封面,则重新拿到当前封面id,避免重复保存 + that.list(that.form.contentCategoryId); } + } else { that.$notify({ title: '失败',