Commit cd4a11f2 authored by luzhuang's avatar luzhuang

feat: 新平台标签显示

parent 0991bb04
...@@ -354,39 +354,33 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -354,39 +354,33 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
/** /**
* 查询平台推荐课程中的标签 * 查询平台推荐课程中的标签
* @param lessonId * @param
* @return * @return
*/ */
@Select("select * from ( " + @Select("<script>" +
"select business_id businessId,l_name lName from b_label " + "select business_id businessId,l_name lName from b_label " +
"where business_id in (${pushLable}) " + "where business_id in " +
"and corp_id = '###' ) a " + " <foreach item='item' index='index' collection='list' open='(' separator=',' close=')'> #{item} </foreach> " +
"UNION " + " </script>")
"select * from ( " + List<QueryLabelResDTO> queryPushLabelByLessonId(List<String> list);
"SELECT blb.business_id businessId,blb.l_name lName " +
"FROM " +
" b_lesson_label bll " +
" LEFT JOIN b_label blb ON bll.label_id = blb.business_id " +
" LEFT JOIN b_lesson bls ON bls.business_id = bll.lesson_id " +
"WHERE " +
" blb.del_flag != 1 " +
" AND blb.flag = 1 " +
" AND bls.del_flag != 1 " +
" AND bls.flag = 1 " +
" AND bls.business_id = #{lessonId} " +
"ORDER BY " +
" CAST( bll.sort AS UNSIGNED ) ASC) b ")
List<QueryLabelResDTO> queryPushLabelByLessonId(@Param("pushLable") String pushLable ,@Param("lessonId") String lessonId);
@Select("select push_lable from b_lesson where business_id = #{lessonId}")
String getPushLable(String lesson);
/**
* 查询 lableIds(企业自增的)
* @param lessonId
* @return
*/
@Select("select blc.lables " + @Select("select blc.lables " +
"from b_lesson_corp blc " + "from b_lesson_corp blc " +
"left join b_lesson bl on bl.business_id = blc.lesson_id and bl.corp_id = '###' " + "left join b_lesson bl on bl.business_id = blc.lesson_id and bl.corp_id = '###' " +
"where 1=1 " + "where 1=1 " +
"and bl.del_flag !=1 " + "and bl.del_flag !=1 " +
"and bl.flag = 1 " + "and bl.flag = 1 " +
"and blc.corp_id = #{lessonId}") "and blc.lesson_id = #{lessonId}")
String getPushLable(String lessonId); String getCorpLable(String lessonId);
/** /**
* 首页分页查询全部课程 * 首页分页查询全部课程
...@@ -1350,10 +1344,10 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -1350,10 +1344,10 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" <if test=\"model.valueGainSort !=null and model.valueGainSort !='' and model.valueGainSort =='1'.toString()\"> , CAST(bl.value_gain AS UNSIGNED) ASC </if> "+ " <if test=\"model.valueGainSort !=null and model.valueGainSort !='' and model.valueGainSort =='1'.toString()\"> , CAST(bl.value_gain AS UNSIGNED) ASC </if> "+
" <if test=\"model.releaseDateSort !=null and model.releaseDateSort !='' and model.releaseDateSort =='0'.toString()\"> , bl.release_date DESC </if> "+ " <if test=\"model.releaseDateSort !=null and model.releaseDateSort !='' and model.releaseDateSort =='0'.toString()\"> , bl.release_date DESC </if> "+
" <if test=\"model.releaseDateSort !=null and model.releaseDateSort !='' and model.releaseDateSort =='1'.toString()\">, bl.release_date ASC </if>"+ " <if test=\"model.releaseDateSort !=null and model.releaseDateSort !='' and model.releaseDateSort =='1'.toString()\">, bl.release_date ASC </if>"+
" ,CASTbl.release_date desc" + " ,bl.release_date desc" +
"</script>") "</script>")
@ResultMap(value = "BasePushResultMap") @ResultMap(value = "BasePushResultMap")
List<BLesson> queryPushMore(FindListLessonDTO model); List<BLesson> queryPushMore(@Param("model") FindListLessonDTO model);
/** /**
* 查询 企业下 lessons * 查询 企业下 lessons
......
...@@ -292,6 +292,9 @@ public class BLesson extends IdEntity<BLesson> { ...@@ -292,6 +292,9 @@ public class BLesson extends IdEntity<BLesson> {
@ApiModelProperty(value = "数据来源企业") @ApiModelProperty(value = "数据来源企业")
private String fromCorp; private String fromCorp;
@ApiModelProperty(value = "平台推荐自带标签")
private String pushLable;
public void initModel(){ public void initModel(){
// this.setDefaultUrl(global.getDEFAULT_COURSE_LOCATION()); // this.setDefaultUrl(global.getDEFAULT_COURSE_LOCATION());
......
...@@ -10,6 +10,7 @@ import org.rcisoft.business.bcourse.dao.BCourseRepository; ...@@ -10,6 +10,7 @@ import org.rcisoft.business.bcourse.dao.BCourseRepository;
import org.rcisoft.business.bcourse.dto.AllCourseDTO; import org.rcisoft.business.bcourse.dto.AllCourseDTO;
import org.rcisoft.business.bfile.dao.BTrainFileRepository; import org.rcisoft.business.bfile.dao.BTrainFileRepository;
import org.rcisoft.business.bfile.entity.BTrainFile; import org.rcisoft.business.bfile.entity.BTrainFile;
import org.rcisoft.business.blabel.dto.QueryLabelResDTO;
import org.rcisoft.business.blesson.dao.*; import org.rcisoft.business.blesson.dao.*;
import org.rcisoft.business.blesson.dto.*; import org.rcisoft.business.blesson.dto.*;
import org.rcisoft.business.blesson.entity.*; import org.rcisoft.business.blesson.entity.*;
...@@ -267,12 +268,15 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -267,12 +268,15 @@ public class BLessonServiceImpl implements BLessonService {
} }
List<BLesson> result = bLessonRepository.queryPush(curUser, departs); List<BLesson> result = bLessonRepository.queryPush(curUser, departs);
result.forEach(lesson->{ result.forEach(lesson->{
List<String> list = new ArrayList<>();
String pushLable = bLessonRepository.getPushLable(lesson.getBusinessId()); String pushLable = bLessonRepository.getPushLable(lesson.getBusinessId());
if( StringUtils.isEmpty(pushLable)){ String corpLable = bLessonRepository.getCorpLable(lesson.getBusinessId());
lesson.setLabelList(bLessonRepository.queryLabelByLessonId(lesson.getBusinessId())); if(StringUtils.isEmpty(pushLable))
}else { list.addAll(asList(pushLable.split(",")));
lesson.setLabelList(bLessonRepository.queryPushLabelByLessonId(pushLable,lesson.getBusinessId())); if(StringUtils.isEmpty(corpLable))
} list.addAll(asList(corpLable.split(",")));
if(list.size()<=0 || list == null)
lesson.setLabelList(bLessonRepository.queryPushLabelByLessonId(list));
}); });
return addNew(result); return addNew(result);
...@@ -285,14 +289,17 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -285,14 +289,17 @@ public class BLessonServiceImpl implements BLessonService {
*/ */
public List<BLesson> queryPush(FindListLessonDTO model) { public List<BLesson> queryPush(FindListLessonDTO model) {
List<BLesson> result = bLessonRepository.queryPushMore(model); List<BLesson> result = bLessonRepository.queryPushMore(model);
for (BLesson b : result){ result.forEach(lesson->{
String pushLable = bLessonRepository.getPushLable(b.getBusinessId()); List<String> list = new ArrayList<>();
if( StringUtils.isEmpty(pushLable)){ String pushLable = bLessonRepository.getPushLable(lesson.getBusinessId());
b.setLabelList(bLessonRepository.queryLabelByLessonId(b.getBusinessId())); String corpLable = bLessonRepository.getCorpLable(lesson.getBusinessId());
}else { if(StringUtils.isNotEmpty(pushLable))
b.setLabelList(bLessonRepository.queryPushLabelByLessonId(pushLable,b.getBusinessId())); list.addAll(asList(pushLable.split(",")));
} if(StringUtils.isNotEmpty(corpLable))
} list.addAll(asList(corpLable.split(",")));
if( list != null && list.size() > 0)
lesson.setLabelList(bLessonRepository.queryPushLabelByLessonId(list));
});
return addNew(result); return addNew(result);
} }
...@@ -1911,16 +1918,16 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -1911,16 +1918,16 @@ public class BLessonServiceImpl implements BLessonService {
mtUserGetsReqDTO.setCorpId(curUser.getCorpId()); mtUserGetsReqDTO.setCorpId(curUser.getCorpId());
mtUserGetsReqDTO.setIds(ids); mtUserGetsReqDTO.setIds(ids);
log.info("------------mtUserGetsReqDTO--------"+mtUserGetsReqDTO); log.info("------------mtUserGetsReqDTO--------"+mtUserGetsReqDTO);
// List<MTUserInfoRspDTO> mtUserInfoRspDTOList = cotactApiRequestClient.userGets(mtUserGetsReqDTO); List<MTUserInfoRspDTO> mtUserInfoRspDTOList = cotactApiRequestClient.userGets(mtUserGetsReqDTO);
// log.info("------------mtUserInfoRspDTOList--------"+(mtUserInfoRspDTOList==null?"null":mtUserInfoRspDTOList.toString())); log.info("------------mtUserInfoRspDTOList--------"+(mtUserInfoRspDTOList==null?"null":mtUserInfoRspDTOList.toString()));
// List<String> departs = new ArrayList<>(); List<String> departs = new ArrayList<>();
// if (mtUserInfoRspDTOList != null && mtUserInfoRspDTOList.size() > 0) { if (mtUserInfoRspDTOList != null && mtUserInfoRspDTOList.size() > 0) {
// departs = QueryDepart.queryDepart(mtUserInfoRspDTOList); departs = QueryDepart.queryDepart(mtUserInfoRspDTOList);
// departs.removeAll(Collections.singleton(null)); departs.removeAll(Collections.singleton(null));
// departs.removeAll(Collections.singleton("")); departs.removeAll(Collections.singleton(""));
// } }
FirstPageQueryDTO firstPageQueryDTO = new FirstPageQueryDTO(); FirstPageQueryDTO firstPageQueryDTO = new FirstPageQueryDTO();
firstPageQueryDTO.setDeparts(null); firstPageQueryDTO.setDeparts(departs);
firstPageQueryDTO.setCorpId(curUser.getCorpId()); firstPageQueryDTO.setCorpId(curUser.getCorpId());
firstPageQueryDTO.setUserId(curUser.getUserId()); firstPageQueryDTO.setUserId(curUser.getUserId());
List<String> courseIds = null; List<String> courseIds = 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