Commit 7375435e authored by luzhuang's avatar luzhuang

删除、查询 cutpdf节

parent d55febc2
......@@ -25,7 +25,10 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
* @return
*/
@Update("update b_chapter set del_flag = '1' where business_id=#{businessId}")
@Update("update b_chapter bc " +
"left join b_file bf on bc.business_id = bf.chapter_id " +
"set bc.del_flag = '1' where bf.video_url = ( " +
"SELECT video_url from b_file where chapter_id = #{businessId})")
int removeByPrimaryKey(@Param("businessId") String businessId);
/**
......@@ -83,7 +86,8 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
" bf.video_url AS videoUrl, " +
" bf.file_name AS fileName ," +
" bf.file_time AS fileTime ," +
" bf.file_size AS fileSize " +
" bf.file_size AS fileSize ," +
" if((SELECT count(0) from b_file where video_url = bf.video_url )>1,1,0) isCutPdf " +
" FROM " +
" b_chapter bc " +
" LEFT JOIN b_file bf ON bf.chapter_id = bc.business_id " +
......@@ -480,5 +484,13 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
"update b_chapter set sort = (sort+#{num}) where business_id = #{item}" +
"</foreach></script>")
int updatePdfSort(@Param("ids")List<String> ids,@Param("num")int num);
@Select("SELECT bf.chapter_id " +
"from b_file bf " +
"left join b_chapter bc on bc.business_id = bf.chapter_id " +
"where bf.video_url = (SELECT video_url from b_file where chapter_id = #{chapterId}) " +
"and bf.del_flag!=1 and bf.flag =1 " +
"ORDER BY bc.sort LIMIT 1")
String getFirstOssId(String chapterId);
}
......@@ -72,4 +72,7 @@ public class QueryChapterListResDTO {
@ApiModelProperty(value = "课程时间")
private String courseTime;
@ApiModelProperty(value = "是否是切割的节")
private String isCutPdf;
}
......@@ -658,7 +658,9 @@ public class BChapterServiceImpl implements BChapterService {
@Override
@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public PersistModel removeBChapter(String id, CurUser curUser) {
public PersistModel removeBChapter(String oldId, CurUser curUser) {
//根据章节id 获取与该章节oss地址相同的第一个章节id
String id = bChapterRepository.getFirstOssId(oldId);
BChapter bChapter = bChapterRepository.selectByPrimaryKey(id);
String lessonId = bChapterRepository.getLessonIdBychaperId(id);
if (bChapter == null)
......
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