栏目分类新增拼音
This commit is contained in:
parent
62c2ebdfb0
commit
1a95a6978e
|
@ -1,5 +1,6 @@
|
||||||
package net.mingsoft.cms.action;
|
package net.mingsoft.cms.action;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
import io.swagger.annotations.ApiImplicitParams;
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
|
@ -166,7 +167,15 @@ 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"));
|
||||||
}
|
}
|
||||||
//获取拼音
|
//判断拼音是否重复
|
||||||
|
if(StrUtil.isNotBlank(category.getCategoryPinyin())) {
|
||||||
|
CategoryEntity _category = new CategoryEntity();
|
||||||
|
_category.setCategoryPinyin(category.getCategoryPinyin());
|
||||||
|
List<CategoryEntity> query = categoryBiz.query(_category);
|
||||||
|
if (query.size() > 0) {
|
||||||
|
return ResultData.build().error(getResString("err.exist", this.getResString("category.pinyin")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
categoryBiz.saveEntity(category);
|
categoryBiz.saveEntity(category);
|
||||||
return ResultData.build().success(category);
|
return ResultData.build().success(category);
|
||||||
|
@ -238,7 +247,20 @@ 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"));
|
||||||
}
|
}
|
||||||
|
//判断拼音是否重复并且是否和原拼音相同
|
||||||
|
if(StrUtil.isNotBlank(category.getCategoryPinyin()) && !categoryBiz.getById(category.getId()).getCategoryPinyin().equals(category.getCategoryPinyin())) {
|
||||||
|
CategoryEntity _category = new CategoryEntity();
|
||||||
|
_category.setCategoryPinyin(category.getCategoryPinyin());
|
||||||
|
List<CategoryEntity> query = categoryBiz.query(_category);
|
||||||
|
if (query.size() > 0) {
|
||||||
|
return ResultData.build().error(getResString("err.exist", this.getResString("category.pinyin")));
|
||||||
|
}
|
||||||
|
}
|
||||||
String pingYin = PinYinUtil.getPingYin(category.getCategoryTitle());
|
String pingYin = PinYinUtil.getPingYin(category.getCategoryTitle());
|
||||||
|
//如果用户填写了拼音则使用用户填写的
|
||||||
|
if (StrUtil.isNotBlank(category.getCategoryPinyin())) {
|
||||||
|
pingYin = category.getCategoryPinyin();
|
||||||
|
}
|
||||||
CategoryEntity categoryEntity=new CategoryEntity();
|
CategoryEntity categoryEntity=new CategoryEntity();
|
||||||
categoryEntity.setCategoryPinyin(pingYin);
|
categoryEntity.setCategoryPinyin(pingYin);
|
||||||
CategoryEntity categoryBizEntity = (CategoryEntity)categoryBiz.getEntity(categoryEntity);
|
CategoryEntity categoryBizEntity = (CategoryEntity)categoryBiz.getEntity(categoryEntity);
|
||||||
|
|
|
@ -27,7 +27,6 @@ import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
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 net.mingsoft.basic.util.BasicUtil;
|
|
||||||
import net.mingsoft.basic.util.PinYinUtil;
|
import net.mingsoft.basic.util.PinYinUtil;
|
||||||
import net.mingsoft.cms.biz.ICategoryBiz;
|
import net.mingsoft.cms.biz.ICategoryBiz;
|
||||||
import net.mingsoft.cms.dao.ICategoryDao;
|
import net.mingsoft.cms.dao.ICategoryDao;
|
||||||
|
@ -74,6 +73,10 @@ public class CategoryBizImpl extends BaseBizImpl<ICategoryDao, CategoryEntity> i
|
||||||
public void saveEntity(CategoryEntity categoryEntity) {
|
public void saveEntity(CategoryEntity categoryEntity) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
String pingYin = PinYinUtil.getPingYin(categoryEntity.getCategoryTitle());
|
String pingYin = PinYinUtil.getPingYin(categoryEntity.getCategoryTitle());
|
||||||
|
//如果用户自己填入了拼音则使用用户的
|
||||||
|
if (StrUtil.isNotBlank(categoryEntity.getCategoryPinyin())) {
|
||||||
|
pingYin = categoryEntity.getCategoryPinyin();
|
||||||
|
}
|
||||||
CategoryEntity category=new CategoryEntity();
|
CategoryEntity category=new CategoryEntity();
|
||||||
category.setCategoryPinyin(pingYin);
|
category.setCategoryPinyin(pingYin);
|
||||||
Object categoryBizEntity = getEntity(category);
|
Object categoryBizEntity = getEntity(category);
|
||||||
|
|
|
@ -34,3 +34,4 @@ content.sort=\u81EA\u5B9A\u4E49\u987A\u5E8F
|
||||||
category.diy.url=\u81EA\u5B9A\u4E49\u94FE\u63A5
|
category.diy.url=\u81EA\u5B9A\u4E49\u94FE\u63A5
|
||||||
content.keyword=\u5173\u952E\u5B57
|
content.keyword=\u5173\u952E\u5B57
|
||||||
templet.file=\u672A\u627E\u5230\u6A21\u677F\u6587\u4EF6
|
templet.file=\u672A\u627E\u5230\u6A21\u677F\u6587\u4EF6
|
||||||
|
category.pinyin=\u62FC\u97F3
|
||||||
|
|
|
@ -169,6 +169,24 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
<el-row
|
||||||
|
:gutter="0"
|
||||||
|
justify="start" align="top">
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="栏目拼音" prop="categoryPinyin">
|
||||||
|
<el-input
|
||||||
|
v-model="form.categoryPinyin"
|
||||||
|
:disabled="false"
|
||||||
|
:readonly="false"
|
||||||
|
:style="{width: '100%'}"
|
||||||
|
:clearable="true"
|
||||||
|
placeholder="默认拼音根据名称生成">
|
||||||
|
</el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
<el-form-item label="栏目管理关键字" prop="categoryKeyword" >
|
<el-form-item label="栏目管理关键字" prop="categoryKeyword" >
|
||||||
<template slot='label'>栏目关键字
|
<template slot='label'>栏目关键字
|
||||||
<el-popover slot="label" placement="top-start" title="提示" trigger="hover">
|
<el-popover slot="label" placement="top-start" title="提示" trigger="hover">
|
||||||
|
@ -258,6 +276,8 @@
|
||||||
categoryListUrl: '',
|
categoryListUrl: '',
|
||||||
// 内容模板
|
// 内容模板
|
||||||
categoryUrl: '',
|
categoryUrl: '',
|
||||||
|
// 栏目拼音
|
||||||
|
categoryPinyin: '',
|
||||||
// 栏目管理关键字
|
// 栏目管理关键字
|
||||||
categoryKeyword: '',
|
categoryKeyword: '',
|
||||||
// 栏目管理描述
|
// 栏目管理描述
|
||||||
|
|
Loading…
Reference in New Issue