Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
MCMS
Commits
1a95a697
Commit
1a95a697
authored
Nov 03, 2020
by
xierz
Browse files
栏目分类新增拼音
parent
62c2ebdf
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/main/java/net/mingsoft/cms/action/CategoryAction.java
View file @
1a95a697
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 {
...
@@ -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 {
...
@@ -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
);
...
...
src/main/java/net/mingsoft/cms/biz/impl/CategoryBizImpl.java
View file @
1a95a697
...
@@ -27,7 +27,6 @@ import cn.hutool.core.util.StrUtil;
...
@@ -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
...
@@ -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
);
...
...
src/main/java/net/mingsoft/cms/resources/resources_zh_CN.properties
View file @
1a95a697
...
@@ -34,3 +34,4 @@ content.sort=\u81EA\u5B9A\u4E49\u987A\u5E8F
...
@@ -34,3 +34,4 @@ content.sort=\u81EA\u5B9A\u4E49\u987A\u5E8F
category.diy.url
=
\u
81EA
\u
5B9A
\u
4E49
\u
94FE
\u
63A5
category.diy.url
=
\u
81EA
\u
5B9A
\u
4E49
\u
94FE
\u
63A5
content.keyword
=
\u5173\u
952E
\u
5B57
content.keyword
=
\u5173\u
952E
\u
5B57
templet.file
=
\u
672A
\u
627E
\u5230\u
6A21
\u
677F
\u6587\u
4EF6
templet.file
=
\u
672A
\u
627E
\u5230\u
6A21
\u
677F
\u6587\u
4EF6
category.pinyin
=
\u
62FC
\u
97F3
src/main/webapp/WEB-INF/manager/cms/category/form.ftl
View file @
1a95a697
...
@@ -169,6 +169,24 @@
...
@@ -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 @@
...
@@ -258,6 +276,8 @@
categoryListUrl
:
''
,
categoryListUrl
:
''
,
//
内容模板
//
内容模板
categoryUrl
:
''
,
categoryUrl
:
''
,
//
栏目拼音
categoryPinyin
:
''
,
//
栏目管理关键字
//
栏目管理关键字
categoryKeyword
:
''
,
categoryKeyword
:
''
,
//
栏目管理描述
//
栏目管理描述
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment