Commit 5f3d92c8 authored by jiangpengpeng's avatar jiangpengpeng

banner排序

parent babf58be
...@@ -246,4 +246,22 @@ public class BLessonController extends PaginationController<BLesson> { ...@@ -246,4 +246,22 @@ public class BLessonController extends PaginationController<BLesson> {
MessageConstant.MESSAGE_ALERT_ERROR, MessageConstant.MESSAGE_ALERT_ERROR,
bLessonPersonService.iLearnLessonCount(userId)); bLessonPersonService.iLearnLessonCount(userId));
} }
/**
* @author: jiangpengpeng
* @description: TODO
* @date: 2019/9/27 14:37
* @param
* @return
*/
@ApiOperation(value = "617课程管理显示的全部课程", notes="课程管理显示的全部课程")
@GetMapping(value = "theLessonManage")
public Result theLessonManage(CurUser curUser, @Valid BLesson bLesson, BindingResult bindingResult){
List<BLesson> bLessons = bLessonService.theLessonMangageByPagination(getPaginationUtility(), curUser, bLesson);
GridModel gridModel = getGridModelResponse();
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
gridModel);
}
} }
...@@ -8,9 +8,11 @@ import org.rcisoft.business.blesson.dto.ILessonCountDTO; ...@@ -8,9 +8,11 @@ import org.rcisoft.business.blesson.dto.ILessonCountDTO;
import org.rcisoft.business.blesson.entity.BLesson; import org.rcisoft.business.blesson.entity.BLesson;
import org.rcisoft.business.blesson.entity.BLessonLabel; import org.rcisoft.business.blesson.entity.BLessonLabel;
import org.rcisoft.core.base.BaseMapper; import org.rcisoft.core.base.BaseMapper;
import org.rcisoft.sys.user.bean.CurUser;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.List; import java.util.List;
import java.util.Set;
/** /**
* Created with CodeGenerator on . * Created with CodeGenerator on .
...@@ -29,7 +31,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -29,7 +31,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
"<if test=\"releaseState!=null and releaseState != ''\">and release_state = #{releaseState} </if>" + "<if test=\"releaseState!=null and releaseState != ''\">and release_state = #{releaseState} </if>" +
"order by update_date desc</script>") "order by update_date desc</script>")
@ResultMap(value = "BaseResultMap") @ResultMap(value = "BaseResultMap")
List<BLesson> queryBLessons(@Param("releaseState") String releaseState,@Param("lecturerId") String lecturerId); List<BLesson> queryBLessons(@Param("releaseState") String releaseState, @Param("lecturerId") String lecturerId);
@Select("<script>select bl.*,bld.direction_id as directionId from b_lesson bl " + @Select("<script>select bl.*,bld.direction_id as directionId from b_lesson bl " +
...@@ -50,6 +52,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -50,6 +52,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
/** /**
* 课程新增 添加标签 * 课程新增 添加标签
*
* @param bLessons * @param bLessons
* @return * @return
*/ */
...@@ -63,6 +66,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -63,6 +66,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
/** /**
* 根据课程id删除课程-标签表 * 根据课程id删除课程-标签表
*
* @param model * @param model
* @return * @return
*/ */
...@@ -71,6 +75,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -71,6 +75,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
/** /**
* 单一查询课程信息 * 单一查询课程信息
*
* @param businessId * @param businessId
* @return * @return
*/ */
...@@ -93,6 +98,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -93,6 +98,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
/** /**
* 根据条件查询课程并案发布时间排序 * 根据条件查询课程并案发布时间排序
*
* @param param * @param param
* @return * @return
*/ */
...@@ -122,6 +128,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -122,6 +128,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
/** /**
* 按学习人数降序查询 * 按学习人数降序查询
*
* @param * @param
* @return * @return
*/ */
...@@ -150,6 +157,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -150,6 +157,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
/** /**
* 按学习人数降序查询推荐 * 按学习人数降序查询推荐
*
* @param * @param
* @return * @return
*/ */
...@@ -187,10 +195,11 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -187,10 +195,11 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" order by br.update_date " + " order by br.update_date " +
"</script>") "</script>")
@ResultMap(value = "BaseResultMap") @ResultMap(value = "BaseResultMap")
List<BLesson> queryRecommend(@Param("userId") String userId,@Param("departs") List<String> departs); List<BLesson> queryRecommend(@Param("userId") String userId, @Param("departs") List<String> departs);
/** /**
* 按学习人数降序查询 * 按学习人数降序查询
*
* @param * @param
* @return * @return
*/ */
...@@ -236,7 +245,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -236,7 +245,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
@ResultMap(value = "BaseResultMap") @ResultMap(value = "BaseResultMap")
List<BLesson> queryConcern(@Param("userId") String userId, @Param("departs") List<String> departs); List<BLesson> queryConcern(@Param("userId") String userId, @Param("departs") List<String> departs);
// @Select(" <script> select bl.* " + // @Select(" <script> select bl.* " +
// " ,su.name lecturerName " + // " ,su.name lecturerName " +
// " ,suc.name createByName " + // " ,suc.name createByName " +
// " from b_lesson bl " + // " from b_lesson bl " +
...@@ -250,45 +259,45 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -250,45 +259,45 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
// " order by bl.hot_number desc " + // " order by bl.hot_number desc " +
// "</script>") // "</script>")
// @ResultMap(value = "BaseResultMap") // @ResultMap(value = "BaseResultMap")
@Select(" <script> SELECT b.* " + @Select(" <script> SELECT b.* " +
" ,su.name lecturerName " + " ,su.name lecturerName " +
" ,suc.name createByName " + " ,suc.name createByName " +
" FROM " + " FROM " +
" b_lesson b " + " b_lesson b " +
" LEFT JOIN b_lesson_label bl ON b.business_id = bl.lesson_id" + " LEFT JOIN b_lesson_label bl ON b.business_id = bl.lesson_id" +
" inner JOIN ( " + " inner JOIN ( " +
" SELECT " + " SELECT " +
" bla.business_id AS bussinessId, " + " bla.business_id AS bussinessId, " +
" count( 1 ) AS bsum " + " count( 1 ) AS bsum " +
" FROM " + " FROM " +
" b_label bla " + " b_label bla " +
" LEFT JOIN b_lesson_label bl ON bla.business_id = bl.label_id " + " LEFT JOIN b_lesson_label bl ON bla.business_id = bl.label_id " +
" LEFT JOIN b_lesson b ON bl.lesson_id = b.business_id " + " LEFT JOIN b_lesson b ON bl.lesson_id = b.business_id " +
" LEFT JOIN b_lesson_person bp ON b.business_id = bp.lesson_id " + " LEFT JOIN b_lesson_person bp ON b.business_id = bp.lesson_id " +
" WHERE " + " WHERE " +
" bp.person_id = #{userId} " + " bp.person_id = #{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 " +
" 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 " +
" left join s_user suc on suc.business_id = b.create_by " + " left join s_user suc on suc.business_id = b.create_by " +
" left join b_viewrange bv on bl.business_id = bv.lesson_id " + " left join b_viewrange bv on bl.business_id = bv.lesson_id " +
" 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 " +
" where b.del_flag != 1 and b.flag = 1 " + " where b.del_flag != 1 and b.flag = 1 " +
" and su.del_flag != 1 and su.flag = 1 " + " and su.del_flag != 1 and su.flag = 1 " +
" and suc.del_flag != 1 and suc.flag = 1 " + " and suc.del_flag != 1 and suc.flag = 1 " +
" and bv.del_flag != 1 and bv.flag = 1 " + " and bv.del_flag != 1 and bv.flag = 1 " +
" 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 " +
" where blp.person_id = #{userId} ) " + " where blp.person_id = #{userId} ) " +
" and b.release_state = 2 " + " and b.release_state = 2 " +
" and ((bvs.type = 0 and bvs.target_id = #{userId}) " + " and ((bvs.type = 0 and bvs.target_id = #{userId}) " +
" or (bvs.type = 1 and bvs.target_id in " + " or (bvs.type = 1 and bvs.target_id in " +
" <foreach item='item' index='index' collection='departs' open='(' separator=',' close=')'> #{item} </foreach>)) " + " <foreach item='item' index='index' collection='departs' open='(' separator=',' close=')'> #{item} </foreach>)) " +
" order by T.bsum , b.collect_number " + " order by T.bsum , b.collect_number " +
"</script>") "</script>")
List<BLesson> queryInterested(@Param("userId") String userId, @Param("departs") List<String> departs); List<BLesson> queryInterested(@Param("userId") String userId, @Param("departs") List<String> departs);
//查询课程中的标签 //查询课程中的标签
...@@ -321,10 +330,11 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -321,10 +330,11 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" order by bl.person_number desc " + " order by bl.person_number desc " +
"</script>") "</script>")
@ResultMap(value = "BaseResultMap") @ResultMap(value = "BaseResultMap")
List<BLesson> queryHomeBLesson(@Param("param") FirstPageQueryDTO firstPageQueryDTO,@Param("courseIds") List<String> sonCourseIds); List<BLesson> queryHomeBLesson(@Param("param") FirstPageQueryDTO firstPageQueryDTO, @Param("courseIds") List<String> sonCourseIds);
/** /**
* 根据课程id关闭课程 * 根据课程id关闭课程
*
* @param model * @param model
* @return * @return
*/ */
...@@ -344,12 +354,45 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -344,12 +354,45 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" select (select COUNT(1) from b_lesson where lecturer_id = #{userId} ) publishAllCount, " + " select (select COUNT(1) from b_lesson where lecturer_id = #{userId} ) publishAllCount, " +
"(select COUNT(1) from b_lesson where lecturer_id = #{userId} and release_state = '0') notPublishCount, " + "(select COUNT(1) from b_lesson where lecturer_id = #{userId} and release_state = '0') notPublishCount, " +
"(select COUNT(1) from b_lesson where lecturer_id = #{userId} and release_state = '2') publishedCount, " + "(select COUNT(1) from b_lesson where lecturer_id = #{userId} and release_state = '2') publishedCount, " +
"(select COUNT(1) from b_lesson where lecturer_id = #{userId} and release_state = '4') closedCount, "+ "(select COUNT(1) from b_lesson where lecturer_id = #{userId} and release_state = '4') closedCount, " +
"(select COUNT(1) from b_lesson_person where person_id = #{userId} ) learnAllCount, " + "(select COUNT(1) from b_lesson_person where person_id = #{userId} ) learnAllCount, " +
"(select COUNT(1) from b_lesson_person where person_id = #{userId} and is_finish = '1') finishCount, " + "(select COUNT(1) from b_lesson_person where person_id = #{userId} and is_finish = '1') finishCount, " +
"(select COUNT(1) from b_lesson_person where person_id = #{userId} and is_finish = '0') notFinishCount " + "(select COUNT(1) from b_lesson_person where person_id = #{userId} and is_finish = '0') notFinishCount " +
"</script>"}) "</script>"})
ILessonCountDTO iLessonCount(String userId); ILessonCountDTO iLessonCount(String userId);
//查询管理的全部课程
//isAdmin <if test= " !isAdmin ">
// teacher in (uid)
// </IF>
@Select("<script>" +
"SELECT " +
"les.*, " +
"CONCAT( " +
"IFNULL(CONCAT(b3.c_name,\".\"),\"\"), " +
"IFNULL(CONCAT(b2.c_name,\".\"),\"\"), " +
" IFNULL(b1.c_name,\"\") " +
") AS courseName " +
"FROM " +
"b_lesson les " +
"LEFT JOIN b_course b1 ON b1.business_id = les.course_id " +
"LEFT JOIN b_course b2 ON b2.business_id = b1.pid " +
"LEFT JOIN b_course b3 ON b3.business_id = b2.pid " +
"LEFT JOIN s_user u1 ON u1.business_id = les.lecturer_id " +
"WHERE 1 = 1 " +
"<if test='!isAdmin'>" +
"AND les.lecturer_id IN" +
"<foreach item='item' index='index' collection='CurUserSet' open='(' close=')' separator=','> " +
"#{item.userId} " +
"</foreach>" +
"</if> " +
"<if test=\"bLesson.lessonName!=null and bLesson.lessonName!=''\">AND les.lesson_name like '%${bLesson.lessonName}%' </if>" +
"<if test=\"bLesson.lecturerId!=null and bLesson.lecturerId!=''\">AND u1.name like '%${bLesson.lecturerId}%' </if>" +
"<if test=\"bLesson.releaseState!=null and bLesson.releaseState!=''\">AND les.release_state = #{bLesson.releaseState} </if>" +
" order by les.release_date desc </script>")
@ResultMap(value = "BaseResultMap")
List<BLesson> selectAllManageLesson(@Param("CurUserSet") Set<CurUser> CurUserSet, @Param("bLesson") BLesson bLesson, @Param("isAdmin") boolean isAdmin);
} }
...@@ -71,7 +71,7 @@ public class BLesson extends IdEntity<BLesson> { ...@@ -71,7 +71,7 @@ public class BLesson extends IdEntity<BLesson> {
private String viewRange; private String viewRange;
@ApiModelProperty(value = "发布时间") @ApiModelProperty(value = "发布时间")
@Length(min = 1,max = 1,message = "长度最小为1,最大为1") //@Length(min = 1,max = 1,message = "长度最小为1,最大为1")
private Date releaseDate; private Date releaseDate;
@ApiModelProperty(value = "课程类型(0:课程 1:培训)") @ApiModelProperty(value = "课程类型(0:课程 1:培训)")
...@@ -121,5 +121,10 @@ public class BLesson extends IdEntity<BLesson> { ...@@ -121,5 +121,10 @@ public class BLesson extends IdEntity<BLesson> {
@ApiModelProperty(value = "分类名") @ApiModelProperty(value = "分类名")
@Transient @Transient
private String courseName; private String courseName;
} }
...@@ -5,6 +5,7 @@ import org.rcisoft.business.blesson.dto.*; ...@@ -5,6 +5,7 @@ import org.rcisoft.business.blesson.dto.*;
import org.rcisoft.business.blesson.entity.BLesson; import org.rcisoft.business.blesson.entity.BLesson;
import org.rcisoft.core.aop.PageUtil; import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.core.model.PersistModel; import org.rcisoft.core.model.PersistModel;
import org.rcisoft.sys.user.bean.CurUser;
import java.util.List; import java.util.List;
...@@ -118,4 +119,12 @@ public interface BLessonService{ ...@@ -118,4 +119,12 @@ public interface BLessonService{
*/ */
ILessonCountDTO iLessonCount(String userId); ILessonCountDTO iLessonCount(String userId);
/**
* @author: jiangpengpeng
* @description: 分页查找课程管理数据
* @date: 2019/9/27 14:44
* @param
* @return
*/
List<BLesson> theLessonMangageByPagination(PageUtil pageUtil,CurUser curUser,BLesson bLesson);
} }
package org.rcisoft.business.blesson.service.impl; package org.rcisoft.business.blesson.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.sun.org.apache.regexp.internal.RE;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.usermodel.HSSFWorkbook;
...@@ -17,16 +18,16 @@ import org.rcisoft.core.aop.PageUtil; ...@@ -17,16 +18,16 @@ import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.core.constant.MessageConstant; import org.rcisoft.core.constant.MessageConstant;
import org.rcisoft.core.model.PersistModel; import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.util.UserUtil; import org.rcisoft.core.util.UserUtil;
import org.rcisoft.sys.user.bean.CurUser;
import org.rcisoft.sys.user.dao.SysUserMapper;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList; import java.lang.reflect.Array;
import java.util.HashMap; import java.util.*;
import java.util.List;
import java.util.Map;
/** /**
...@@ -34,7 +35,7 @@ import java.util.Map; ...@@ -34,7 +35,7 @@ import java.util.Map;
*/ */
@Slf4j @Slf4j
@Service @Service
@Transactional(readOnly = true,propagation = Propagation.NOT_SUPPORTED) @Transactional(readOnly = true, propagation = Propagation.NOT_SUPPORTED)
public class BLessonServiceImpl implements BLessonService { public class BLessonServiceImpl implements BLessonService {
@Autowired @Autowired
private BLessonRepository bLessonRepository; private BLessonRepository bLessonRepository;
...@@ -42,12 +43,15 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -42,12 +43,15 @@ public class BLessonServiceImpl implements BLessonService {
@Autowired @Autowired
private BCourseRepository bCourseRepository; private BCourseRepository bCourseRepository;
@Autowired
private SysUserMapper sysUserMapper;
@Autowired @Autowired
private Global global; private Global global;
@Override @Override
public BLesson selectOne(String businessId){ public BLesson selectOne(String businessId) {
return bLessonRepository.selectInfoById(businessId); return bLessonRepository.selectInfoById(businessId);
} }
...@@ -56,9 +60,9 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -56,9 +60,9 @@ public class BLessonServiceImpl implements BLessonService {
return bLessonRepository.selectOne(bLesson); return bLessonRepository.selectOne(bLesson);
} }
@Transactional(propagation = Propagation.REQUIRED,readOnly = false) @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
@Override @Override
public int updateByPrimaryKeySelective(BLesson bLesson) { public int updateByPrimaryKeySelective(BLesson bLesson) {
return bLessonRepository.updateByPrimaryKeySelective(bLesson); return bLessonRepository.updateByPrimaryKeySelective(bLesson);
} }
...@@ -78,43 +82,45 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -78,43 +82,45 @@ public class BLessonServiceImpl implements BLessonService {
departs.add("1"); departs.add("1");
departs.add("2"); departs.add("2");
departs.add("3"); departs.add("3");
return bLessonRepository.queryPersonMore(userId,departs); return bLessonRepository.queryPersonMore(userId, departs);
} }
@Override @Override
public List<BLesson> queryRecommendByPagination(PageUtil pageUtil,String userId) { public List<BLesson> queryRecommendByPagination(PageUtil pageUtil, String userId) {
List<String> departs = new ArrayList<>(); List<String> departs = new ArrayList<>();
departs.add("1"); departs.add("1");
departs.add("2"); departs.add("2");
departs.add("3"); departs.add("3");
return bLessonRepository.queryRecommend(userId,departs); return bLessonRepository.queryRecommend(userId, departs);
} }
@Override @Override
public List<BLesson> queryConcernByPagination(PageUtil pageUtil,String userId) { public List<BLesson> queryConcernByPagination(PageUtil pageUtil, String userId) {
List<String> departs = new ArrayList<>(); List<String> departs = new ArrayList<>();
departs.add("1"); departs.add("1");
departs.add("2"); departs.add("2");
departs.add("3"); departs.add("3");
return bLessonRepository.queryConcern(userId,departs); return bLessonRepository.queryConcern(userId, departs);
} }
@Override @Override
public List<BLesson> queryInterestedByPagination(PageUtil pageUtil,String userId) { public List<BLesson> queryInterestedByPagination(PageUtil pageUtil, String userId) {
List<String> departs = new ArrayList<>(); List<String> departs = new ArrayList<>();
departs.add("1"); departs.add("1");
departs.add("2"); departs.add("2");
departs.add("3"); departs.add("3");
return bLessonRepository.queryInterested(userId,departs); return bLessonRepository.queryInterested(userId, departs);
} }
@Override @Override
@Transactional(propagation = Propagation.REQUIRED,readOnly = false) @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public PersistModel persist(AddLessonDTO addLessonDTO){ public PersistModel persist(AddLessonDTO addLessonDTO) {
BLesson model = new BLesson(); BLesson model = new BLesson();
BeanUtils.copyProperties(addLessonDTO,model); BeanUtils.copyProperties(addLessonDTO, model);
int line = 0; int line = 0;
List<BLessonLabel> bLessonLabels = new ArrayList<>(); List<BLessonLabel> bLessonLabels = new ArrayList<>();
if(model.getBusinessId()==null) { if (model.getBusinessId() == null) {
model.setDefaultUrl(global.getDEFAULT_COURSE_LOCATION()); model.setDefaultUrl(global.getDEFAULT_COURSE_LOCATION());
UserUtil.setCurrentPersistOperation(model); UserUtil.setCurrentPersistOperation(model);
//设置状态为待发布 //设置状态为待发布
...@@ -136,9 +142,9 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -136,9 +142,9 @@ public class BLessonServiceImpl implements BLessonService {
//添加课程表 //添加课程表
line = bLessonRepository.insertSelective(model); line = bLessonRepository.insertSelective(model);
//添加课程标签表 //添加课程标签表
if (StringUtils.isNotEmpty(model.getLabels())){ if (StringUtils.isNotEmpty(model.getLabels())) {
String[] labels = model.getLabels().split(","); String[] labels = model.getLabels().split(",");
for (int index = 0 ; index<labels.length;index++){ for (int index = 0; index < labels.length; index++) {
BLessonLabel bLessonLabel = new BLessonLabel(); BLessonLabel bLessonLabel = new BLessonLabel();
UserUtil.setCurrentPersistOperation(bLessonLabel); UserUtil.setCurrentPersistOperation(bLessonLabel);
bLessonLabel.setLabelId(labels[index]); bLessonLabel.setLabelId(labels[index]);
...@@ -147,14 +153,14 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -147,14 +153,14 @@ public class BLessonServiceImpl implements BLessonService {
} }
bLessonRepository.insertLessonLabel(bLessonLabels); bLessonRepository.insertLessonLabel(bLessonLabels);
} }
}else { } else {
UserUtil.setCurrentMergeOperation(model); UserUtil.setCurrentMergeOperation(model);
line = bLessonRepository.updateByPrimaryKeySelective(model); line = bLessonRepository.updateByPrimaryKeySelective(model);
bLessonRepository.removeLabelByLessonId(model); bLessonRepository.removeLabelByLessonId(model);
//删除原标签添,加课程标签表 //删除原标签添,加课程标签表
if (StringUtils.isNotEmpty(model.getLabels())){ if (StringUtils.isNotEmpty(model.getLabels())) {
String[] labels = model.getLabels().split(","); String[] labels = model.getLabels().split(",");
for (int index = 0 ; index<labels.length;index++){ for (int index = 0; index < labels.length; index++) {
BLessonLabel bLessonLabel = new BLessonLabel(); BLessonLabel bLessonLabel = new BLessonLabel();
UserUtil.setCurrentPersistOperation(bLessonLabel); UserUtil.setCurrentPersistOperation(bLessonLabel);
bLessonLabel.setLabelId(labels[index]); bLessonLabel.setLabelId(labels[index]);
...@@ -168,7 +174,7 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -168,7 +174,7 @@ public class BLessonServiceImpl implements BLessonService {
} }
@Transactional(propagation = Propagation.REQUIRED,readOnly = false) @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
@Override @Override
public PersistModel removeBLesson(String id) { public PersistModel removeBLesson(String id) {
// if(bSlRepository.selectslNumByLesson(id)>0) { // if(bSlRepository.selectslNumByLesson(id)>0) {
...@@ -188,12 +194,12 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -188,12 +194,12 @@ public class BLessonServiceImpl implements BLessonService {
} }
@Override @Override
public List<BLesson> queryHomeBLessonsByPagination(PageUtil pageUtil, FirstPageQueryDTO firstPageQueryDTO,List<AllCourseDTO> allCourse) { public List<BLesson> queryHomeBLessonsByPagination(PageUtil pageUtil, FirstPageQueryDTO firstPageQueryDTO, List<AllCourseDTO> allCourse) {
List<String> sonCourseIds = null; List<String> sonCourseIds = null;
if (allCourse != null){ if (allCourse != null) {
sonCourseIds = recursion.FindSons(firstPageQueryDTO.getCourseLevelOne(),allCourse); sonCourseIds = recursion.FindSons(firstPageQueryDTO.getCourseLevelOne(), allCourse);
} }
return bLessonRepository.queryHomeBLesson(firstPageQueryDTO,sonCourseIds); return bLessonRepository.queryHomeBLesson(firstPageQueryDTO, sonCourseIds);
} }
@Override @Override
...@@ -216,4 +222,26 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -216,4 +222,26 @@ public class BLessonServiceImpl implements BLessonService {
return bLessonRepository.iLessonCount(userId); return bLessonRepository.iLessonCount(userId);
} }
@Override
public List<BLesson> theLessonMangageByPagination(PageUtil pageUtil, CurUser curUser, BLesson bLesson) {
String userId = curUser.getUserId();
//查询当前登录人有什么角色
List<String> roleList = sysUserMapper.queryRoleTypeByUserId(userId);
boolean isAdmin = false;
Set<CurUser> uids = new HashSet<>();
for (String role : roleList) {
if ("1".equals(role)) {
isAdmin = true;
break;
} else if ("2".equals(role)) {
// 调用 feign 获取当前部门及子部门 --->所有人
uids.addAll(Arrays.asList(new CurUser(), new CurUser()));
}
}
//自己
uids.add(curUser);
//查讯课程的语句
List<BLesson> bLessons = bLessonRepository.selectAllManageLesson(uids,bLesson, isAdmin);
return bLessons;
}
} }
...@@ -160,4 +160,12 @@ public interface SysUserMapper extends BaseMapper<SysUser> { ...@@ -160,4 +160,12 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
int deleteTeacherUserRole(List<SysUser> userTeacherList); int deleteTeacherUserRole(List<SysUser> userTeacherList);
int deleteCompanyUserRole(List<SysUser> userCompanyList); int deleteCompanyUserRole(List<SysUser> userCompanyList);
@Select("<script>SELECT sr.type AS roleList " +
"FROM s_user AS su " +
"LEFT JOIN s_r_user_role AS ru ON su.business_id = ru.user_id " +
"LEFT JOIN s_role AS sr ON ru.role_id = sr.business_id " +
"WHERE su.del_flag = 0 " +
"AND su.business_id = #{userId}</script>")
List<String> queryRoleTypeByUserId(@Param("userId")String userId);
} }
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