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
b3fbf409
Commit
b3fbf409
authored
Oct 29, 2019
by
luzhuang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
删除章节更新lesson中时长
parent
dccfd9a3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
14 deletions
+40
-14
BChapterController.java
...soft/business/bchapter/controller/BChapterController.java
+1
-1
BChapterRepository.java
...org/rcisoft/business/bchapter/dao/BChapterRepository.java
+26
-6
BChapterServiceImpl.java
...t/business/bchapter/service/impl/BChapterServiceImpl.java
+12
-3
BCourseController.java
...cisoft/business/bcourse/controller/BCourseController.java
+1
-4
No files found.
src/main/java/org/rcisoft/business/bchapter/controller/BChapterController.java
View file @
b3fbf409
...
...
@@ -76,7 +76,7 @@ public class BChapterController extends PaginationController<BChapter> {
@ApiOperation
(
value
=
"202 删除章节"
,
notes
=
"根据ID删除一条记录"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"章节Id"
,
required
=
true
,
dataType
=
"varchar"
)
@PostMapping
(
value
=
"/remove"
)
public
Result
remove
(
CurUser
curUser
,
@Valid
String
id
,
BindingResult
br
)
{
public
Result
remove
(
CurUser
curUser
,
String
id
)
{
PersistModel
data
=
bChapterService
.
removeBChapter
(
id
);
return
Result
.
builder
(
data
,
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
...
...
src/main/java/org/rcisoft/business/bchapter/dao/BChapterRepository.java
View file @
b3fbf409
...
...
@@ -365,17 +365,37 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
int
updateVideoTimeInLesson
(
@Param
(
"time"
)
String
time
,
@Param
(
"id"
)
String
id
);
/**
* 根据lessonid获取它第一
章第一
节的章节id
* 根据lessonid获取它第一节的章节id
* @param lessonId
* @return
*/
@Select
(
"SELECT business_id FROM b_chapter "
+
"WHERE pid = "
+
"( SELECT business_id FROM b_chapter "
+
"WHERE lesson_id = #{lessonId} AND chapter_level = 1 AND del_flag != 1 AND flag = 1 ORDER BY sort LIMIT 1 ) "
+
"ORDER BY sort LIMIT 1"
)
@Select
(
"select c1.business_id from b_chapter c1 "
+
"left join b_chapter c2 on c1.pid = c2.business_id "
+
"where c1.lesson_id = #{lessonId} "
+
"and c1.chapter_level = 2 "
+
"and c1.del_flag != 1 "
+
"and c1.flag = 1 "
+
"and c2.del_flag != 1 "
+
"and c2.flag = 1 "
+
"ORDER BY c2.sort ,c1.sort limit 1"
)
String
getFirstChapter
(
@Param
(
"lessonId"
)
String
lessonId
);
/**
* 更新b_lesson 表中 course_time
* @param time
* @param id
* @return
*/
@Update
(
"update b_lesson set course_time = #{time} where business_id = #{id}"
)
int
updateCourseTimeForLesson
(
@Param
(
"time"
)
String
time
,
@Param
(
"id"
)
String
id
);
/**
* 根据businessid 获取 该节 的课程时长
* @param id
* @return
*/
@Select
(
"select course_time from b_chapter where business_id = #{id}"
)
String
getTimeByChapterId
(
@Param
(
"id"
)
String
id
);
/**
* 根据章节id查询所在课程id
* @param businessId
...
...
src/main/java/org/rcisoft/business/bchapter/service/impl/BChapterServiceImpl.java
View file @
b3fbf409
...
...
@@ -240,7 +240,7 @@ public class BChapterServiceImpl implements BChapterService {
chapterDTO
.
setIsTest
(
dto
.
getType
());
line
=
bChapterRepository
.
insertSelective
(
model
);
//先判断该课程的第一
章的第一
节是否是本节 更新blesson表中course_time字段
//先判断该课程的第一节是否是本节 更新blesson表中course_time字段
String
cid
=
bChapterRepository
.
getFirstChapter
(
model
.
getLessonId
());
if
(
cid
.
equals
(
model
.
getBusinessId
()))
{
bChapterRepository
.
updateVideoTimeInLesson
(
model
.
getCourseTime
(),
model
.
getLessonId
());
...
...
@@ -314,10 +314,19 @@ public class BChapterServiceImpl implements BChapterService {
if
(
isChapter
&&
hasChild
)
{
throw
new
ServiceException
(
ResultServiceEnums
.
CHAPTER_HAS_CHILD
);
}
int
line
=
bChapterRepository
.
removeByPrimaryKey
(
id
);
String
lessonId
=
bChapterRepository
.
getLessonIdBychaperId
(
id
);
//获取第一节课的id 与当前id对比
String
firstId
=
bChapterRepository
.
getFirstChapter
(
lessonId
);
int
line
=
bChapterRepository
.
removeByPrimaryKey
(
id
);
bChapterRepository
.
updateClassHourInLesson
(
lessonId
);
if
(
firstId
.
equals
(
id
)){
//当前节为第一节 获取下一节的课程时长
String
secondId
=
bChapterRepository
.
getFirstChapter
(
lessonId
);
String
time
=
bChapterRepository
.
getTimeByChapterId
(
secondId
);
//更新到b_lesson 表
bChapterRepository
.
updateCourseTimeForLesson
(
time
,
lessonId
);
}
return
new
PersistModel
(
line
);
}
...
...
src/main/java/org/rcisoft/business/bcourse/controller/BCourseController.java
View file @
b3fbf409
...
...
@@ -19,10 +19,7 @@ import org.rcisoft.core.util.UserUtil;
import
org.rcisoft.sys.user.bean.CurUser
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.BindingResult
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.validation.Valid
;
...
...
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