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
67e2c9e8
Commit
67e2c9e8
authored
Dec 18, 2017
by
YangZhaoJun1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
简化代码
parent
2b37d575
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
34 deletions
+14
-34
BChapterServiceImpl.java
...t/business/bchapter/service/impl/BChapterServiceImpl.java
+14
-34
No files found.
src/main/java/org/rcisoft/business/bchapter/service/impl/BChapterServiceImpl.java
View file @
67e2c9e8
...
...
@@ -174,59 +174,39 @@ public class BChapterServiceImpl implements BChapterService {
throw
new
ServiceException
(
ResultServiceEnums
.
UPDATE_ERROR
);
}
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
readOnly
=
false
)
@Override
public
int
addBslFormLesson
(
String
bLseeonId
,
String
lessonCode
,
String
slId
)
{
//获取课程的章节列表
List
<
BChapter
>
lessonList
=
bChapterRepository
.
queryChapterByLessonId
(
bLseeonId
);
//new一个章的list
List
<
BChapter
>
chapterList
=
new
ArrayList
<>();
//map存放章的ID(key:章名称 value:新的章ID)
Map
map
=
new
HashMap
();
for
(
int
i
=
0
;
i
<
lessonList
.
size
();
i
++){
BChapter
sl_chapter
=
new
BChapter
();
sl_chapter
.
setSlId
(
slId
);
sl_chapter
.
setChapterName
(
lessonList
.
get
(
i
).
getChapterName
());
sl_chapter
.
setChapterLevel
(
lessonList
.
get
(
i
).
getChapterLevel
());
sl_chapter
.
setChapterUrl
(
lessonList
.
get
(
i
).
getChapterUrl
());
sl_chapter
.
setMdFile
(
lessonList
.
get
(
i
).
getMdFile
());
sl_chapter
.
setIsTest
(
lessonList
.
get
(
i
).
getIsTest
());
sl_chapter
.
setLessonOrSl
(
"0"
);
UserUtil
.
setCurrentPersistOperation
(
sl_chapter
);
if
(
lessonList
.
get
(
i
).
getPid
().
equals
(
"-1"
)){
sl_chapter
.
setPid
(
lessonList
.
get
(
i
).
getPid
());
sl_chapter
.
setSlId
(
slId
);
sl_chapter
.
setChapterName
(
lessonList
.
get
(
i
).
getChapterName
());
sl_chapter
.
setChapterLevel
(
lessonList
.
get
(
i
).
getChapterLevel
());
sl_chapter
.
setChapterUrl
(
lessonList
.
get
(
i
).
getChapterUrl
());
sl_chapter
.
setMdFile
(
lessonList
.
get
(
i
).
getMdFile
());
sl_chapter
.
setIsTest
(
lessonList
.
get
(
i
).
getIsTest
());
sl_chapter
.
setLessonOrSl
(
"0"
);
UserUtil
.
setCurrentPersistOperation
(
sl_chapter
);
chapterList
.
add
(
sl_chapter
);
map
.
put
(
sl_chapter
.
getChapterName
(),
sl_chapter
.
getBusinessId
());
}
chapterList
.
add
(
sl_chapter
);
}
//先把章插入
int
chapter
=
bChapterRepository
.
insertChapterList
(
chapterList
);
//new一个节的list
List
<
BChapter
>
sectionList
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
lessonList
.
size
();
i
++){
for
(
int
i
=
0
;
i
<
chapterList
.
size
();
i
++){
BChapter
sl_chapter
=
new
BChapter
();
if
(!
lesson
List
.
get
(
i
).
getPid
().
equals
(
"-1"
)){
if
(!
chapter
List
.
get
(
i
).
getPid
().
equals
(
"-1"
)){
//根据父ID获取父节点章节名称
String
chapterName
=
bChapterRepository
.
selectChapterNameByPid
(
lessonList
.
get
(
i
).
getPid
());
//取出map中存放的新的章ID作为父节点ID
sl_chapter
.
setPid
(
String
.
valueOf
(
map
.
get
(
chapterName
)));
sl_chapter
.
setSlId
(
slId
);
sl_chapter
.
setChapterName
(
lessonList
.
get
(
i
).
getChapterName
());
sl_chapter
.
setChapterLevel
(
lessonList
.
get
(
i
).
getChapterLevel
());
sl_chapter
.
setChapterUrl
(
lessonList
.
get
(
i
).
getChapterUrl
());
sl_chapter
.
setMdFile
(
lessonList
.
get
(
i
).
getMdFile
());
sl_chapter
.
setIsTest
(
lessonList
.
get
(
i
).
getIsTest
());
sl_chapter
.
setLessonOrSl
(
"0"
);
UserUtil
.
setCurrentPersistOperation
(
sl_chapter
);
sectionList
.
add
(
sl_chapter
);
chapterList
.
get
(
i
).
setPid
(
String
.
valueOf
(
map
.
get
(
chapterName
)));
}
}
//执行插入节操作
int
section
=
bChapterRepository
.
insertChapterList
(
sectionList
);
if
(
chapter
!=
0
&&
section
!=
0
){
return
1
;
}
else
{
return
0
;
}
return
bChapterRepository
.
insertChapterList
(
chapterList
);
}
}
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