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
5098fe46
Commit
5098fe46
authored
Oct 24, 2019
by
luzhuang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新代码
parent
bd0ceaed
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
196 additions
and
109 deletions
+196
-109
BLessonController.java
...cisoft/business/blesson/controller/BLessonController.java
+122
-104
BCollectRepository.java
.../org/rcisoft/business/blesson/dao/BCollectRepository.java
+20
-0
BLessonPersonRepository.java
...rcisoft/business/blesson/dao/BLessonPersonRepository.java
+6
-2
BCollect.java
...in/java/org/rcisoft/business/blesson/entity/BCollect.java
+3
-1
BLessonService.java
.../org/rcisoft/business/blesson/service/BLessonService.java
+11
-0
BLessonServiceImpl.java
...oft/business/blesson/service/impl/BLessonServiceImpl.java
+33
-2
ResultServiceEnums.java
...main/java/org/rcisoft/core/result/ResultServiceEnums.java
+1
-0
No files found.
src/main/java/org/rcisoft/business/blesson/controller/BLessonController.java
View file @
5098fe46
This diff is collapsed.
Click to expand it.
src/main/java/org/rcisoft/business/blesson/dao/BCollectRepository.java
View file @
5098fe46
package
org
.
rcisoft
.
business
.
blesson
.
dao
;
import
org.apache.ibatis.annotations.Delete
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.ResultMap
;
import
org.apache.ibatis.annotations.Select
;
import
org.rcisoft.business.blesson.dto.AddMyLearnLessonDTO
;
...
...
@@ -38,6 +40,24 @@ public interface BCollectRepository extends BaseMapper<BCollect> {
@ResultMap
(
value
=
"BaseResultMap"
)
List
<
BCollect
>
selectByPersonAndLesson
(
AddMyLearnLessonDTO
param
);
/**
* 查询关系表中是否已存在此关系
* @param personId
* @param lessonId
* @return
*/
@Select
(
"select * from b_collect where person_id =#{personId} and lesson_id =#{lessonId} "
)
List
<
BCollect
>
selectOneData
(
@Param
(
"personId"
)
String
personId
,
@Param
(
"lessonId"
)
String
lessonId
);
/**
* 取消收藏课程或培训
* @param personId
* @param lessonId
* @return
*/
@Delete
(
"delete from b_collect where person_id =#{personId} and lesson_id =#{lessonId} "
)
int
notColletLesson
(
@Param
(
"personId"
)
String
personId
,
@Param
(
"lessonId"
)
String
lessonId
);
}
src/main/java/org/rcisoft/business/blesson/dao/BLessonPersonRepository.java
View file @
5098fe46
...
...
@@ -11,6 +11,7 @@ import org.springframework.stereotype.Repository;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
@Repository
public
interface
BLessonPersonRepository
extends
BaseMapper
<
BLessonPerson
>
{
...
...
@@ -278,7 +279,10 @@ public interface BLessonPersonRepository extends BaseMapper<BLessonPerson> {
"where lesson_id= #{lessonId} and person_id=#{personId} and del_flag != 1 "
)
int
updateLessonPersonByUserId
(
BLessonPerson
lessonPerson
);
// @Insert("")
// int insertLessonPerson(BLessonPerson lessonPerson);
@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} "
)
Map
<
String
,
Object
>
selecTraningNum
(
@Param
(
"lessonId"
)
String
lessonId
);
}
src/main/java/org/rcisoft/business/blesson/entity/BCollect.java
View file @
5098fe46
...
...
@@ -18,10 +18,12 @@ import java.util.List;
@NoArgsConstructor
@AllArgsConstructor
@Table
(
name
=
"b_collect"
)
public
class
BCollect
extends
IdEntity
<
BCollect
>
{
public
class
BCollect
{
protected
String
businessId
;
private
String
personId
;
private
String
lessonId
;
...
...
src/main/java/org/rcisoft/business/blesson/service/BLessonService.java
View file @
5098fe46
...
...
@@ -235,6 +235,17 @@ public interface BLessonService{
*/
int
toTraining
(
CurUser
curUser
,
String
lessonId
);
/**
* 收藏课程或课程
* @param curUser
* @param lessonId
* @return
*/
PersistModel
colletLesson
(
CurUser
curUser
,
String
lessonId
);
PersistModel
notColletLesson
(
CurUser
curUser
,
String
lessonId
);
/**
* 单一查询我参加培训的信息
...
...
src/main/java/org/rcisoft/business/blesson/service/impl/BLessonServiceImpl.java
View file @
5098fe46
...
...
@@ -2,9 +2,11 @@ package org.rcisoft.business.blesson.service.impl;
import
com.alibaba.fastjson.JSONObject
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
io.swagger.models.auth.In
;
import
lombok.extern.slf4j.Slf4j
;
import
net.sf.json.JSONArray
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.SystemUtils
;
import
org.rcisoft.business.bcourse.dao.BCourseRepository
;
import
org.rcisoft.business.bcourse.dto.AllCourseDTO
;
import
org.rcisoft.business.bfile.dao.BTrainFileRepository
;
...
...
@@ -803,7 +805,6 @@ public class BLessonServiceImpl implements BLessonService {
// }
//插入收藏表
BCollect
bCollect
=
new
BCollect
();
UserUtil
.
setCurrentPersistOperation
(
bCollect
);
bCollect
.
setLessonId
(
lessonId
);
bCollect
.
setPersonId
(
curUser
.
getUserId
());
int
line
=
bCollectRepository
.
insertSelective
(
bCollect
);
...
...
@@ -817,7 +818,14 @@ public class BLessonServiceImpl implements BLessonService {
public
int
toTraining
(
CurUser
curUser
,
String
lessonId
)
{
BLessonPerson
person
=
new
BLessonPerson
();
BLessonPerson
bLessonPerson
=
new
BLessonPerson
();
//tep1 判断该用户是否被指派该培训或已经报名
Map
<
String
,
Object
>
xy
=
bLessonPersonRepository
.
selecTraningNum
(
lessonId
);
int
x
=
Integer
.
parseInt
(
String
.
valueOf
(
xy
.
get
(
"x"
)));
int
y
=
Integer
.
parseInt
(
String
.
valueOf
(
xy
.
get
(
"y"
)));
if
(
x
>=
y
){
throw
new
ServiceException
(
ResultServiceEnums
.
PERSON_MAX
);
}
//tep2 判断该用户是否被指派该培训或已经报名
person
=
bLessonPersonRepository
.
getAppointInTraining
(
lessonId
,
curUser
.
getUserId
());
if
(
person
!=
null
)
{
...
...
@@ -844,6 +852,29 @@ public class BLessonServiceImpl implements BLessonService {
}
@Override
public
PersistModel
colletLesson
(
CurUser
curUser
,
String
lessonId
)
{
//先判断是否收藏该课程或培训
List
<
BCollect
>
one
=
bCollectRepository
.
selectOneData
(
curUser
.
getUserId
(),
lessonId
);
if
(
one
.
size
()
>
0
){
return
new
PersistModel
(
1
);
}
BCollect
bCollect
=
new
BCollect
();
bCollect
.
setBusinessId
(
IdGen
.
uuid
());
bCollect
.
setLessonId
(
lessonId
);
bCollect
.
setPersonId
(
curUser
.
getUserId
());
int
line
=
bCollectRepository
.
insert
(
bCollect
);
return
new
PersistModel
(
line
);
}
@Override
public
PersistModel
notColletLesson
(
CurUser
curUser
,
String
lessonId
)
{
return
new
PersistModel
(
bCollectRepository
.
notColletLesson
(
curUser
.
getUserId
(),
lessonId
));
}
@Override
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
readOnly
=
false
)
public
BLesson
findOneMyTrain
(
CurUser
curUser
,
String
businessId
)
{
...
...
src/main/java/org/rcisoft/core/result/ResultServiceEnums.java
View file @
5098fe46
...
...
@@ -222,6 +222,7 @@ public enum ResultServiceEnums {
CHANGE_FILE_ERROR
(
120
,
"文件转换失败"
),
NOT_LESSON_ERROR
(
121
,
"该课程不存在"
),
JSON_ERROR
(
122
,
"JSON格式不正确"
),
PERSON_MAX
(
123
,
"报名人数已满"
),
;
...
...
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