Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
beyond-clouds
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
4
Issues
4
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
段启岩
beyond-clouds
Commits
2d85f204
Commit
2d85f204
authored
Feb 11, 2020
by
张晋雄
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改用户昵称重复的问题
parent
ad4eb0fc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
2 deletions
+12
-2
src/main/java/cn/meteor/beyondclouds/modules/user/enums/UserErrorCode.java
+2
-1
src/main/java/cn/meteor/beyondclouds/modules/user/service/impl/UserServiceImpl.java
+9
-0
src/main/resources/application.yml
+1
-1
No files found.
src/main/java/cn/meteor/beyondclouds/modules/user/enums/UserErrorCode.java
View file @
2d85f204
...
@@ -27,7 +27,8 @@ public enum UserErrorCode implements IErrorCode {
...
@@ -27,7 +27,8 @@ public enum UserErrorCode implements IErrorCode {
BINDING_EMAIL_VERIFY_CODE_ERROR
(
10014
,
"邮箱验证码错误"
),
BINDING_EMAIL_VERIFY_CODE_ERROR
(
10014
,
"邮箱验证码错误"
),
BINDING_MOBILE_VERIFY_CODE_ERROR
(
10015
,
"手机验证码错误"
),
BINDING_MOBILE_VERIFY_CODE_ERROR
(
10015
,
"手机验证码错误"
),
NON_LOCAL_AUTH_INFO
(
10016
,
"该手机未注册"
),
NON_LOCAL_AUTH_INFO
(
10016
,
"该手机未注册"
),
USER_NOT_EXISTS
(
10017
,
"要查看的用户不存在"
);
USER_NOT_EXISTS
(
10017
,
"要查看的用户不存在"
),
USER_NICK_NAME_USED
(
10018
,
"该昵称已存在"
);
UserErrorCode
(
long
code
,
String
msg
)
{
UserErrorCode
(
long
code
,
String
msg
)
{
this
.
code
=
code
;
this
.
code
=
code
;
...
...
src/main/java/cn/meteor/beyondclouds/modules/user/service/impl/UserServiceImpl.java
View file @
2d85f204
...
@@ -214,6 +214,15 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
...
@@ -214,6 +214,15 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
boolean
userNickUpdate
=
!
StringUtils
.
isEmpty
(
user
.
getNickName
());
boolean
userNickUpdate
=
!
StringUtils
.
isEmpty
(
user
.
getNickName
());
boolean
userAvatarUpdate
=
!
StringUtils
.
isEmpty
(
user
.
getUserAvatar
());
boolean
userAvatarUpdate
=
!
StringUtils
.
isEmpty
(
user
.
getUserAvatar
());
//查询昵称是否重复
if
(
null
!=
user
.
getNickName
()){
QueryWrapper
<
User
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"nick_name"
,
user
.
getNickName
());
if
(
null
!=
getOne
(
queryWrapper
)){
throw
new
UserServiceException
(
UserErrorCode
.
USER_NICK_NAME_USED
);
}
}
updateById
(
user
);
updateById
(
user
);
if
(
userNickUpdate
)
{
if
(
userNickUpdate
)
{
...
...
src/main/resources/application.yml
View file @
2d85f204
...
@@ -4,7 +4,7 @@ spring:
...
@@ -4,7 +4,7 @@ spring:
driver-class-name
:
com.mysql.cj.jdbc.Driver
driver-class-name
:
com.mysql.cj.jdbc.Driver
url
:
jdbc:mysql://127.0.0.1:3306/beyond_clouds?useUnicode=true&characterEncoding=UTF-8&useSSL=false&allowPublicKeyRetrieval=true
url
:
jdbc:mysql://127.0.0.1:3306/beyond_clouds?useUnicode=true&characterEncoding=UTF-8&useSSL=false&allowPublicKeyRetrieval=true
username
:
root
username
:
root
password
:
197442
password
:
2018006709
# 邮箱
# 邮箱
mail
:
mail
:
...
...
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