Commit b8cd62a8 authored by luzhuang's avatar luzhuang

修改对章的操作

parent bbd508e5
...@@ -31,6 +31,9 @@ public interface BChapterRepository extends BaseMapper<BChapter> { ...@@ -31,6 +31,9 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
"SELECT video_url from b_file where chapter_id = #{businessId})") "SELECT video_url from b_file where chapter_id = #{businessId})")
int removeByPrimaryKey(@Param("businessId") String businessId); int removeByPrimaryKey(@Param("businessId") String businessId);
@Update("update b_chapter set del_flag = '1' where business_id = #{businessId}")
int removeChapter(@Param("businessId") String businessId);
/** /**
* 根据id更新添加视频的时长 * 根据id更新添加视频的时长
* *
......
...@@ -412,16 +412,16 @@ public class BChapterServiceImpl implements BChapterService { ...@@ -412,16 +412,16 @@ public class BChapterServiceImpl implements BChapterService {
} }
} else {//修改 } else {//修改
BFile bFileOld = bFileRepository.selectInfoByChapterId(chapterDTO.getBusinessId()); BFile bFileOld = bFileRepository.selectInfoByChapterId(chapterDTO.getBusinessId());
if (model.getChapterLevel() == 1) {
int x = bChapterRepository.updateChapterName(model.getChapterName(), model.getBusinessId());
return new PersistModel(x);
}
if(bFileOld.getVideoUrl().equals(dto.getVideoUrl())){ if(bFileOld.getVideoUrl().equals(dto.getVideoUrl())){
dto.setPdfNum("0"); dto.setPdfNum("0");
} }
if("3".equals(dto.getType()) && dto.getPdfNum()!=null && !"".equals(dto.getPdfNum()) && Integer.parseInt(dto.getPdfNum()) > 1 ){ if("3".equals(dto.getType()) && dto.getPdfNum()!=null && !"".equals(dto.getPdfNum()) && Integer.parseInt(dto.getPdfNum()) > 1 ){
model.setChapterName(model.getChapterName()+"-1"); model.setChapterName(model.getChapterName()+"-1");
} }
if (model.getChapterLevel() == 1) {
int x = bChapterRepository.updateChapterName(model.getChapterName(), model.getBusinessId());
return new PersistModel(x);
}
UserUtil.setCurrentMergeOperation(model); UserUtil.setCurrentMergeOperation(model);
bFile.setChapterId(model.getBusinessId()); bFile.setChapterId(model.getBusinessId());
UserUtil.setCurrentMergeOperation(bFile); UserUtil.setCurrentMergeOperation(bFile);
...@@ -654,9 +654,13 @@ public class BChapterServiceImpl implements BChapterService { ...@@ -654,9 +654,13 @@ public class BChapterServiceImpl implements BChapterService {
@Override @Override
@Transactional(propagation = Propagation.REQUIRED, readOnly = false) @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public PersistModel removeBChapter(String oldId, CurUser curUser) { public PersistModel removeBChapter(String oldId, CurUser curUser) {
//根据章节id 获取与该章节oss地址相同的第一个章节id BChapter bChapter = bChapterRepository.selectByPrimaryKey(oldId);
String id = bChapterRepository.getFirstOssId(oldId); String id = oldId;
BChapter bChapter = bChapterRepository.selectByPrimaryKey(id); if(bChapter.getChapterLevel() != 1){
//根据章节id 获取与该节oss地址相同的第一个节id
id = bChapterRepository.getFirstOssId(oldId);
bChapter = bChapterRepository.selectByPrimaryKey(id);
}
String lessonId = bChapterRepository.getLessonIdBychaperId(id); String lessonId = bChapterRepository.getLessonIdBychaperId(id);
if (bChapter == null) if (bChapter == null)
throw new ServiceException(ResultServiceEnums.CHAPTER_NOT_EXISTS); throw new ServiceException(ResultServiceEnums.CHAPTER_NOT_EXISTS);
...@@ -672,6 +676,10 @@ public class BChapterServiceImpl implements BChapterService { ...@@ -672,6 +676,10 @@ public class BChapterServiceImpl implements BChapterService {
if (isChapter && hasChild) { if (isChapter && hasChild) {
throw new ServiceException(ResultServiceEnums.CHAPTER_HAS_CHILD); throw new ServiceException(ResultServiceEnums.CHAPTER_HAS_CHILD);
} }
if(isChapter){
int line = bChapterRepository.removeChapter(id);
return new PersistModel(line);
}
//获取第一节课的id 与当前id对比 //获取第一节课的id 与当前id对比
String firstId = bChapterRepository.getFirstChapter(lessonId); String firstId = bChapterRepository.getFirstChapter(lessonId);
int line = bChapterRepository.removeByPrimaryKey(id); int line = bChapterRepository.removeByPrimaryKey(id);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment