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
3e14381e
Commit
3e14381e
authored
Apr 06, 2020
by
luzhuang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改节
parent
7375435e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
45 deletions
+43
-45
BChapterRepository.java
...org/rcisoft/business/bchapter/dao/BChapterRepository.java
+3
-2
BChapterServiceImpl.java
...t/business/bchapter/service/impl/BChapterServiceImpl.java
+40
-43
No files found.
src/main/java/org/rcisoft/business/bchapter/dao/BChapterRepository.java
View file @
3e14381e
...
...
@@ -460,13 +460,14 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
* @param chapterId
* @return
*/
@Select
(
"SELECT
business_id
"
+
@Select
(
"SELECT
*
"
+
"from b_chapter where business_id in( "
+
" SELECT chapter_id from b_file where video_url = ( "
+
" select video_url from b_file where chapter_id = #{chapterId} and del_flag != 1 and flag =1) "
+
" and del_flag != 1 and flag =1) "
+
"ORDER BY sort"
)
List
<
String
>
getPdfIdList
(
@Param
(
"chapterId"
)
String
chapterId
);
@ResultMap
(
value
=
"BaseResultMap"
)
List
<
BChapter
>
getPdfIdList
(
@Param
(
"chapterId"
)
String
chapterId
);
/**
* 新增节时 pdf分节查询出之前 排序大于修改节的chapterId
...
...
src/main/java/org/rcisoft/business/bchapter/service/impl/BChapterServiceImpl.java
View file @
3e14381e
...
...
@@ -412,6 +412,9 @@ public class BChapterServiceImpl implements BChapterService {
}
}
else
{
//修改
BFile
bFileOld
=
bFileRepository
.
selectInfoByChapterId
(
chapterDTO
.
getBusinessId
());
if
(
bFileOld
.
getVideoUrl
().
equals
(
dto
.
getVideoUrl
())){
dto
.
setPdfNum
(
"0"
);
}
if
(
"3"
.
equals
(
model
.
getIsTest
())
&&
dto
.
getPdfNum
()!=
null
&&
Integer
.
parseInt
(
dto
.
getPdfNum
())
>
1
){
model
.
setChapterName
(
model
.
getChapterName
()+
"-1"
);
}
...
...
@@ -437,38 +440,29 @@ public class BChapterServiceImpl implements BChapterService {
bChapterRepository
.
updateVideoTimeInLesson
(
model
.
getCourseTime
(),
model
.
getLessonId
());
}
//判断修改前后pid是否发生改变
BChapter
bChapter
=
bChapterRepository
.
selectByPrimaryKey
(
model
.
getBusinessId
());
BChapter
bChapter
=
bChapterRepository
.
selectByPrimaryKey
(
model
.
getBusinessId
());
//获取当前节的信息
if
(
bChapter
!=
null
&&
!
bChapter
.
getPid
().
equals
(
model
.
getPid
()))
{
line
=
bChapterRepository
.
updateByPrimaryKeySelective
(
model
);
//更新修改之前章中节的sort
List
<
String
>
chapterIds
=
bChapterRepository
.
getChapterIds
(
bChapter
.
getPid
(),
bChapter
.
getLessonId
());
if
(
chapterIds
!=
null
&&
chapterIds
.
size
()
>
0
)
{
List
<
Map
<
String
,
Object
>>
params
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
chapterIds
.
size
();
i
++)
{
Map
<
String
,
Object
>
map
=
new
HashedMap
();
map
.
put
(
"businessId"
,
chapterIds
.
get
(
i
));
map
.
put
(
"sort"
,
i
+
1
);
params
.
add
(
map
);
}
//更新表中sort
bChapterRepository
.
updateSort
(
params
);
}
int
sort
=
bChapterRepository
.
selectMaxSort
(
model
.
getPid
(),
model
.
getLessonId
());
model
.
setSort
(
sort
);
line
=
bChapterRepository
.
updateByPrimaryKeySelective
(
model
);
//更新修改之后章中节的sort
List
<
String
>
chapterIds2
=
bChapterRepository
.
getChapterIds
(
model
.
getPid
(),
model
.
getLessonId
());
if
(
chapterIds2
!=
null
&&
chapterIds2
.
size
()
>
0
)
{
List
<
Map
<
String
,
Object
>>
params
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
chapterIds2
.
size
();
i
++)
{
Map
<
String
,
Object
>
map
=
new
HashedMap
();
map
.
put
(
"businessId"
,
chapterIds2
.
get
(
i
));
map
.
put
(
"sort"
,
i
+
1
);
params
.
add
(
map
);
List
<
BChapter
>
cutPdfChapterList
=
bChapterRepository
.
getPdfIdList
(
model
.
getBusinessId
()
);
int
i
=
1
;
if
(
cutPdfChapterList
!=
null
&&
cutPdfChapterList
.
size
()
>
1
){
for
(
BChapter
b:
cutPdfChapterList
)
{
if
(
b
.
getBusinessId
().
equals
(
model
.
getBusinessId
())){
b
.
setChapterName
(
model
.
getChapterName
());
}
b
.
setPid
(
model
.
getPid
(
));
b
.
setSort
(
sort
+
i
++
);
bChapterRepository
.
updateByPrimaryKeySelective
(
b
);
}
//更新表中sort
bChapterRepository
.
updateSort
(
params
);
}
else
{
bChapterRepository
.
updateByPrimaryKeySelective
(
model
);
}
//更新修改之前 章中节的sort
reSort
(
bChapter
.
getPid
(),
bChapter
.
getLessonId
());
//更新修改之后 章中节的sort
reSort
(
model
.
getPid
(),
model
.
getLessonId
());
}
else
{
line
=
bChapterRepository
.
updateByPrimaryKeySelective
(
model
);
}
...
...
@@ -701,18 +695,7 @@ public class BChapterServiceImpl implements BChapterService {
// brStudentChapterRepository.deleteByPrimaryKey(queryChapterListResDTO.getBRSBusinessId());
// }
//更新表中sort
List
<
String
>
chapterIds
=
bChapterRepository
.
getChapterIds
(
bChapter
.
getPid
(),
bChapter
.
getLessonId
());
if
(
chapterIds
!=
null
&&
chapterIds
.
size
()
>
0
)
{
List
<
Map
<
String
,
Object
>>
params
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
chapterIds
.
size
();
i
++)
{
Map
<
String
,
Object
>
map
=
new
HashedMap
();
map
.
put
(
"businessId"
,
chapterIds
.
get
(
i
));
map
.
put
(
"sort"
,
i
+
1
);
params
.
add
(
map
);
}
//更新表中sort
bChapterRepository
.
updateSort
(
params
);
}
reSort
(
bChapter
.
getPid
(),
bChapter
.
getLessonId
());
// List<BRStudentChapter> brStudentChapterList = brStudentChapterRepository.queryByStuIdAndChapter(id, curUser.getUserId());
// 判断 2-节 才重新计算进度
...
...
@@ -912,11 +895,11 @@ public class BChapterServiceImpl implements BChapterService {
}
}
else
{
//step1 根据章节id获取对应 文件的序号 x
List
<
String
>
chapterIds
=
bChapterRepository
.
getPdfIdList
(
bFile
.
getChapterId
());
List
<
BChapter
>
chapterIds
=
bChapterRepository
.
getPdfIdList
(
bFile
.
getChapterId
());
int
x
=
0
;
for
(
String
s
:
chapterIds
){
for
(
BChapter
b
:
chapterIds
){
x
++;
if
(
s
.
equals
(
bFile
.
getChapterId
())){
if
(
b
.
getBusinessId
()
.
equals
(
bFile
.
getChapterId
())){
break
;
}
}
...
...
@@ -1244,5 +1227,19 @@ public class BChapterServiceImpl implements BChapterService {
return
result
;
}
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
readOnly
=
false
)
public
void
reSort
(
String
pid
,
String
lessonId
){
List
<
String
>
chapterIds
=
bChapterRepository
.
getChapterIds
(
pid
,
lessonId
);
if
(
chapterIds
!=
null
&&
chapterIds
.
size
()
>
0
)
{
List
<
Map
<
String
,
Object
>>
params
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
chapterIds
.
size
();
i
++)
{
Map
<
String
,
Object
>
map
=
new
HashedMap
();
map
.
put
(
"businessId"
,
chapterIds
.
get
(
i
));
map
.
put
(
"sort"
,
i
+
1
);
params
.
add
(
map
);
}
//更新表中sort
bChapterRepository
.
updateSort
(
params
);
}
}
}
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