Commit acb2a401 authored by liuyuanjun's avatar liuyuanjun

修改查询接口sql

parent 4bd9d2b3
...@@ -182,9 +182,10 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -182,9 +182,10 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" left join b_viewrange_son bvs on bv.business_id = bvs.viewrange_id " + " left join b_viewrange_son bvs on bv.business_id = bvs.viewrange_id " +
// " left join b_course bc on bc.business_id = bl.course_id " + // " left join b_course bc on bc.business_id = bl.course_id " +
" left join b_lesson_corp blc on blc.lesson_id = bl.business_id and bl.corp_id = '###' " +
" where bl.del_flag != 1 and bl.flag = 1 " + " where bl.del_flag != 1 and bl.flag = 1 " +
" and bl.corp_id = #{curUser.corpId} "+ " and (bl.corp_id = #{curUser.corpId} or blc.corp_id = #{curUser.corpId})"+
" and bl.release_state = 2 " + " and bl.release_state = 2 " +
" and ((bvs.type = 0 and bvs.target_id = #{curUser.userId}) " + " and ((bvs.type = 0 and bvs.target_id = #{curUser.userId}) " +
...@@ -222,8 +223,8 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -222,8 +223,8 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" left join b_recommend_son brs on br.business_id = brs.recommend_id " + " left join b_recommend_son brs on br.business_id = brs.recommend_id " +
// " left join b_course bc on bc.business_id = bl.course_id " + // " left join b_course bc on bc.business_id = bl.course_id " +
" left join b_lesson_corp blc on blc.lesson_id = bl.business_id and bl.corp_id = '###' " + " left join b_lesson_corp blc on blc.lesson_id = bl.business_id and bl.corp_id = '###' " +
" where bl.del_flag != 1 and bl.flag = 1 " + " where (bl.corp_id = #{curUser.corpId} or blc.corp_id = #{curUser.corpId}) " +
" and (bl.corp_id = #{curUser.corpId} or blc.corp_id = #{curUser.corpId}) "+ " and bl.del_flag != 1 and bl.flag = 1 "+
" and bl.release_state = 2 " + " and bl.release_state = 2 " +
" and ((brs.type = 0 and brs.target_id = #{curUser.userId}) " + " and ((brs.type = 0 and brs.target_id = #{curUser.userId}) " +
" <if test=\"departs != null and departs.size() > 0 \"> " + " <if test=\"departs != null and departs.size() > 0 \"> " +
...@@ -263,10 +264,9 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -263,10 +264,9 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" left join b_viewrange_son bvs on bv.business_id = bvs.viewrange_id " + " left join b_viewrange_son bvs on bv.business_id = bvs.viewrange_id " +
// " left join b_course bc on bc.business_id = bl.course_id " + // " left join b_course bc on bc.business_id = bl.course_id " +
" left join b_lesson_corp blc on blc.lesson_id = bl.business_id and bl.corp_id = '###' " +
" where bl.del_flag != 1 and bl.flag = 1 " + " where bl.del_flag != 1 and bl.flag = 1 " +
" and (bl.corp_id = #{curUser.corpId} or blc.corp_id = #{curUser.corpId}) "+
" and bl.corp_id = #{curUser.corpId} "+
" and bl.release_state = 2 " + " and bl.release_state = 2 " +
" and ((bvs.type = 0 and bvs.target_id = #{curUser.userId}) " + " and ((bvs.type = 0 and bvs.target_id = #{curUser.userId}) " +
" or (bl.lecturer_id = #{curUser.userId}) " + " or (bl.lecturer_id = #{curUser.userId}) " +
...@@ -324,9 +324,10 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -324,9 +324,10 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" and bv.corp_id = #{curUser.corpId} "+ " and bv.corp_id = #{curUser.corpId} "+
" left join b_viewrange_son bvs on bv.business_id = bvs.viewrange_id " + " left join b_viewrange_son bvs on bv.business_id = bvs.viewrange_id " +
" left join b_lesson_corp blc on blc.lesson_id = b.business_id and b.corp_id = '###' " +
" where b.del_flag != 1 and b.flag = 1 " + " where b.del_flag != 1 and b.flag = 1 " +
" and b.corp_id = #{curUser.corpId} "+ " and (b.corp_id = #{curUser.corpId} or blc.corp_id = #{curUser.corpId})"+
" and b.business_id not in (SELECT DISTINCT b.business_id from " + " and b.business_id not in (SELECT DISTINCT b.business_id from " +
" b_lesson b left join b_lesson_person blp on b.business_id = blp.lesson_id " + " b_lesson b left join b_lesson_person blp on b.business_id = blp.lesson_id " +
...@@ -826,25 +827,18 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -826,25 +827,18 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" from b_lesson bl " + " from b_lesson bl " +
" left join s_user su on su.business_id = bl.lecturer_id " + " left join s_user su on su.business_id = bl.lecturer_id " +
// " and su.del_flag != 1 and su.flag = 1 " + // " and su.del_flag != 1 and su.flag = 1 " +
" and su.corp_id = #{model.corpId} "+ " and su.corp_id = #{model.corpId} "+
" left join s_user suc on suc.business_id = bl.create_by " + " left join s_user suc on suc.business_id = bl.create_by " +
// " and suc.del_flag != 1 and suc.flag = 1 " + // " and suc.del_flag != 1 and suc.flag = 1 " +
" and suc.corp_id = #{model.corpId} "+ " and suc.corp_id = #{model.corpId} "+
" left join b_viewrange bv on bl.business_id = bv.lesson_id " + " left join b_viewrange bv on bl.business_id = bv.lesson_id " +
" and bv.del_flag != 1 and bv.flag = 1 " + " and bv.del_flag != 1 and bv.flag = 1 " +
" and bv.corp_id = #{model.corpId} "+ " and bv.corp_id = #{model.corpId} "+
" left join b_viewrange_son bvs on bv.business_id = bvs.viewrange_id " + " left join b_viewrange_son bvs on bv.business_id = bvs.viewrange_id " +
" left join b_lesson_label bll on bl.business_id = bll.lesson_id " + " left join b_lesson_label bll on bl.business_id = bll.lesson_id " +
" left join b_lesson_corp blc on blc.lesson_id = bl.business_id and bl.corp_id = '###' " +
" where bl.del_flag != 1 and bl.flag = 1 " + " where bl.del_flag != 1 and bl.flag = 1 " +
" and (bl.corp_id = #{model.corpId} or blc.corp_id = #{model.corpId}) "+
" and bl.corp_id = #{model.corpId} "+
" <if test=\"model.valueScreen !=null and model.valueScreen != ''\"> ${model.valueScreen} </if>" + " <if test=\"model.valueScreen !=null and model.valueScreen != ''\"> ${model.valueScreen} </if>" +
" <if test=\"model.labelId !=null and model.labelId != ''\">and bll.label_id = #{model.labelId}</if>" + " <if test=\"model.labelId !=null and model.labelId != ''\">and bll.label_id = #{model.labelId}</if>" +
" <if test=\"model.lessonType !=null and model.lessonType != ''\">and bl.lesson_type = #{model.lessonType}</if>" + " <if test=\"model.lessonType !=null and model.lessonType != ''\">and bl.lesson_type = #{model.lessonType}</if>" +
...@@ -898,9 +892,9 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -898,9 +892,9 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" left join b_recommend_son brs on br.business_id = brs.recommend_id " + " left join b_recommend_son brs on br.business_id = brs.recommend_id " +
" left join b_lesson_label bll on bl.business_id = bll.lesson_id " + " left join b_lesson_label bll on bl.business_id = bll.lesson_id " +
" left join b_lesson_corp blc on blc.lesson_id = bl.business_id and bl.corp_id = '###' " +
" where bl.del_flag != 1 and bl.flag = 1 " + " where bl.del_flag != 1 and bl.flag = 1 " +
" and (bl.corp_id = #{model.corpId} or blc.corp_id = #{model.corpId}) "+
" and bl.corp_id = #{model.corpId} "+
" <if test=\"model.valueScreen !=null and model.valueScreen != ''\"> ${model.valueScreen} </if>" + " <if test=\"model.valueScreen !=null and model.valueScreen != ''\"> ${model.valueScreen} </if>" +
" <if test=\"model.labelId !=null and model.labelId != ''\">and bll.label_id = #{model.labelId}</if>" + " <if test=\"model.labelId !=null and model.labelId != ''\">and bll.label_id = #{model.labelId}</if>" +
...@@ -957,9 +951,9 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -957,9 +951,9 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" left join b_viewrange_son bvs on bv.business_id = bvs.viewrange_id " + " left join b_viewrange_son bvs on bv.business_id = bvs.viewrange_id " +
" left join b_lesson_label bll on bl.business_id = bll.lesson_id " + " left join b_lesson_label bll on bl.business_id = bll.lesson_id " +
// " left join b_course bc on bc.business_id = bl.course_id " + // " left join b_course bc on bc.business_id = bl.course_id " +
" left join b_lesson_corp blc on blc.lesson_id = bl.business_id and bl.corp_id = '###' " +
" where bl.del_flag != 1 and bl.flag = 1 " + " where bl.del_flag != 1 and bl.flag = 1 " +
" and (bl.corp_id = #{model.corpId} or blc.corp_id = #{model.corpId}) "+
" and bl.corp_id = #{model.corpId} "+
" <if test=\"model.valueScreen !=null and model.valueScreen != ''\"> ${model.valueScreen} </if>" + " <if test=\"model.valueScreen !=null and model.valueScreen != ''\"> ${model.valueScreen} </if>" +
" <if test=\"model.labelId !=null and model.labelId != ''\">and bll.label_id = #{model.labelId}</if>" + " <if test=\"model.labelId !=null and model.labelId != ''\">and bll.label_id = #{model.labelId}</if>" +
...@@ -1016,10 +1010,9 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -1016,10 +1010,9 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" left join b_viewrange_son bvs on bv.business_id = bvs.viewrange_id " + " left join b_viewrange_son bvs on bv.business_id = bvs.viewrange_id " +
" left join b_lesson_label bll on bl.business_id = bll.lesson_id " + " left join b_lesson_label bll on bl.business_id = bll.lesson_id " +
" left join b_lesson_corp blc on blc.lesson_id = bl.business_id and bl.corp_id = '###' " +
" where bl.del_flag != 1 and bl.flag = 1 " + " where bl.del_flag != 1 and bl.flag = 1 " +
" and (bl.corp_id = #{model.corpId} or blc.corp_id = #{model.corpId}) "+
" and bl.corp_id = #{model.corpId} "+
" <if test=\"model.valueScreen !=null and model.valueScreen != ''\"> ${model.valueScreen} </if>" + " <if test=\"model.valueScreen !=null and model.valueScreen != ''\"> ${model.valueScreen} </if>" +
" <if test=\"model.labelId !=null and model.labelId != ''\">and bll.label_id = #{model.labelId}</if>" + " <if test=\"model.labelId !=null and model.labelId != ''\">and bll.label_id = #{model.labelId}</if>" +
" <if test=\"model.lessonType !=null and model.lessonType != ''\">and bl.lesson_type = #{model.lessonType}</if>" + " <if test=\"model.lessonType !=null and model.lessonType != ''\">and bl.lesson_type = #{model.lessonType}</if>" +
...@@ -1069,33 +1062,24 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -1069,33 +1062,24 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" bp.person_id = #{model.userId} " + " bp.person_id = #{model.userId} " +
" and b.del_flag != 1 and b.flag = 1 " + " and b.del_flag != 1 and b.flag = 1 " +
" and bp.del_flag != 1 and bp.flag = 1 " + " and bp.del_flag != 1 and bp.flag = 1 " +
" and b.corp_id = #{model.corpId} "+ " and b.corp_id = #{model.corpId} "+
" GROUP BY " + " GROUP BY " +
" bla.business_id " + " bla.business_id " +
" ) T ON T.bussinessId = bl.label_id " + " ) T ON T.bussinessId = bl.label_id " +
" left join s_user su on su.business_id = b.lecturer_id " + " left join s_user su on su.business_id = b.lecturer_id " +
// " and su.del_flag != 1 and su.flag = 1 " + // " and su.del_flag != 1 and su.flag = 1 " +
" and su.corp_id = #{model.corpId} "+ " and su.corp_id = #{model.corpId} "+
" left join s_user suc on suc.business_id = b.create_by " + " left join s_user suc on suc.business_id = b.create_by " +
// " and suc.del_flag != 1 and suc.flag = 1 " + // " and suc.del_flag != 1 and suc.flag = 1 " +
" and suc.corp_id = #{model.corpId} "+ " and suc.corp_id = #{model.corpId} "+
" left join b_viewrange bv on b.business_id = bv.lesson_id " + " left join b_viewrange bv on b.business_id = bv.lesson_id " +
" and bv.del_flag != 1 and bv.flag = 1 " + " and bv.del_flag != 1 and bv.flag = 1 " +
" and bv.corp_id = #{model.corpId} "+ " and bv.corp_id = #{model.corpId} "+
" left join b_viewrange_son bvs on bv.business_id = bvs.viewrange_id " + " left join b_viewrange_son bvs on bv.business_id = bvs.viewrange_id " +
" left join b_lesson_label bll on bl.business_id = bll.lesson_id " + " left join b_lesson_label bll on bl.business_id = bll.lesson_id " +
" left join b_lesson_corp blc on blc.lesson_id = b.business_id and b.corp_id = '###' " +
" where b.del_flag != 1 and b.flag = 1 " + " where b.del_flag != 1 and b.flag = 1 " +
" and (b.corp_id = #{model.corpId} or blc.corp_id = #{model.corpId}) "+
" and b.corp_id = #{model.corpId} "+
" <if test=\"model.valueScreen !=null and model.valueScreen != ''\"> ${model.valueScreen} </if>" + " <if test=\"model.valueScreen !=null and model.valueScreen != ''\"> ${model.valueScreen} </if>" +
" and b.business_id not in (SELECT DISTINCT b.business_id from " + " and b.business_id not in (SELECT DISTINCT b.business_id from " +
" b_lesson b left join b_lesson_person blp on b.business_id = blp.lesson_id " + " b_lesson b left join b_lesson_person blp on b.business_id = blp.lesson_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