Commit 26003b8b authored by luzhuang's avatar luzhuang

Merge remote-tracking branch 'origin/meiteng' into meiteng

parents 3a3563f6 b6c166dc
......@@ -42,12 +42,12 @@ public interface BTrainFileRepository extends BaseMapper<BTrainFile> {
@Insert("<script>INSERT INTO b_train_file " +
"(create_date,create_by,update_date,update_by," +
"del_flag,flag,business_id,remarks, " +
"lesson_id,file_name,video_url,file_url,file_size,type)VALUES" +
"lesson_id,file_name,video_url,file_url,file_size,type,sort)VALUES" +
"<foreach collection=\"param\" item=\"item\" separator=\",\">" +
"(#{item.createDate},#{item.createBy},#{item.updateDate},#{item.updateBy}," +
"#{item.delFlag},#{item.flag},#{item.businessId},#{item.remarks}," +
"#{item.lessonId},#{item.fileName},#{item.videoUrl},#{item.fileUrl}," +
"#{item.fileSize},#{item.type})" +
"#{item.fileSize},#{item.type},#{item.sort})" +
"</foreach></script>")
int insertTrainFileList(@Param("param") List<BTrainFile> param);
......
package org.rcisoft.business.blesson.dao;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.rcisoft.business.blesson.entity.BHot;
import org.rcisoft.core.base.BaseMapper;
import org.springframework.stereotype.Repository;
......@@ -12,7 +14,9 @@ import org.springframework.stereotype.Repository;
@Repository
public interface BHotRepository extends BaseMapper<BHot> {
@Select("<script>select count(1) from b_hot where person_id=#{userId} and lesson_id = #{lessonId} " +
"</script>")
int selectCountByPersonId(@Param("userId") String userId, @Param("lessonId") String lessonId);
}
......@@ -82,5 +82,12 @@ public interface BViewrangeRepository extends BaseMapper<BViewrange> {
"</script>")
List<BViewRangeSonDTO> selectPersonByLessonId(@Param("corpId") String corpId,@Param("lessonId")String lessonId);
@Select("<script>select * from b_viewrange " +
" where 1=1 "+
" and lesson_id = #{lessonId} "+
"</script>")
@ResultMap(value = "BaseResultMap" )
List<BViewrange> selectByLessonId(String lessonId);
}
......@@ -201,8 +201,11 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
// return new PersistModel(line);
// }
//添加至b_hot表 并重新同级热度
int count = bHotRepository.selectCountByPersonId(addMyLearnLessonDTO.getUserId(),addMyLearnLessonDTO.getLessonId());
if (count < 1){
bHotRepository.insertSelective(new BHot(IdGen.uuid(),addMyLearnLessonDTO.getUserId(),addMyLearnLessonDTO.getLessonId()));
bLessonRepository.hotNumberReCount(addMyLearnLessonDTO.getLessonId());
}
return new PersistModel(1);
}
}
......@@ -120,11 +120,12 @@ public class BLessonServiceImpl implements BLessonService {
bLesson.setViewRangeDepartList(selectDepartByLessonIds);
}
//客户端 手机端 每次点击插入热度表 并重新统计课程热度
// if ("1".equals(bLesson.getIsCollect())){
// 每次点击插入热度表 并重新统计课程热度
int count = bHotRepository.selectCountByPersonId(curUser.getUserId(),lessonId);
if (count < 1){
bHotRepository.insertSelective(new BHot(IdGen.uuid(),curUser.getUserId(),bLesson.getBusinessId()));
bLessonRepository.hotNumberReCount(bLesson.getBusinessId());
// }
}
return bLesson;
}
......@@ -267,7 +268,7 @@ public class BLessonServiceImpl implements BLessonService {
line = bLessonRepository.insertSelective(model);
//添加可见范围
if (StringUtils.isNotEmpty(model.getViewRangePerson()) || StringUtils.isNotEmpty(model.getViewRangeDepart())) {
BViewrange bViewrange = setBViewrangeInfo(model);
BViewrange bViewrange = setBViewrangeInfo(model,null);
//插入可见范围表
bViewrangeRepository.insertSelective(bViewrange);
//插入可见范围子表
......@@ -282,8 +283,10 @@ public class BLessonServiceImpl implements BLessonService {
bViewrangeSons = addBViewrangeSon(bViewrangeSons, viewRangeDepart, "1", bViewrange.getBusinessId());
}
//插入子表
if (bViewrangeSons != null && bViewrangeSons.size()>0){
bViewrangeRepository.insertBViewrangeSons(bViewrangeSons);
}
}
//添加课程标签表
if (StringUtils.isNotEmpty(model.getLabels())) {
......@@ -296,12 +299,21 @@ public class BLessonServiceImpl implements BLessonService {
line = bLessonRepository.updateByPrimaryKeySelective(model);
if (StringUtils.isNotEmpty(model.getViewRangePerson()) || StringUtils.isNotEmpty(model.getViewRangeDepart())) {
BViewrange bViewrange = setBViewrangeInfo(model);
BViewrange bViewrange = new BViewrange();
List<BViewrange> bViewranges = bViewrangeRepository.selectByLessonId(model.getBusinessId());
if (bViewranges != null && bViewranges.size() > 0){
bViewrange = bViewranges.get(0);
bViewrange = setBViewrangeInfo(model,bViewrange);
//更新可见范围表
bViewrangeRepository.updateByLessonId(bViewrange);
//删除可见范围子表
bViewrangeRepository.deleteViewrangeSon(bViewrange);
}
if (bViewranges == null || bViewranges.size() < 1){
bViewrange = setBViewrangeInfo(model,null);
//添加可见范围表
bViewrangeRepository.insertSelective(bViewrange);
}
//获取所有可见人员和部门
List<BViewrangeSon> bViewrangeSons = new ArrayList<>();
......@@ -311,13 +323,23 @@ public class BLessonServiceImpl implements BLessonService {
String[] viewRangePerson = model.getViewRangePerson().split(",");
bViewrangeSons = addBViewrangeSon(bViewrangeSons, viewRangePerson, "0", bViewrange.getBusinessId());
}
if (StringUtils.isNotEmpty(model.getViewRangePerson())) {
if (StringUtils.isNotEmpty(model.getViewRangeDepart())) {
String[] viewRangeDepart = model.getViewRangeDepart().split(",");
bViewrangeSons = addBViewrangeSon(bViewrangeSons, viewRangeDepart, "1", bViewrange.getBusinessId());
}
//插入子表
if (bViewrangeSons != null && bViewrangeSons.size()>0){
bViewrangeRepository.insertBViewrangeSons(bViewrangeSons);
}
}else {
//可见范围设为空 所有人员均可见
List<BViewrange> bViewranges = bViewrangeRepository.selectByLessonId(model.getBusinessId());
//删除可见范围子表
if (bViewranges != null && bViewranges.size()>0){
bViewrangeRepository.deleteByPrimaryKey(bViewranges.get(0));
bViewrangeRepository.deleteViewrangeSon(bViewranges.get(0));
}
}
bLessonRepository.removeLabelByLessonId(model);
//删除原标签添,加课程标签表
......@@ -823,14 +845,16 @@ public class BLessonServiceImpl implements BLessonService {
if (recommendIds == null || recommendIds.size() < 1) {
throw new ServiceException(ResultServiceEnums.NOT_RECOMMEND);
}
//修改推荐表
//删除推荐表
BRecommend bRecommend = new BRecommend();
bRecommend.setLessonId(lessonId);
UserUtil.setCurrentMergeOperation(bRecommend);
// bRecommend.setLessonId(lessonId);
// UserUtil.setCurrentMergeOperation(bRecommend);
bRecommend.setBusinessId(recommendIds.get(0));
bRecommend.setDelFlag("1");
int line = bRecommendRepository.updateByPrimaryKeySelective(bRecommend);
int line = bRecommendRepository.deleteByPrimaryKey(bRecommend);
// bRecommend.setDelFlag("1");
// int line = bRecommendRepository.updateByPrimaryKeySelective(bRecommend);
//删除推荐子表内容
bRecommendRepository.deleteRecommendSon(bRecommend);
return new PersistModel(line);
}
......@@ -1031,11 +1055,16 @@ public class BLessonServiceImpl implements BLessonService {
}
//设置BViewrange信息
BViewrange setBViewrangeInfo(BLesson model) {
BViewrange bViewrange = new BViewrange();
BViewrange setBViewrangeInfo(BLesson model, BViewrange bViewrange) {
if (bViewrange == null){
bViewrange = new BViewrange();
UserUtil.setCurrentPersistOperation(bViewrange);
//设置课程id
bViewrange.setLessonId(model.getBusinessId());
}else {
UserUtil.setCurrentMergeOperation(bViewrange);
}
//设置可见范围类型(0仅人 1仅部门 2人和部门)
if (StringUtils.isNotEmpty(model.getViewRangePerson()) && StringUtils.isEmpty(model.getViewRangeDepart())) {
......
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