Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
education
Project
Project
Details
Activity
Releases
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
李丛阳
education
Commits
89641d4f
Commit
89641d4f
authored
Nov 05, 2019
by
zhangqingle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改接口
parent
5b483033
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
15 deletions
+25
-15
BLessonPersonRepository.java
...rcisoft/business/blesson/dao/BLessonPersonRepository.java
+1
-1
BLessonRepository.java
...a/org/rcisoft/business/blesson/dao/BLessonRepository.java
+10
-7
BLessonPersonServiceImpl.java
...siness/blesson/service/impl/BLessonPersonServiceImpl.java
+6
-3
BLessonServiceImpl.java
...oft/business/blesson/service/impl/BLessonServiceImpl.java
+8
-4
No files found.
src/main/java/org/rcisoft/business/blesson/dao/BLessonPersonRepository.java
View file @
89641d4f
...
...
@@ -298,7 +298,7 @@ public interface BLessonPersonRepository extends BaseMapper<BLessonPerson> {
@Select
(
"select count(0) x ,(select max_apply_person from b_lesson where business_id = #{lessonId} ) y "
+
"from b_lesson_person where lesson_id = #{lessonId} "
)
"from b_lesson_person where
del_flag='0' and flag = '1' and
lesson_id = #{lessonId} "
)
Map
<
String
,
Object
>
selecTraningNum
(
@Param
(
"lessonId"
)
String
lessonId
);
...
...
src/main/java/org/rcisoft/business/blesson/dao/BLessonRepository.java
View file @
89641d4f
...
...
@@ -625,15 +625,18 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
* @return
*/
@Update
(
"<script>update b_lesson set person_number = "
+
"(select count(1) from b_lesson_person where 1=1 "
+
" and del_flag != 1 and flag = 1 "
+
" and is_finish != 0 "
+
" and lesson_id = #{lessonId})"
+
" where business_id = #{lessonId} </script>"
)
int
personNumberReCount
(
String
lessonId
);
"(select count(1) from b_lesson_person blp "
+
" left join b_lesson bl on blp.lesson_id = bl.business_id "
+
" where 1=1 "
+
" and blp.del_flag != 1 and blp.flag = 1 "
+
" and bl.lesson_type = #{type} "
+
" <if test=\"type!=null and type != '' and type == '0'\">and blp.is_finish != 0 </if> "
+
" and blp.lesson_id = #{lessonId}) "
+
" where business_id = #{lessonId} </script> "
)
int
personNumberReCount
(
@Param
(
"lessonId"
)
String
lessonId
,
@Param
(
"type"
)
String
lessonType
);
/**
*
重新统计
在学人数
* 在学人数
* @param lessonId
* @return
*/
...
...
src/main/java/org/rcisoft/business/blesson/service/impl/BLessonPersonServiceImpl.java
View file @
89641d4f
...
...
@@ -58,6 +58,9 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
@Override
public
PersistModel
quit
(
QuitLessonDTO
quitLessonDTO
)
{
BLessonPerson
bLessonPerson
=
bLessonPersonRepository
.
selectById
(
quitLessonDTO
.
getBusinessId
());
BLesson
bLesson
=
new
BLesson
();
bLesson
.
setBusinessId
(
quitLessonDTO
.
getLessonId
());
bLesson
=
bLessonRepository
.
selectByPrimaryKey
(
bLesson
);
if
(
"1"
.
equals
(
bLessonPerson
.
getIsAppoint
())){
throw
new
ServiceException
(
ResultServiceEnums
.
APPOINT_NOT_CLOSE
);
}
...
...
@@ -66,7 +69,7 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
// int line = bLessonPersonRepository.quit(quitLessonDTO.getBusinessId());
int
line
=
bLessonPersonRepository
.
updateByPrimaryKeySelective
(
bLessonPerson
);
//重新统计在学人数
bLessonRepository
.
personNumberReCount
(
quitLessonDTO
.
getLessonId
());
bLessonRepository
.
personNumberReCount
(
quitLessonDTO
.
getLessonId
()
,
bLesson
.
getLessonType
()
);
return
new
PersistModel
(
line
);
}
...
...
@@ -182,7 +185,7 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
bLessonPerson
.
setIsFinish
(
"1"
);
line
=
bLessonPersonRepository
.
updateByPrimaryKeySelective
(
bLessonPerson
);
//重新统计在学人数
bLessonRepository
.
personNumberReCount
(
addMyLearnLessonDTO
.
getLessonId
());
bLessonRepository
.
personNumberReCount
(
addMyLearnLessonDTO
.
getLessonId
()
,
"0"
);
return
new
PersistModel
(
line
);
}
if
(
bLessonPersons
==
null
||
bLessonPersons
.
size
()
<
1
){
//未指派
...
...
@@ -203,7 +206,7 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
bLessonPerson
.
setPersonId
(
addMyLearnLessonDTO
.
getUserId
());
line
=
bLessonPersonRepository
.
insertBLessonPerson
(
bLessonPerson
);
//重新统计在学人数
bLessonRepository
.
personNumberReCount
(
addMyLearnLessonDTO
.
getLessonId
());
bLessonRepository
.
personNumberReCount
(
addMyLearnLessonDTO
.
getLessonId
()
,
"0"
);
return
new
PersistModel
(
line
);
}
// if (bLessonPersons != null && bLessonPersons.size()>0){
...
...
src/main/java/org/rcisoft/business/blesson/service/impl/BLessonServiceImpl.java
View file @
89641d4f
...
...
@@ -1200,6 +1200,7 @@ public class BLessonServiceImpl implements BLessonService {
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
readOnly
=
false
)
synchronized
int
trainInsert
(
String
type
,
BLesson
bLesson
,
List
<
BLessonPerson
>
bLessonPersons
){
int
line
=
0
;
if
(
"0"
.
equals
(
type
)){
Map
<
String
,
Object
>
xy
=
bLessonPersonRepository
.
selecTraningNum
(
bLesson
.
getBusinessId
());
...
...
@@ -1208,8 +1209,9 @@ public class BLessonServiceImpl implements BLessonService {
if
(
y
>
0
&&
x
>=
y
)
{
throw
new
ServiceException
(
ResultServiceEnums
.
PERSON_MAX
);
}
return
bLessonPersonRepository
.
insert
(
bLessonPersons
.
get
(
0
));
line
=
bLessonPersonRepository
.
insert
(
bLessonPersons
.
get
(
0
));
bLessonRepository
.
personNumberReCount
(
bLesson
.
getBusinessId
(),
"1"
);
return
line
;
}
if
(
"1"
.
equals
(
type
)){
//如果为培训的话 判断剩余学生加已有学生总数超过最大数 抛异常
...
...
@@ -1219,10 +1221,12 @@ public class BLessonServiceImpl implements BLessonService {
if
(
Integer
.
parseInt
(
bLesson
.
getMaxApplyPerson
())
>
0
&&
personNumber
+
bLessonPersons
.
size
()
>
Integer
.
parseInt
(
bLesson
.
getMaxApplyPerson
())){
throw
new
ServiceException
(
"培训人数上限"
+
bLesson
.
getMaxApplyPerson
()+
",现已超出"
+
String
.
valueOf
(
personNumber
+
bLessonPersons
.
size
()-
Integer
.
parseInt
(
bLesson
.
getMaxApplyPerson
())+
"人,请重新选择"
));
}
return
bLessonPersonRepository
.
insertList
(
bLessonPersons
);
line
=
bLessonPersonRepository
.
insertList
(
bLessonPersons
);
bLessonRepository
.
personNumberReCount
(
bLesson
.
getBusinessId
(),
"1"
);
return
line
;
}
}
return
0
;
return
line
;
}
}
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