Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
T
tianjin-cement
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
竹天卫
tianjin-cement
Commits
69704c58
Commit
69704c58
authored
May 18, 2021
by
竹天卫
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
项目编号和项目名称都要校验是否重复
parent
60f319fc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
ProjectServiceImpl.java
...e/sc/cement/business/service/impl/ProjectServiceImpl.java
+6
-4
No files found.
cement-business/src/main/java/cn/wise/sc/cement/business/service/impl/ProjectServiceImpl.java
View file @
69704c58
...
@@ -84,9 +84,11 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
...
@@ -84,9 +84,11 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
}
}
QueryWrapper
<
Project
>
qw
=
new
QueryWrapper
<>();
QueryWrapper
<
Project
>
qw
=
new
QueryWrapper
<>();
qw
.
eq
(
"name"
,
query
.
getName
());
qw
.
eq
(
"name"
,
query
.
getName
());
qw
.
or
();
qw
.
eq
(
"code"
,
query
.
getCode
());
int
count
=
projectMapper
.
selectCount
(
qw
);
int
count
=
projectMapper
.
selectCount
(
qw
);
if
(
count
>
0
)
{
if
(
count
>
0
)
{
return
BaseResponse
.
errorMsg
(
"项目
名称
已存在!"
);
return
BaseResponse
.
errorMsg
(
"项目已存在!"
);
}
}
Project
create
=
new
Project
();
Project
create
=
new
Project
();
BeanUtils
.
copyProperties
(
query
,
create
);
BeanUtils
.
copyProperties
(
query
,
create
);
...
@@ -108,11 +110,11 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
...
@@ -108,11 +110,11 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
}
}
//判断名字是否重复
//判断名字是否重复
QueryWrapper
<
Project
>
qw
=
new
QueryWrapper
<>();
QueryWrapper
<
Project
>
qw
=
new
QueryWrapper
<>();
qw
.
eq
(
"name"
,
query
.
getName
(
));
qw
.
and
(
arg
->
arg
.
ne
(
"id"
,
query
.
getId
()).
eq
(
"name"
,
query
.
getName
()
));
qw
.
ne
(
"id"
,
query
.
getId
(
));
qw
.
or
(
arg
->
arg
.
ne
(
"id"
,
query
.
getId
()).
eq
(
"code"
,
query
.
getCode
()
));
int
count
=
projectMapper
.
selectCount
(
qw
);
int
count
=
projectMapper
.
selectCount
(
qw
);
if
(
count
>
0
)
{
if
(
count
>
0
)
{
return
BaseResponse
.
errorMsg
(
"项目
名称
已存在!"
);
return
BaseResponse
.
errorMsg
(
"项目已存在!"
);
}
}
Project
update
=
new
Project
();
Project
update
=
new
Project
();
BeanUtils
.
copyProperties
(
query
,
update
);
BeanUtils
.
copyProperties
(
query
,
update
);
...
...
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