Commit 644f0bdc authored by msgroup's avatar msgroup Committed by mingsoft

fix:待发布版本

Signed-off-by: 's avatarmingsoft <killfen@126.com>
parent f66c6298
...@@ -7,10 +7,10 @@ ...@@ -7,10 +7,10 @@
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so, * the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions: * subject to the following conditions:
* <p>
* The above copyright notice and this permission notice shall be included in all * The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software. * copies or substantial portions of the Software.
* <p>
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
package net.mingsoft.cms.action; package net.mingsoft.cms.action;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
...@@ -53,7 +54,7 @@ import java.util.List; ...@@ -53,7 +54,7 @@ import java.util.List;
* 创建日期:2019-11-28 15:12:32<br/> * 创建日期:2019-11-28 15:12:32<br/>
* 历史修订:<br/> * 历史修订:<br/>
*/ */
@Api(tags={"后端-内容模块接口"}) @Api(tags = {"后端-内容模块接口"})
@Controller("cmsCategoryAction") @Controller("cmsCategoryAction")
@RequestMapping("/${ms.manager.path}/cms/category") @RequestMapping("/${ms.manager.path}/cms/category")
public class CategoryAction extends BaseAction { public class CategoryAction extends BaseAction {
...@@ -71,7 +72,7 @@ public class CategoryAction extends BaseAction { ...@@ -71,7 +72,7 @@ public class CategoryAction extends BaseAction {
*/ */
@GetMapping("/index") @GetMapping("/index")
@RequiresPermissions("cms:category:view") @RequiresPermissions("cms:category:view")
public String index(){ public String index() {
return "/cms/category/index"; return "/cms/category/index";
} }
...@@ -82,15 +83,15 @@ public class CategoryAction extends BaseAction { ...@@ -82,15 +83,15 @@ public class CategoryAction extends BaseAction {
*/ */
@ApiOperation(value = "查询分类列表接口") @ApiOperation(value = "查询分类列表接口")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "categoryTitle", value = "栏目管理名称", required =false,paramType="query"), @ApiImplicitParam(name = "categoryTitle", value = "栏目管理名称", required = false, paramType = "query"),
@ApiImplicitParam(name = "categoryParentId", value = "父类型编号", required =false,paramType="query"), @ApiImplicitParam(name = "categoryParentId", value = "父类型编号", required = false, paramType = "query"),
}) })
@RequestMapping(value="/list",method = {RequestMethod.GET, RequestMethod.POST}) @RequestMapping(value = "/list", method = {RequestMethod.GET, RequestMethod.POST})
@ResponseBody @ResponseBody
public ResultData list(@ModelAttribute @ApiIgnore CategoryEntity category) { public ResultData list(@ModelAttribute @ApiIgnore CategoryEntity category) {
BasicUtil.startPage(); BasicUtil.startPage();
List categoryList = categoryBiz.query(category); List categoryList = categoryBiz.list(new LambdaQueryWrapper<CategoryEntity>(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()));
} }
/** /**
...@@ -99,7 +100,7 @@ public class CategoryAction extends BaseAction { ...@@ -99,7 +100,7 @@ public class CategoryAction extends BaseAction {
* @return * @return
*/ */
@GetMapping("/form") @GetMapping("/form")
public String form(@ModelAttribute CategoryEntity category, ModelMap model){ public String form(@ModelAttribute CategoryEntity category, ModelMap model) {
model.addAttribute("appId", BasicUtil.getApp().getAppId()); model.addAttribute("appId", BasicUtil.getApp().getAppId());
return "/cms/category/form"; return "/cms/category/form";
} }
...@@ -109,42 +110,41 @@ public class CategoryAction extends BaseAction { ...@@ -109,42 +110,41 @@ public class CategoryAction extends BaseAction {
* @param category 分类实体 * @param category 分类实体
*/ */
@ApiOperation(value = "获取分类列表接口") @ApiOperation(value = "获取分类列表接口")
@ApiImplicitParam(name = "id", value = "编号", required =true,paramType="query") @ApiImplicitParam(name = "id", value = "编号", required = true, paramType = "query")
@GetMapping("/get") @GetMapping("/get")
@RequiresPermissions("cms:category:view") @RequiresPermissions("cms:category:view")
@ResponseBody @ResponseBody
public ResultData get(@ModelAttribute @ApiIgnore CategoryEntity category){ public ResultData get(@ModelAttribute @ApiIgnore CategoryEntity category) {
if(category.getId()==null) { if (category.getId() == null) {
return ResultData.build().error(); return ResultData.build().error();
} }
CategoryEntity _category = (CategoryEntity)categoryBiz.getById(category.getId()); CategoryEntity _category = (CategoryEntity) categoryBiz.getById(category.getId());
return ResultData.build().success(_category); return ResultData.build().success(_category);
} }
/** /**
* 保存分类 * 保存分类
* @param category 分类实体 * @param category 分类实体
*/ */
@ApiOperation(value = "保存分类列表接口") @ApiOperation(value = "保存分类列表接口")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "categoryTitle", value = "栏目管理名称", required =true,paramType="query"), @ApiImplicitParam(name = "categoryTitle", value = "栏目管理名称", required = true, paramType = "query"),
@ApiImplicitParam(name = "categoryId", value = "所属栏目", required =false,paramType="query"), @ApiImplicitParam(name = "categoryId", value = "所属栏目", required = false, paramType = "query"),
@ApiImplicitParam(name = "categoryType", value = "栏目管理属性", required =false,paramType="query"), @ApiImplicitParam(name = "categoryType", value = "栏目管理属性", required = false, paramType = "query"),
@ApiImplicitParam(name = "categorySort", value = "自定义顺序", required =false,paramType="query"), @ApiImplicitParam(name = "categorySort", value = "自定义顺序", required = false, paramType = "query"),
@ApiImplicitParam(name = "categoryListUrl", value = "列表模板", required =false,paramType="query"), @ApiImplicitParam(name = "categoryListUrl", value = "列表模板", required = false, paramType = "query"),
@ApiImplicitParam(name = "categoryUrl", value = "内容模板", required =false,paramType="query"), @ApiImplicitParam(name = "categoryUrl", value = "内容模板", required = false, paramType = "query"),
@ApiImplicitParam(name = "categoryKeyword", value = "栏目管理关键字", required =false,paramType="query"), @ApiImplicitParam(name = "categoryKeyword", value = "栏目管理关键字", required = false, paramType = "query"),
@ApiImplicitParam(name = "categoryDescrip", value = "栏目管理描述", required =false,paramType="query"), @ApiImplicitParam(name = "categoryDescrip", value = "栏目管理描述", required = false, paramType = "query"),
@ApiImplicitParam(name = "categoryImg", value = "缩略图", required =false,paramType="query"), @ApiImplicitParam(name = "categoryImg", value = "缩略图", required = false, paramType = "query"),
@ApiImplicitParam(name = "categoryDiyUrl", value = "自定义链接", required =false,paramType="query"), @ApiImplicitParam(name = "categoryDiyUrl", value = "自定义链接", required = false, paramType = "query"),
@ApiImplicitParam(name = "mdiyModelId", value = "栏目管理的内容模型id", required =false,paramType="query"), @ApiImplicitParam(name = "mdiyModelId", value = "栏目管理的内容模型id", required = false, paramType = "query"),
@ApiImplicitParam(name = "categoryDatetime", value = "类别发布时间", required =false,paramType="query"), @ApiImplicitParam(name = "categoryDatetime", value = "类别发布时间", required = false, paramType = "query"),
@ApiImplicitParam(name = "dictId", value = "字典对应编号", required =false,paramType="query"), @ApiImplicitParam(name = "dictId", value = "字典对应编号", required = false, paramType = "query"),
@ApiImplicitParam(name = "categoryFlag", value = "栏目属性", required =false,paramType="query"), @ApiImplicitParam(name = "categoryFlag", value = "栏目属性", required = false, paramType = "query"),
@ApiImplicitParam(name = "categoryPath", value = "栏目路径", required =false,paramType="query"), @ApiImplicitParam(name = "categoryPath", value = "栏目路径", required = false, paramType = "query"),
@ApiImplicitParam(name = "categoryParentId", value = "父类型编号", required =false,paramType="query"), @ApiImplicitParam(name = "categoryParentId", value = "父类型编号", required = false, paramType = "query"),
}) })
@PostMapping("/save") @PostMapping("/save")
@ResponseBody @ResponseBody
...@@ -152,25 +152,28 @@ public class CategoryAction extends BaseAction { ...@@ -152,25 +152,28 @@ public class CategoryAction extends BaseAction {
@RequiresPermissions("cms:category:save") @RequiresPermissions("cms:category:save")
public ResultData save(@ModelAttribute @ApiIgnore CategoryEntity category) { public ResultData save(@ModelAttribute @ApiIgnore CategoryEntity category) {
//验证缩略图参数值是否合法 //验证缩略图参数值是否合法
if (!category.getCategoryImg().matches("^\\[.{1,}]$") || category.getCategoryImg()==null){ if (!category.getCategoryImg().matches("^\\[.{1,}]$") || category.getCategoryImg() == null) {
category.setCategoryImg(""); category.setCategoryImg("");
} }
//验证栏目管理名称的值是否合法 //验证栏目管理名称的值是否合法
if(StringUtil.isBlank(category.getCategoryTitle())){ if (StringUtil.isBlank(category.getCategoryTitle())) {
return ResultData.build().error(getResString("err.empty", this.getResString("category.title"))); return ResultData.build().error(getResString("err.empty", this.getResString("category.title")));
} }
if(!StringUtil.checkLength(category.getCategoryTitle()+"", 1, 100)){ if (!StringUtil.checkLength(category.getCategoryTitle() + "", 1, 100)) {
return ResultData.build().error(getResString("err.length", this.getResString("category.title"), "1", "100")); return ResultData.build().error(getResString("err.length", this.getResString("category.title"), "1", "100"));
} }
if(!StringUtil.checkLength(category.getCategoryPath()+"", 1, 100)){ if (!StringUtil.checkLength(category.getCategoryPath() + "", 1, 100)) {
return ResultData.build().error(getResString("err.length", this.getResString("category.path"), "1", "100")); return ResultData.build().error(getResString("err.length", this.getResString("category.path"), "1", "100"));
} }
if(!StringUtil.checkLength(category.getCategoryParentIds()+"", 1, 100)){ if (!StringUtil.checkLength(category.getCategoryParentIds() + "", 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"));
} }
//判断拼音是否重复 //判断拼音是否重复
if(StrUtil.isNotBlank(category.getCategoryPinyin())) { if (StrUtil.isNotBlank(category.getCategoryPinyin())) {
if (!category.getCategoryPinyin().matches("^[a-zA-Z0-9]*$")){
return ResultData.build().error(this.getResString("err.format"));
}
CategoryEntity _category = new CategoryEntity(); CategoryEntity _category = new CategoryEntity();
_category.setCategoryPinyin(category.getCategoryPinyin()); _category.setCategoryPinyin(category.getCategoryPinyin());
List<CategoryEntity> query = categoryBiz.query(_category); List<CategoryEntity> query = categoryBiz.query(_category);
...@@ -198,7 +201,7 @@ public class CategoryAction extends BaseAction { ...@@ -198,7 +201,7 @@ public class CategoryAction extends BaseAction {
@LogAnn(title = "删除分类", businessType = BusinessTypeEnum.DELETE) @LogAnn(title = "删除分类", businessType = BusinessTypeEnum.DELETE)
@RequiresPermissions("cms:category:del") @RequiresPermissions("cms:category:del")
public ResultData delete(@RequestBody List<CategoryEntity> categorys) { public ResultData delete(@RequestBody List<CategoryEntity> categorys) {
for(int i = 0;i<categorys.size();i++){ for (int i = 0; i < categorys.size(); i++) {
categoryBiz.delete(categorys.get(i).getId()); categoryBiz.delete(categorys.get(i).getId());
} }
return ResultData.build().success(); return ResultData.build().success();
...@@ -210,23 +213,23 @@ public class CategoryAction extends BaseAction { ...@@ -210,23 +213,23 @@ public class CategoryAction extends BaseAction {
*/ */
@ApiOperation(value = "更新分类列表接口") @ApiOperation(value = "更新分类列表接口")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "编号", required =true,paramType="query"), @ApiImplicitParam(name = "id", value = "编号", required = true, paramType = "query"),
@ApiImplicitParam(name = "categoryTitle", value = "栏目管理名称", required =true,paramType="query"), @ApiImplicitParam(name = "categoryTitle", value = "栏目管理名称", required = true, paramType = "query"),
@ApiImplicitParam(name = "categoryId", value = "所属栏目", required =false,paramType="query"), @ApiImplicitParam(name = "categoryId", value = "所属栏目", required = false, paramType = "query"),
@ApiImplicitParam(name = "categoryType", value = "栏目管理属性", required =false,paramType="query"), @ApiImplicitParam(name = "categoryType", value = "栏目管理属性", required = false, paramType = "query"),
@ApiImplicitParam(name = "categorySort", value = "自定义顺序", required =false,paramType="query"), @ApiImplicitParam(name = "categorySort", value = "自定义顺序", required = false, paramType = "query"),
@ApiImplicitParam(name = "categoryListUrl", value = "列表模板", required =false,paramType="query"), @ApiImplicitParam(name = "categoryListUrl", value = "列表模板", required = false, paramType = "query"),
@ApiImplicitParam(name = "categoryUrl", value = "内容模板", required =false,paramType="query"), @ApiImplicitParam(name = "categoryUrl", value = "内容模板", required = false, paramType = "query"),
@ApiImplicitParam(name = "categoryKeyword", value = "栏目管理关键字", required =false,paramType="query"), @ApiImplicitParam(name = "categoryKeyword", value = "栏目管理关键字", required = false, paramType = "query"),
@ApiImplicitParam(name = "categoryDescrip", value = "栏目管理描述", required =false,paramType="query"), @ApiImplicitParam(name = "categoryDescrip", value = "栏目管理描述", required = false, paramType = "query"),
@ApiImplicitParam(name = "categoryImg", value = "缩略图", required =false,paramType="query"), @ApiImplicitParam(name = "categoryImg", value = "缩略图", required = false, paramType = "query"),
@ApiImplicitParam(name = "categoryDiyUrl", value = "自定义链接", required =false,paramType="query"), @ApiImplicitParam(name = "categoryDiyUrl", value = "自定义链接", required = false, paramType = "query"),
@ApiImplicitParam(name = "mdiyModelId", value = "栏目管理的内容模型id", required =false,paramType="query"), @ApiImplicitParam(name = "mdiyModelId", value = "栏目管理的内容模型id", required = false, paramType = "query"),
@ApiImplicitParam(name = "categoryDatetime", value = "类别发布时间", required =false,paramType="query"), @ApiImplicitParam(name = "categoryDatetime", value = "类别发布时间", required = false, paramType = "query"),
@ApiImplicitParam(name = "dictId", value = "字典对应编号", required =false,paramType="query"), @ApiImplicitParam(name = "dictId", value = "字典对应编号", required = false, paramType = "query"),
@ApiImplicitParam(name = "categoryFlag", value = "栏目属性", required =false,paramType="query"), @ApiImplicitParam(name = "categoryFlag", value = "栏目属性", required = false, paramType = "query"),
@ApiImplicitParam(name = "categoryPath", value = "栏目路径", required =false,paramType="query"), @ApiImplicitParam(name = "categoryPath", value = "栏目路径", required = false, paramType = "query"),
@ApiImplicitParam(name = "categoryParentId", value = "父类型编号", required =false,paramType="query"), @ApiImplicitParam(name = "categoryParentId", value = "父类型编号", required = false, paramType = "query"),
}) })
@PostMapping("/update") @PostMapping("/update")
@ResponseBody @ResponseBody
...@@ -234,25 +237,28 @@ public class CategoryAction extends BaseAction { ...@@ -234,25 +237,28 @@ public class CategoryAction extends BaseAction {
@RequiresPermissions("cms:category:update") @RequiresPermissions("cms:category:update")
public ResultData update(@ModelAttribute @ApiIgnore CategoryEntity category) { public ResultData update(@ModelAttribute @ApiIgnore CategoryEntity category) {
//验证缩略图参数值是否合法 //验证缩略图参数值是否合法
if (!category.getCategoryImg().matches("^\\[.{1,}]$") || category.getCategoryImg()==null){ if (!category.getCategoryImg().matches("^\\[.{1,}]$") || category.getCategoryImg() == null) {
category.setCategoryImg(""); category.setCategoryImg("");
} }
//验证栏目管理名称的值是否合法 //验证栏目管理名称的值是否合法
if(StringUtil.isBlank(category.getCategoryTitle())){ if (StringUtil.isBlank(category.getCategoryTitle())) {
return ResultData.build().error(getResString("err.empty", this.getResString("category.title"))); return ResultData.build().error(getResString("err.empty", this.getResString("category.title")));
} }
if(!StringUtil.checkLength(category.getCategoryTitle()+"", 1, 100)){ if (!StringUtil.checkLength(category.getCategoryTitle() + "", 1, 100)) {
return ResultData.build().error(getResString("err.length", this.getResString("category.title"), "1", "100")); return ResultData.build().error(getResString("err.length", this.getResString("category.title"), "1", "100"));
} }
if(!StringUtil.checkLength(category.getCategoryPath()+"", 0, 100)){ if (!StringUtil.checkLength(category.getCategoryPath() + "", 0, 100)) {
return ResultData.build().error(getResString("err.length", this.getResString("category.path"), "1", "100")); return ResultData.build().error(getResString("err.length", this.getResString("category.path"), "1", "100"));
} }
if(!StringUtil.checkLength(category.getCategoryParentIds()+"", 0, 100)){ if (!StringUtil.checkLength(category.getCategoryParentIds() + "", 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"));
} }
//判断拼音是否重复并且是否和原拼音相同 //判断拼音是否重复并且是否和原拼音相同
if(StrUtil.isNotBlank(category.getCategoryPinyin()) && !categoryBiz.getById(category.getId()).getCategoryPinyin().equals(category.getCategoryPinyin())) { if (StrUtil.isNotBlank(category.getCategoryPinyin()) && !categoryBiz.getById(category.getId()).getCategoryPinyin().equals(category.getCategoryPinyin())) {
if (!category.getCategoryPinyin().matches("^[a-zA-Z0-9]*$")){
return ResultData.build().error(this.getResString("err.format"));
}
CategoryEntity _category = new CategoryEntity(); CategoryEntity _category = new CategoryEntity();
_category.setCategoryPinyin(category.getCategoryPinyin()); _category.setCategoryPinyin(category.getCategoryPinyin());
List<CategoryEntity> query = categoryBiz.query(_category); List<CategoryEntity> query = categoryBiz.query(_category);
...@@ -265,21 +271,21 @@ public class CategoryAction extends BaseAction { ...@@ -265,21 +271,21 @@ public class CategoryAction extends BaseAction {
if (StrUtil.isNotBlank(category.getCategoryPinyin())) { if (StrUtil.isNotBlank(category.getCategoryPinyin())) {
pingYin = category.getCategoryPinyin(); pingYin = category.getCategoryPinyin();
} }
CategoryEntity categoryEntity=new CategoryEntity(); CategoryEntity categoryEntity = new CategoryEntity();
categoryEntity.setCategoryPinyin(pingYin); categoryEntity.setCategoryPinyin(pingYin);
CategoryEntity categoryBizEntity = categoryBiz.getEntity(categoryEntity); CategoryEntity categoryBizEntity = categoryBiz.getEntity(categoryEntity);
category.setCategoryPinyin(pingYin); category.setCategoryPinyin(pingYin);
//如果存在此拼音栏目则拼接上id //如果存在此拼音栏目则拼接上id
if(categoryBizEntity!=null&&!categoryBizEntity.getId().equals(category.getId())){ if (categoryBizEntity != null && !categoryBizEntity.getId().equals(category.getId())) {
category.setCategoryPinyin(pingYin+category.getId()); category.setCategoryPinyin(pingYin + category.getId());
} }
//判断是否选择子级为所属栏目 //判断是否选择子级为所属栏目
CategoryEntity _category = new CategoryEntity(); CategoryEntity _category = new CategoryEntity();
_category.setId(category.getId()); _category.setId(category.getId());
List<CategoryEntity> categoryList = categoryBiz.queryChildren(_category); List<CategoryEntity> categoryList = categoryBiz.queryChildren(_category);
if(categoryList.size()>1) { if (categoryList.size() > 1) {
for(CategoryEntity item:categoryList){ for (CategoryEntity item : categoryList) {
if(item.getId().equals(category.getCategoryId())){ if (item.getId().equals(category.getCategoryId())) {
return ResultData.build().error(getResString("cannot.select.child")); return ResultData.build().error(getResString("cannot.select.child"));
} }
} }
...@@ -300,17 +306,17 @@ public class CategoryAction extends BaseAction { ...@@ -300,17 +306,17 @@ public class CategoryAction extends BaseAction {
*/ */
@ApiOperation(value = "验证拼音") @ApiOperation(value = "验证拼音")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "编号", required =true,paramType="query"), @ApiImplicitParam(name = "id", value = "编号", required = true, paramType = "query"),
@ApiImplicitParam(name = "categoryPinyin", value = "栏目管拼音", required =true,paramType="query"), @ApiImplicitParam(name = "categoryPinyin", value = "栏目管拼音", required = true, paramType = "query"),
}) })
@GetMapping("/verifyPingYin") @GetMapping("/verifyPingYin")
@ResponseBody @ResponseBody
public ResultData verifyPingYin(@ModelAttribute @ApiIgnore CategoryEntity category){ public ResultData verifyPingYin(@ModelAttribute @ApiIgnore CategoryEntity category) {
long count = categoryBiz.count(Wrappers.<CategoryEntity>lambdaQuery() long count = categoryBiz.count(Wrappers.<CategoryEntity>lambdaQuery()
.ne(StrUtil.isNotBlank(category.getId()), CategoryEntity::getId, category.getId()) .ne(StrUtil.isNotBlank(category.getId()), CategoryEntity::getId, category.getId())
.eq(CategoryEntity::getCategoryPinyin, category.getCategoryPinyin())); .eq(CategoryEntity::getCategoryPinyin, category.getCategoryPinyin()));
if(count>0){ if (count > 0) {
return ResultData.build().error("存在相同拼音的栏目"); return ResultData.build().error("存在相同拼音的栏目");
} }
return ResultData.build().success(); return ResultData.build().success();
...@@ -323,21 +329,21 @@ public class CategoryAction extends BaseAction { ...@@ -323,21 +329,21 @@ public class CategoryAction extends BaseAction {
*/ */
@ApiOperation(value = "批量更新模版") @ApiOperation(value = "批量更新模版")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "编号", required =true,paramType="query"), @ApiImplicitParam(name = "id", value = "编号", required = true, paramType = "query"),
@ApiImplicitParam(name = "dictId", value = "字典", required =true,paramType="query") @ApiImplicitParam(name = "dictId", value = "字典", required = true, paramType = "query")
}) })
@GetMapping("/updateTemplate") @GetMapping("/updateTemplate")
@ResponseBody @ResponseBody
@RequiresPermissions("cms:category:update") @RequiresPermissions("cms:category:update")
public ResultData updateTemplate(@ModelAttribute @ApiIgnore CategoryEntity category){ public ResultData updateTemplate(@ModelAttribute @ApiIgnore CategoryEntity category) {
if (category ==null || StringUtils.isEmpty(category.getId())) { if (category == null || StringUtils.isEmpty(category.getId())) {
return ResultData.build().error(getResString("err.error", this.getResString("id"))); return ResultData.build().error(getResString("err.error", this.getResString("id")));
} }
category = categoryBiz.getById(category.getId()); category = categoryBiz.getById(category.getId());
category.setCategoryParentIds(null); category.setCategoryParentIds(null);
List<CategoryEntity> childs = categoryBiz.queryChildren(category); List<CategoryEntity> childs = categoryBiz.queryChildren(category);
//更新与父节点相同类型的子栏目的模板内容 //更新与父节点相同类型的子栏目的模板内容
for (int i =0; i < childs.size(); i++) { for (int i = 0; i < childs.size(); i++) {
if (childs.get(i).getCategoryType().equals(category.getCategoryType())) { if (childs.get(i).getCategoryType().equals(category.getCategoryType())) {
childs.get(i).setCategoryUrl(category.getCategoryUrl()); childs.get(i).setCategoryUrl(category.getCategoryUrl());
childs.get(i).setCategoryListUrl(category.getCategoryListUrl()); childs.get(i).setCategoryListUrl(category.getCategoryListUrl());
...@@ -354,12 +360,12 @@ public class CategoryAction extends BaseAction { ...@@ -354,12 +360,12 @@ public class CategoryAction extends BaseAction {
*/ */
@ApiOperation(value = "复制栏目") @ApiOperation(value = "复制栏目")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "编号", required =true,paramType="query") @ApiImplicitParam(name = "id", value = "编号", required = true, paramType = "query")
}) })
@GetMapping("/copyCategory") @GetMapping("/copyCategory")
@ResponseBody @ResponseBody
@RequiresPermissions("cms:category:save") @RequiresPermissions("cms:category:save")
public ResultData copyCategory(@ModelAttribute @ApiIgnore CategoryEntity category){ public ResultData copyCategory(@ModelAttribute @ApiIgnore CategoryEntity category) {
if (category == null || StringUtils.isEmpty(category.getId())) { if (category == null || StringUtils.isEmpty(category.getId())) {
return ResultData.build().error(getResString("err.error", this.getResString("id"))); return ResultData.build().error(getResString("err.error", this.getResString("id")));
} }
......
...@@ -7,10 +7,10 @@ ...@@ -7,10 +7,10 @@
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so, * the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions: * subject to the following conditions:
* <p>
* The above copyright notice and this permission notice shall be included in all * The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software. * copies or substantial portions of the Software.
* <p>
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
...@@ -24,6 +24,11 @@ package net.mingsoft.cms.entity; ...@@ -24,6 +24,11 @@ package net.mingsoft.cms.entity;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.*;
import net.mingsoft.base.entity.BaseEntity; import net.mingsoft.base.entity.BaseEntity;
import net.mingsoft.basic.util.BasicUtil;
import net.mingsoft.config.MSProperties;
import net.mingsoft.mdiy.util.ConfigUtil;
import java.io.File;
/** /**
* 分类实体 * 分类实体
...@@ -131,6 +136,21 @@ public class CategoryEntity extends BaseEntity { ...@@ -131,6 +136,21 @@ public class CategoryEntity extends BaseEntity {
*/ */
private String topId; private String topId;
/**
* 路径url
*/
@TableField(exist = false)
private String url;
/**
* 设置url路径
*
* @param url 路径的字符串
*/
public void setUrl(String url) {
this.url = url;
}
public Boolean getLeaf() { public Boolean getLeaf() {
return leaf; return leaf;
} }
...@@ -419,7 +439,8 @@ public class CategoryEntity extends BaseEntity { ...@@ -419,7 +439,8 @@ public class CategoryEntity extends BaseEntity {
* 获取栏目Id(标签使用) * 获取栏目Id(标签使用)
*/ */
public Boolean getTypeleaf() { public Boolean getTypeleaf() {
return this.leaf; } return this.leaf;
}
/** /**
...@@ -431,6 +452,7 @@ public class CategoryEntity extends BaseEntity { ...@@ -431,6 +452,7 @@ public class CategoryEntity extends BaseEntity {
@TableField(exist = false) @TableField(exist = false)
private String typepath; private String typepath;
/** /**
* 获取栏目图片 (标签使用) * 获取栏目图片 (标签使用)
*/ */
...@@ -462,4 +484,22 @@ public class CategoryEntity extends BaseEntity { ...@@ -462,4 +484,22 @@ public class CategoryEntity extends BaseEntity {
this.childsize = childsize; this.childsize = childsize;
} }
/**
* 获取url路径
*
* @return url路径的字符串
*/
public String getUrl() {
String appDir = "";
String htmlDir = MSProperties.diy.htmlDir;
String categoryPath = this.getCategoryPath();
String categoryPinyin = this.getCategoryPinyin();
if (!(ConfigUtil.getBoolean("短链配置", "shortLinkSwitch", false))) {
//未开启短链
appDir = "/" + BasicUtil.getApp().getAppDir();
return url = "/" + htmlDir + appDir + categoryPath + "/index.html";
}
//开启短链后的url拼接
return url = "/" + htmlDir + appDir + "/" + categoryPinyin + ".html";
}
} }
...@@ -132,7 +132,8 @@ public class WebConfig implements WebMvcConfigurer { ...@@ -132,7 +132,8 @@ public class WebConfig implements WebMvcConfigurer {
@Bean @Bean
public FilterRegistrationBean xssFilterRegistration(@Value("${ms.xss.enable:true}") boolean xssEnable, public FilterRegistrationBean xssFilterRegistration(@Value("${ms.xss.enable:true}") boolean xssEnable,
@Value("${ms.xss.filter-url}") String filterUrl, @Value("${ms.xss.filter-url}") String filterUrl,
@Value("${ms.xss.exclude-url}") String excludeUrl) { @Value("${ms.xss.exclude-url}") String excludeUrl,
@Value("${ms.xss.exclude-filed}") String excludeFiled) {
XSSEscapeFilter xssFilter = new XSSEscapeFilter(); XSSEscapeFilter xssFilter = new XSSEscapeFilter();
Map<String, String> initParameters = new HashMap(); Map<String, String> initParameters = new HashMap();
FilterRegistrationBean registration = new FilterRegistrationBean(); FilterRegistrationBean registration = new FilterRegistrationBean();
...@@ -149,6 +150,9 @@ public class WebConfig implements WebMvcConfigurer { ...@@ -149,6 +150,9 @@ public class WebConfig implements WebMvcConfigurer {
}else { }else {
xssFilter.excludes.add(MSProperties.manager.path + "/**"); xssFilter.excludes.add(MSProperties.manager.path + "/**");
} }
if (excludeFiled != null && StrUtil.isNotBlank(excludeFiled)) {
xssFilter.excludesFiled.addAll(Arrays.asList(excludeFiled.split(",")));
}
initParameters.put("isIncludeRichText", "false"); initParameters.put("isIncludeRichText", "false");
registration.setInitParameters(initParameters); registration.setInitParameters(initParameters);
registration.setFilter(xssFilter); registration.setFilter(xssFilter);
......
...@@ -92,7 +92,6 @@ ...@@ -92,7 +92,6 @@
}, },
}, },
created() { created() {
this.likeTotal()
} }
}) })
</script> </script>
......
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