Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
cms_sys
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
西魏
cms_sys
Commits
1a95a697
Commit
1a95a697
authored
Nov 03, 2020
by
xierz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
栏目分类新增拼音
parent
62c2ebdf
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
2 deletions
+48
-2
CategoryAction.java
src/main/java/net/mingsoft/cms/action/CategoryAction.java
+23
-1
CategoryBizImpl.java
src/main/java/net/mingsoft/cms/biz/impl/CategoryBizImpl.java
+4
-1
resources_zh_CN.properties
...ava/net/mingsoft/cms/resources/resources_zh_CN.properties
+1
-0
form.ftl
src/main/webapp/WEB-INF/manager/cms/category/form.ftl
+20
-0
No files found.
src/main/java/net/mingsoft/cms/action/CategoryAction.java
View file @
1a95a697
package
net
.
mingsoft
.
cms
.
action
;
import
cn.hutool.core.util.StrUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
...
...
@@ -166,7 +167,15 @@ public class CategoryAction extends BaseAction {
if
(!
StringUtil
.
checkLength
(
category
.
getCategoryParentId
()+
""
,
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
);
return
ResultData
.
build
().
success
(
category
);
...
...
@@ -238,7 +247,20 @@ public class CategoryAction extends BaseAction {
if
(!
StringUtil
.
checkLength
(
category
.
getCategoryParentId
()+
""
,
0
,
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
());
//如果用户填写了拼音则使用用户填写的
if
(
StrUtil
.
isNotBlank
(
category
.
getCategoryPinyin
()))
{
pingYin
=
category
.
getCategoryPinyin
();
}
CategoryEntity
categoryEntity
=
new
CategoryEntity
();
categoryEntity
.
setCategoryPinyin
(
pingYin
);
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;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
net.mingsoft.base.biz.impl.BaseBizImpl
;
import
net.mingsoft.base.dao.IBaseDao
;
import
net.mingsoft.basic.util.BasicUtil
;
import
net.mingsoft.basic.util.PinYinUtil
;
import
net.mingsoft.cms.biz.ICategoryBiz
;
import
net.mingsoft.cms.dao.ICategoryDao
;
...
...
@@ -74,6 +73,10 @@ public class CategoryBizImpl extends BaseBizImpl<ICategoryDao, CategoryEntity> i
public
void
saveEntity
(
CategoryEntity
categoryEntity
)
{
// TODO Auto-generated method stub
String
pingYin
=
PinYinUtil
.
getPingYin
(
categoryEntity
.
getCategoryTitle
());
//如果用户自己填入了拼音则使用用户的
if
(
StrUtil
.
isNotBlank
(
categoryEntity
.
getCategoryPinyin
()))
{
pingYin
=
categoryEntity
.
getCategoryPinyin
();
}
CategoryEntity
category
=
new
CategoryEntity
();
category
.
setCategoryPinyin
(
pingYin
);
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
category.diy.url
=
\u
81EA
\u
5B9A
\u
4E49
\u
94FE
\u
63A5
content.keyword
=
\u5173\u
952E
\u
5B57
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 @@
</el-form-item>
</el-col>
</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"
>
<template
slot=
'label'
>
栏目关键字
<el-popover
slot=
"label"
placement=
"top-start"
title=
"提示"
trigger=
"hover"
>
...
...
@@ -258,6 +276,8 @@
categoryListUrl
:
''
,
// 内容模板
categoryUrl
:
''
,
// 栏目拼音
categoryPinyin
:
''
,
// 栏目管理关键字
categoryKeyword
:
''
,
// 栏目管理描述
...
...
Write
Preview
Markdown
is supported
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