Commit cd4a11f2 authored by luzhuang's avatar luzhuang

feat: 新平台标签显示

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