Commit babf58be authored by jiangpengpeng's avatar jiangpengpeng

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

# Conflicts:
#	src/main/java/org/rcisoft/business/bbanner/service/impl/BBannerServiceImpl.java
parents a91d1853 c927c282
package org.rcisoft.business.bbanner.common;
public class BannerExceptMessage {
public static final String NO_DATA = "该数据不存在";
public static final String MUST_NOT_FILLED = "必填未填写";
}
......@@ -2,6 +2,7 @@ package org.rcisoft.business.bbanner.service.impl;
import com.alibaba.fastjson.JSON;
import org.apache.commons.lang3.StringUtils;
import org.rcisoft.business.bbanner.common.BannerExceptMessage;
import org.rcisoft.business.bbanner.dto.AddOrUpdateDTO;
import org.rcisoft.business.bbanner.dto.BannerInfoRspDTO;
import org.rcisoft.business.bbanner.dto.FindBannerPaginDTO;
......@@ -44,13 +45,13 @@ public class BBannerServiceImpl implements BBannerService {
int line = 0;
//外部链接但外部URL为空或长度为0 抛异常
if ("1".equals(model.getIsExternalLink()) && StringUtils.isEmpty(model.getExternalUrl()))
throw new ServiceException("必填项未填写");
throw new ServiceException(BannerExceptMessage.MUST_NOT_FILLED);
//内部链接但类型或课程ID为空或长度为0 抛异常
if ("0".equals(model.getIsExternalLink()) && (StringUtils.isEmpty(model.getLineType()) || StringUtils.isEmpty(model.getCourseId())))
throw new ServiceException("必填项未填写");
throw new ServiceException(BannerExceptMessage.MUST_NOT_FILLED);
if (model.getBusinessId() != null) {
if (bBannerRepository.selectCountById(model.getBusinessId()) == 0) {
throw new ServiceException("该数据不存在");
if (bBannerRepository.selectCountById(model.getBusinessId()) == 0){
throw new ServiceException(BannerExceptMessage.NO_DATA);
}
UserUtil.setCurrentMergeOperation(model);
line = bBannerRepository.updateById(model);
......@@ -66,8 +67,8 @@ public class BBannerServiceImpl implements BBannerService {
@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
@Override
public PersistModel removeBanner(String id) {
if (bBannerRepository.selectCountById(id) == 0) {
throw new ServiceException("该数据不存在");
if (bBannerRepository.selectCountById(id) == 0){
throw new ServiceException(BannerExceptMessage.NO_DATA);
}
return new PersistModel(1, bBannerRepository.deleteBanner(id));
......
......@@ -8,6 +8,7 @@ import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.rcisoft.common.controller.PaginationController;
import org.rcisoft.common.model.GridModel;
import org.rcisoft.sys.user.bean.CurUser;
import org.springframework.validation.BindingResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
......@@ -56,11 +57,12 @@ public class BDiscussController extends PaginationController<BDiscuss> {
@ApiOperation(value="802 根据课程id查询评论集合", notes="根据课程id查询评论")
@GetMapping("{lessonId:\\w+}")
public Result getDiscussByLessonId(@PathVariable String lessonId) {
public Result getDiscussByLessonId(CurUser curUser, @PathVariable String lessonId) {
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
bDiscussServiceImpl.getDiscussByLessonId(lessonId));
bDiscussServiceImpl.getDiscussByLessonId(lessonId,curUser.getCorpId()));
}
@ApiOperation(value="逻辑删除", notes="逻辑删除")
......
......@@ -39,12 +39,13 @@ public interface BDiscussRepository extends BaseMapper<BDiscuss> {
" AND bd.del_flag = '0' " +
" AND bd.flag = '1' "
+ "<if test=\"lessonId !=null and lessonId != '' \">and bd.lesson_id = #{lessonId} </if> "
+ "<if test=\"pid !=null and pid != '' \">and bd.pid = #{pid} </if> "
+ "<if test=\"pid ==null or pid == '' \">and bd.pid = '-1' </if> "
+ "<if test=\"pid !=null and pid != '' \">and bd.pid = #{pid} </if> " +
"and corp_id = #{corpId} " +
" order by bd.update_date desc "
+ "</script>")
@ResultMap(value = "BaseResultMapDto" )
List<BDiscussDto> getDiscussByLessonId(@Param("lessonId") String lessonId, @Param("pid") String pid);
List<BDiscussDto> getDiscussByLessonId(@Param("lessonId") String lessonId, @Param("pid") String pid, @Param("corpId") String corpId);
}
......@@ -49,7 +49,7 @@ public interface BDiscussService {
BDiscuss bDiscuss);
List<BDiscussDto> getDiscussByLessonId(String lessonId);
List<BDiscussDto> getDiscussByLessonId(String lessonId,String corpId);
......
......@@ -101,10 +101,11 @@ public class BDiscussServiceImpl implements BDiscussService {
}
@Override
public List<BDiscussDto> getDiscussByLessonId(String lessonId) {
List<BDiscussDto> bDiscussList = bDiscussRepository.getDiscussByLessonId(lessonId,"");
public List<BDiscussDto> getDiscussByLessonId(String lessonId,String corpId) {
List<BDiscussDto> bDiscussList = bDiscussRepository.getDiscussByLessonId(lessonId,"",corpId);
bDiscussList.stream().forEach(bDiscuss -> {
bDiscuss.setBDiscussChildList(bDiscussRepository.getDiscussByLessonId(lessonId,bDiscuss.getBusinessId()));
bDiscuss.setBDiscussChildList(bDiscussRepository.getDiscussByLessonId(lessonId,bDiscuss.getBusinessId(),corpId));
});
return bDiscussList;
}
......
......@@ -7,11 +7,9 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.rcisoft.business.bcourse.dto.AllCourseDTO;
import org.rcisoft.business.bcourse.service.BCourseService;
import org.rcisoft.business.blesson.dto.AddLessonDTO;
import org.rcisoft.business.blesson.dto.FindAllLessonDTO;
import org.rcisoft.business.blesson.dto.FirstPageQueryDTO;
import org.rcisoft.business.blesson.dto.LessonTrainDTO;
import org.rcisoft.business.blesson.dto.*;
import org.rcisoft.business.blesson.entity.BLesson;
import org.rcisoft.business.blesson.service.BLessonPersonService;
import org.rcisoft.business.blesson.service.BLessonService;
import org.rcisoft.common.component.Global;
import org.rcisoft.common.controller.PaginationController;
......@@ -47,6 +45,9 @@ public class BLessonController extends PaginationController<BLesson> {
@Autowired
private BCourseService bCourseService;
@Autowired
private BLessonPersonService bLessonPersonService;
@Autowired
private Global global;
......@@ -99,6 +100,9 @@ public class BLessonController extends PaginationController<BLesson> {
MessageConstant.MESSAGE_ALERT_ERROR,
gridModel);
}
@ApiOperation(value="605 根据条件分页查询全部课程", notes="根据条件分页查询全部课程")
@GetMapping(value = "/queryAllBLessonsByPagination")
public Result queryBLessonsByPagination(CurUser curUser, @Valid FindAllLessonDTO findAllLessonDTO, BindingResult bindingResult) {
......@@ -113,7 +117,8 @@ public class BLessonController extends PaginationController<BLesson> {
@ApiOperation(value="606 分页查询大家都在学", notes="分页查询大家都在学")
@GetMapping(value = "/queryPersonMoreByPagination")
public Result queryPersonMoreByPagination(CurUser curUser,@Valid FirstPageQueryDTO firstPageQueryDTO, BindingResult bindingResult) {
bLessonService.queryPersonMoreByPagination(getPaginationUtility());
String userId = curUser.getUserId();
bLessonService.queryPersonMoreByPagination(getPaginationUtility(),userId);
GridModel gridModel = getGridModelResponse();
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
......@@ -121,7 +126,7 @@ public class BLessonController extends PaginationController<BLesson> {
gridModel);
}
@ApiOperation(value="607 分页查询推荐", notes="分页查询推荐")
@ApiOperation(value="607 分页查询企业推荐", notes="分页查询企业推荐")
@GetMapping(value = "/queryRecommendByPagination")
public Result queryRecommendByPagination(CurUser curUser,@Valid FirstPageQueryDTO firstPageQueryDTO, BindingResult bindingResult) {
String userId = curUser.getUserId();
......@@ -136,7 +141,8 @@ public class BLessonController extends PaginationController<BLesson> {
@ApiOperation(value="608 分页查询最受关注", notes="分页查询最受关注")
@GetMapping(value = "/queryConcernByPagination")
public Result queryConcernByPagination(CurUser curUser) {
bLessonService.queryConcernByPagination(getPaginationUtility());
String userId = curUser.getUserId();
bLessonService.queryConcernByPagination(getPaginationUtility(),userId);
GridModel gridModel = getGridModelResponse();
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
......@@ -148,7 +154,8 @@ public class BLessonController extends PaginationController<BLesson> {
@ApiOperation(value="609 分页查询可能感兴趣", notes="分页查询可能感兴趣")
@GetMapping(value = "/queryInterestedByPagination")
public Result queryInterestedByPagination(CurUser curUser) {
bLessonService.queryInterestedByPagination(getPaginationUtility());
String userId = curUser.getUserId();
bLessonService.queryInterestedByPagination(getPaginationUtility(),userId);
GridModel gridModel = getGridModelResponse();
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
......@@ -193,4 +200,50 @@ public class BLessonController extends PaginationController<BLesson> {
MessageConstant.MESSAGE_ALERT_ERROR,
gridModel);
}
@ApiOperation(value="613 我发布的课程总数", notes="我发布的课程总数")
@GetMapping(value = "/iLessonCount")
public Result ILessonCountDTO(CurUser curUser) {
String userId = curUser.getUserId();
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
bLessonService.iLessonCount(userId));
}
@ApiOperation(value="614 退出课程", notes="根据ID停用一条记录")
@ApiImplicitParam(name = "businessId", value = "退出课程的选课id", required = true, dataType = "varchar")
@PostMapping(value = "/quit")
public Result quit(CurUser curUser, String businessId, BindingResult bindingResult) {
PersistModel data = bLessonPersonService.quit(businessId);
return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
businessId);
}
@ApiOperation(value="615 分页查询我学习", notes="分页查询我学习")
@GetMapping(value = "/queryLearnBLessonsByPagination")
public Result queryLearnBLessonsByPagination(CurUser curUser, @Valid ILearnLessonDTO param, BindingResult bindingResult) {
String userId = curUser.getUserId();
bLessonPersonService.queryLearnBLessonsByPagination(getPaginationUtility(),param,userId);
GridModel gridModel = getGridModelResponse();
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
gridModel);
}
@ApiOperation(value="616 我学习的课程总数", notes="我学习的课程总数")
@GetMapping(value = "/iLearnLessonCount")
public Result iLearnLessonCount(CurUser curUser) {
String userId = curUser.getUserId();
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
bLessonPersonService.iLearnLessonCount(userId));
}
}
package org.rcisoft.business.blessonperson.dao;
package org.rcisoft.business.blesson.dao;
import org.apache.ibatis.annotations.*;
import org.rcisoft.business.blabel.entity.BLabel;
import org.rcisoft.business.blesson.dto.ILearnCountDTO;
import org.rcisoft.business.blesson.entity.BLesson;
import org.rcisoft.business.blessonperson.dto.ILearnLessonDTO;
import org.rcisoft.business.blessonperson.entity.BLessonPerson;
import org.rcisoft.business.blesson.dto.ILearnLessonDTO;
import org.rcisoft.core.base.BaseMapper;
import org.springframework.stereotype.Repository;
......@@ -21,7 +21,7 @@ public interface BLessonPersonRepository extends BaseMapper<BLabel> {
" from b_lesson_person blp " +
" left join b_lesson bl on blp.lesson_id = bl.business_id " +
" left join s_user su on su.business_id = bl.lecturer_id " +
" left join b_course bc on bc.business_id = bl.course_type " +
" left join b_course bc on bc.business_id = bl.course_id " +
" where blp.del_flag != 1 and blp.flag = 1 " +
" and bl.del_flag != 1 and bl.flag = 1 " +
" and su.del_flag != 1 and su.flag = 1 " +
......@@ -39,4 +39,12 @@ public interface BLessonPersonRepository extends BaseMapper<BLabel> {
@Update("update b_lesson_label set flag = 0 where business_id = #{id}")
int quit(String id);
@Select({"<script>",
" select " +
"(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 = '0') notFinishCount " +
"</script>"})
ILearnCountDTO iLearnLessonCount(String userId);
}
......@@ -2,10 +2,9 @@ package org.rcisoft.business.blesson.dao;
import org.apache.ibatis.annotations.*;
import org.rcisoft.business.blabel.dto.QueryLabelResDTO;
import org.rcisoft.business.blabel.entity.BLabel;
import org.rcisoft.business.blesson.dto.BLessonIPublishDTO;
import org.rcisoft.business.blesson.dto.FindAllLessonDTO;
import org.rcisoft.business.blesson.dto.FirstPageQueryDTO;
import org.rcisoft.business.blesson.dto.ILessonCountDTO;
import org.rcisoft.business.blesson.entity.BLesson;
import org.rcisoft.business.blesson.entity.BLessonLabel;
import org.rcisoft.core.base.BaseMapper;
......@@ -82,7 +81,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" from b_lesson bl " +
" left join s_user su on su.business_id = bl.lecturer_id " +
" left join s_user suc on suc.business_id = bl.create_by " +
" left join b_course bc on bc.business_id = bl.course_type " +
" left join b_course bc on bc.business_id = bl.course_id " +
" where bl.del_flag != 1 and bl.flag = 1 " +
" and su.del_flag != 1 and su.flag = 1 " +
" and suc.del_flag != 1 and suc.flag = 1 " +
......@@ -111,7 +110,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" <if test= \" lessonName != null and lessonName != ''\">and bl.lesson_name like CONCAT('%',#{lessonName},'%') </if> " +
" <if test= \" releaseState !=null and releaseState != ''\">and bl.release_state = #{releaseState} </if> " +
" <if test= \" createByName != null and createByName != ''\">and suc.name like CONCAT('%',#{createByName},'%') </if> " +
" <if test= \" courseType !=null and courseType != ''\">and bl.course_type = #{courseType} </if> " +
" <if test= \" courseId !=null and courseId != ''\">and bl.course_id = #{courseId} </if> " +
" <if test= \" viewRange !=null and viewRange != ''\">and bl.view_range = #{viewRange} </if> " +
" <if test= \" lessonType !=null and lessonType != ''\">and bl.lesson_type = #{lessonType} </if> " +
" <if test= \" recommend !=null and recommend != ''\">and bl.recommend = #{recommend} </if> " +
......@@ -132,74 +131,165 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" from b_lesson bl " +
" left join s_user su on su.business_id = bl.lecturer_id " +
" left join s_user suc on suc.business_id = bl.create_by " +
// " left join b_course bc on bc.business_id = bl.course_type " +
" 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_course bc on bc.business_id = bl.course_id " +
" where bl.del_flag != 1 and bl.flag = 1 " +
" and su.del_flag != 1 and su.flag = 1 " +
" and suc.del_flag != 1 and suc.flag = 1 " +
" and bv.del_flag != 1 and bv.flag = 1 " +
" and bl.release_state = 2 " +
" order by bl.person_number desc " +
" and ((bvs.type = 0 and bvs.target_id = #{userId}) " +
" or (bvs.type = 1 and bvs.target_id in " +
" <foreach item='item' index='index' collection='departs' open='(' separator=',' close=')'> #{item} </foreach>)) " +
" and bl.person_number > (select `value` from b_dictionary where type = 'ZXRS') " + //ZXRS 在学人数
" order by bl.person_number,bl.release_date desc " +
"</script>")
@ResultMap(value = "BaseResultMap")
List<BLesson> queryPersonMore();
List<BLesson> queryPersonMore(@Param("userId") String userId, @Param("departs") List<String> departs);
/**
* 按学习人数降序查询推荐
* @param
* @return
*/
// @Select(" <script> select bl.* " +
// " ,su.name lecturerName " +
// " ,suc.name createByName " +
// " from b_recommend br " +
// " left join b_lesson bl on br.lesson_id = bl.business_id " +
// " left join s_user su on su.business_id = bl.lecturer_id " +
// " left join s_user suc on suc.business_id = bl.create_by " +
// " where bl.del_flag != 1 and bl.flag = 1 " +
// " and su.del_flag != 1 and su.flag = 1 " +
// " and suc.del_flag != 1 and suc.flag = 1 " +
// " and bl.release_state = 2 " +
// " and br.person_id = #{userId} " +
// " order by bl.recommend_time desc " +
// "</script>")
@Select(" <script> select bl.* " +
" ,su.name lecturerName " +
" ,suc.name createByName " +
" from b_recommend br " +
" left join b_lesson bl on br.lesson_id = bl.business_id " +
" from b_lesson bl " +
" left join s_user su on su.business_id = bl.lecturer_id " +
" left join s_user suc on suc.business_id = bl.create_by " +
" left join b_recommend br on bl.business_id = br.lesson_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 " +
" where bl.del_flag != 1 and bl.flag = 1 " +
" and su.del_flag != 1 and su.flag = 1 " +
" and suc.del_flag != 1 and suc.flag = 1 " +
" and br.del_flag != 1 and br.flag = 1 " +
" and bl.release_state = 2 " +
" and br.person_id = #{userId} " +
" order by bl.person_number desc " +
" and ((brs.type = 0 and brs.target_id = #{userId}) " +
" or (brs.type = 1 and brs.target_id in " +
" <foreach item='item' index='index' collection='departs' open='(' separator=',' close=')'> #{item} </foreach>)) " +
" order by br.update_date " +
"</script>")
@ResultMap(value = "BaseResultMap")
List<BLesson> queryRecommend(String userId);
List<BLesson> queryRecommend(@Param("userId") String userId,@Param("departs") List<String> departs);
/**
* 按学习人数降序查询
* @param
* @return
*/
// @Select(" <script> select bl.* " +
// " ,su.name lecturerName " +
// " ,suc.name createByName " +
// " from b_lesson bl " +
// " left join s_user su on su.business_id = bl.lecturer_id " +
//
// //" and su.COP == " //企业id
//
// " left join s_user suc on suc.business_id = bl.create_by " +
//// " left join b_course bc on bc.business_id = bl.course_id " +
// " where bl.del_flag != 1 and bl.flag = 1 " +
//
// //" and COP == " //企业id
//
// " and su.del_flag != 1 and su.flag = 1 " +
// " and suc.del_flag != 1 and suc.flag = 1 " +
// " and bl.release_state = 2 " +
// " order by bl.collect_number desc " +
// "</script>")
@Select(" <script> select bl.* " +
" ,su.name lecturerName " +
" ,suc.name createByName " +
" from b_lesson bl " +
" left join s_user su on su.business_id = bl.lecturer_id " +
" left join s_user suc on suc.business_id = bl.create_by " +
// " left join b_course bc on bc.business_id = bl.course_type " +
" 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_course bc on bc.business_id = bl.course_id " +
" where bl.del_flag != 1 and bl.flag = 1 " +
" and su.del_flag != 1 and su.flag = 1 " +
" and suc.del_flag != 1 and suc.flag = 1 " +
" and bv.del_flag != 1 and bv.flag = 1 " +
" and bl.release_state = 2 " +
" order by bl.collect_number desc " +
" and ((bvs.type = 0 and bvs.target_id = #{userId}) " +
" or (bvs.type = 1 and bvs.target_id in " +
" <foreach item='item' index='index' collection='departs' open='(' separator=',' close=')'> #{item} </foreach>)) " +
" and bl.person_number > (select `value` from b_dictionary where type = 'GZRS') " + //ZXRS 关注人数
" order by bl.collect_number,bl.release_date desc " +
"</script>")
@ResultMap(value = "BaseResultMap")
List<BLesson> queryConcern();
List<BLesson> queryConcern(@Param("userId") String userId, @Param("departs") List<String> departs);
@Select(" <script> select bl.* " +
" ,su.name lecturerName " +
" ,suc.name createByName " +
" from b_lesson bl " +
" left join s_user su on su.business_id = bl.lecturer_id " +
" left join s_user suc on suc.business_id = bl.create_by " +
// " left join b_course bc on bc.business_id = bl.course_type " +
" where bl.del_flag != 1 and bl.flag = 1 " +
" and su.del_flag != 1 and su.flag = 1 " +
" and suc.del_flag != 1 and suc.flag = 1 " +
" and bl.release_state = 2 " +
" order by bl.hot_number desc " +
"</script>")
@ResultMap(value = "BaseResultMap")
List<BLesson> queryInterested();
// @Select(" <script> select bl.* " +
// " ,su.name lecturerName " +
// " ,suc.name createByName " +
// " from b_lesson bl " +
// " left join s_user su on su.business_id = bl.lecturer_id " +
// " left join s_user suc on suc.business_id = bl.create_by " +
//// " left join b_course bc on bc.business_id = bl.course_id " +
// " where bl.del_flag != 1 and bl.flag = 1 " +
// " and su.del_flag != 1 and su.flag = 1 " +
// " and suc.del_flag != 1 and suc.flag = 1 " +
// " and bl.release_state = 2 " +
// " order by bl.hot_number desc " +
// "</script>")
// @ResultMap(value = "BaseResultMap")
@Select(" <script> SELECT b.* " +
" ,su.name lecturerName " +
" ,suc.name createByName " +
" FROM " +
" b_lesson b " +
" LEFT JOIN b_lesson_label bl ON b.business_id = bl.lesson_id" +
" inner JOIN ( " +
" SELECT " +
" bla.business_id AS bussinessId, " +
" count( 1 ) AS bsum " +
" FROM " +
" b_label bla " +
" 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_person bp ON b.business_id = bp.lesson_id " +
" WHERE " +
" bp.person_id = #{userId} " +
" and b.del_flag != 1 and b.flag = 1 " +
" and bp.del_flag != 1 and bp.flag = 1 " +
" GROUP BY " +
" bla.business_id " +
" ) T ON T.bussinessId = bl.label_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 b_viewrange bv on bl.business_id = bv.lesson_id " +
" left join b_viewrange_son bvs on bv.business_id = bvs.viewrange_id " +
" where b.del_flag != 1 and b.flag = 1 " +
" and su.del_flag != 1 and su.flag = 1 " +
" and suc.del_flag != 1 and suc.flag = 1 " +
" and bv.del_flag != 1 and bv.flag = 1 " +
" 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 " +
" where blp.person_id = #{userId} ) " +
" and b.release_state = 2 " +
" and ((bvs.type = 0 and bvs.target_id = #{userId}) " +
" or (bvs.type = 1 and bvs.target_id in " +
" <foreach item='item' index='index' collection='departs' open='(' separator=',' close=')'> #{item} </foreach>)) " +
" order by T.bsum , b.collect_number " +
"</script>")
List<BLesson> queryInterested(@Param("userId") String userId, @Param("departs") List<String> departs);
//查询课程中的标签
@Select(" <script> select blb.business_id businessId,blb.l_name lName" +
......@@ -218,14 +308,14 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" from b_lesson bl " +
" left join s_user su on su.business_id = bl.lecturer_id " +
" left join s_user suc on suc.business_id = bl.create_by " +
// " left join b_course bc on bc.business_id = bl.course_type " +
// " left join b_course bc on bc.business_id = bl.course_id " +
" where bl.del_flag != 1 and bl.flag = 1 " +
" and su.del_flag != 1 and su.flag = 1 " +
" and suc.del_flag != 1 and suc.flag = 1 " +
" and bl.release_state = 2 " +
" <if test= \" param.viewParam !=null and param.viewParam != ''\">and (bl.lesson_name like CONCAT('%',#{param.viewParam},'%') " +
" or su.name like CONCAT('%',#{param.viewParam},'%'))</if> " +
" <if test= \" courseIds !=null and courseIds.size() > 0 \">and course_type in " +
" <if test= \" courseIds !=null and courseIds.size() > 0 \">and course_id in " +
" <foreach item='item' index='index' collection='courseIds' open='(' separator=',' close=')'> #{item} </foreach> " +
" </if> " +
" order by bl.person_number desc " +
......@@ -249,5 +339,17 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
"</script>"})
int closeLesson(BLesson model);
@Select({"<script>",
" 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 = '2') publishedCount, " +
"(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} and is_finish = '1') finishCount, " +
"(select COUNT(1) from b_lesson_person where person_id = #{userId} and is_finish = '0') notFinishCount " +
"</script>"})
ILessonCountDTO iLessonCount(String userId);
}
......@@ -28,7 +28,7 @@ public class AddLessonDTO {
@ApiModelProperty(value = "课程分类",required = true)
@NotBlank
@Length(min = 1,max = 64,message = "长度最小为1,最大为50")
private String courseType;
private String courseId;
@ApiModelProperty(value = "课程描述")
......
......@@ -21,7 +21,7 @@ public class FindAllLessonDTO {
@ApiModelProperty(value = "课程分类")
@Length(min = 1,max = 64,message = "长度最小为1,最大为50")
private String courseType;
private String courseId;
@ApiModelProperty(value = "可见范围")
@Length(min = 1,max = 64,message = "长度最小为1,最大为50")
......
package org.rcisoft.business.blesson.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class ILearnCountDTO {
}
package org.rcisoft.business.blessonperson.dto;
package org.rcisoft.business.blesson.dto;
import io.swagger.annotations.ApiModelProperty;
......
package org.rcisoft.business.blessonperson.dto;
package org.rcisoft.business.blesson.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......
package org.rcisoft.business.blesson.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class ILessonCountDTO {
@ApiModelProperty(value = "我发布全部课程数量")
private String publishAllCount;
@ApiModelProperty(value = "我发布未发布课程数量")
private String notPublishCount;
@ApiModelProperty(value = "我发布已发布课程数量")
private String publishedCount;
@ApiModelProperty(value = "我发布已关闭课程数量")
private String closedCount;
@ApiModelProperty(value = "我学习全部课程数量")
private String learnAllCount;
@ApiModelProperty(value = "我学完课程数量")
private String finishCount;
@ApiModelProperty(value = "我未学完课程数量")
private String notFinishCount;
}
......@@ -52,7 +52,7 @@ public class BLesson extends IdEntity<BLesson> {
@ApiModelProperty(value = "课程分类")
@Length(min = 1,max = 64,message = "长度最小为1,最大为50")
private String courseType;
private String courseId;
@ApiModelProperty(value = "选课人数")
@Length(min = 1,max = 64,message = "长度最小为1,最大为50")
......
package org.rcisoft.business.blessonperson.entity;
package org.rcisoft.business.blesson.entity;
import io.swagger.annotations.ApiModelProperty;
......@@ -76,7 +76,7 @@ public class BLessonPerson extends IdEntity<BLessonPerson> {
@ApiModelProperty(value = "分类")
@Transient
private String courseType;
private String courseId;
@ApiModelProperty(value = "评论数")
@Transient
......
package org.rcisoft.business.blessonperson.service;
package org.rcisoft.business.blesson.service;
import org.rcisoft.business.blesson.dto.ILearnCountDTO;
import org.rcisoft.business.blesson.entity.BLesson;
import org.rcisoft.business.blessonperson.dto.ILearnLessonDTO;
import org.rcisoft.business.blesson.dto.ILearnLessonDTO;
import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.core.model.PersistModel;
......@@ -25,4 +26,11 @@ public interface BLessonPersonService {
* @return
*/
List<BLesson> queryLearnBLessonsByPagination(PageUtil pageUtil, ILearnLessonDTO model, String userId);
/**
* 我学习的课程总数
* @param userId
* @return
*/
ILearnCountDTO iLearnLessonCount(String userId);
}
......@@ -50,7 +50,7 @@ public interface BLessonService{
* @param
* @return
*/
List<BLesson> queryPersonMoreByPagination(PageUtil pageUtil);
List<BLesson> queryPersonMoreByPagination(PageUtil pageUtil,String userId);
/**
* 分页查找推荐
......@@ -66,7 +66,7 @@ public interface BLessonService{
* @param
* @return
*/
List<BLesson> queryConcernByPagination(PageUtil pageUtil);
List<BLesson> queryConcernByPagination(PageUtil pageUtil,String userId);
/**
* 分页查找可能感兴趣的
......@@ -74,7 +74,7 @@ public interface BLessonService{
* @param
* @return
*/
List<BLesson> queryInterestedByPagination(PageUtil pageUtil);
List<BLesson> queryInterestedByPagination(PageUtil pageUtil,String userId);
/**
* 插入
......@@ -111,4 +111,11 @@ public interface BLessonService{
*/
List<BLesson> findLessonTrain(PageUtil pageUtil, LessonTrainDTO lessonTrainDTO);
/**
* 我发布的总数
* @param userId
* @return
*/
ILessonCountDTO iLessonCount(String userId);
}
package org.rcisoft.business.blessonperson.service.impl;
package org.rcisoft.business.blesson.service.impl;
import org.rcisoft.business.blesson.dto.ILearnCountDTO;
import org.rcisoft.business.blesson.entity.BLesson;
import org.rcisoft.business.blessonperson.dao.BLessonPersonRepository;
import org.rcisoft.business.blessonperson.dto.ILearnLessonDTO;
import org.rcisoft.business.blessonperson.service.BLessonPersonService;
import org.rcisoft.business.blesson.dao.BLessonPersonRepository;
import org.rcisoft.business.blesson.dto.ILearnLessonDTO;
import org.rcisoft.business.blesson.service.BLessonPersonService;
import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.core.model.PersistModel;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -37,5 +38,10 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
return bLessonPersonRepository.queryLearnBLessons(model, userId);
}
@Override
public ILearnCountDTO iLearnLessonCount(String userId) {
return bLessonPersonRepository.iLearnLessonCount(userId);
}
}
......@@ -73,21 +73,37 @@ public class BLessonServiceImpl implements BLessonService {
}
@Override
public List<BLesson> queryPersonMoreByPagination(PageUtil pageUtil) {
return bLessonRepository.queryPersonMore();
public List<BLesson> queryPersonMoreByPagination(PageUtil pageUtil, String userId) {
List<String> departs = new ArrayList<>();
departs.add("1");
departs.add("2");
departs.add("3");
return bLessonRepository.queryPersonMore(userId,departs);
}
@Override
public List<BLesson> queryRecommendByPagination(PageUtil pageUtil,String userId) {
return bLessonRepository.queryRecommend(userId);
List<String> departs = new ArrayList<>();
departs.add("1");
departs.add("2");
departs.add("3");
return bLessonRepository.queryRecommend(userId,departs);
}
@Override
public List<BLesson> queryConcernByPagination(PageUtil pageUtil) {
return bLessonRepository.queryConcern();
public List<BLesson> queryConcernByPagination(PageUtil pageUtil,String userId) {
List<String> departs = new ArrayList<>();
departs.add("1");
departs.add("2");
departs.add("3");
return bLessonRepository.queryConcern(userId,departs);
}
@Override
public List<BLesson> queryInterestedByPagination(PageUtil pageUtil) {
return bLessonRepository.queryInterested();
public List<BLesson> queryInterestedByPagination(PageUtil pageUtil,String userId) {
List<String> departs = new ArrayList<>();
departs.add("1");
departs.add("2");
departs.add("3");
return bLessonRepository.queryInterested(userId,departs);
}
......@@ -195,18 +211,9 @@ public class BLessonServiceImpl implements BLessonService {
return null;
}
private Map<String,Object> queryParamHandler(BLesson model){
Map param = new HashMap<String, Object>();
if(model.getLessonName()!=null)
param.put("name","%"+model.getLessonName()+"%");
else
param.put("name","%%");
if(model.getCode()!=null)
param.put("code","%"+model.getCode()+"%");
else
param.put("code","%%");
return param;
@Override
public ILessonCountDTO iLessonCount(String userId) {
return bLessonRepository.iLessonCount(userId);
}
}
package org.rcisoft.business.blessonperson.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.rcisoft.business.blesson.dto.BLessonIPublishDTO;
import org.rcisoft.business.blesson.entity.BLesson;
import org.rcisoft.business.blessonperson.dto.ILearnLessonDTO;
import org.rcisoft.business.blessonperson.entity.BLessonPerson;
import org.rcisoft.business.blessonperson.service.BLessonPersonService;
import org.rcisoft.common.controller.PaginationController;
import org.rcisoft.common.model.GridModel;
import org.rcisoft.core.constant.MessageConstant;
import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.result.Result;
import org.rcisoft.sys.user.bean.CurUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
@Api(tags = "9 学生-课程")
@RestController
@RequestMapping("/BLessonPerson")
@Slf4j
public class BLessonPersonController extends PaginationController<BLesson> {
@Autowired
private BLessonPersonService bLessonPersonService;
@ApiOperation(value="901 退出课程", notes="根据ID停用一条记录")
@ApiImplicitParam(name = "businessId", value = "退出课程的选课id", required = true, dataType = "varchar")
@PostMapping(value = "/quit")
public Result remove(CurUser curUser, String businessId, BindingResult bindingResult) {
PersistModel data = bLessonPersonService.quit(businessId);
return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
businessId);
}
@ApiOperation(value="902 分页查询我学习", notes="分页查询我学习")
@GetMapping(value = "/queryLearnBLessonsByPagination")
public Result queryLearnBLessonsByPagination(CurUser curUser, @Valid ILearnLessonDTO param, BindingResult bindingResult) {
String userId = curUser.getUserId();
bLessonPersonService.queryLearnBLessonsByPagination(getPaginationUtility(),param,userId);
GridModel gridModel = getGridModelResponse();
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
gridModel);
}
}
......@@ -14,7 +14,7 @@ server:
druid:
# url: jdbc:mysql://127.0.0.1:3306/edu_db0917?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=false
url: jdbc:mysql://127.0.0.1:3306/new_edu_db?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=false
url: jdbc:mysql://127.0.0.1:3306/edu_db?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=false
#url: jdbc:mysql://120.52.179.75:13318/edu_db?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=false
username: root
password: root
......
......@@ -17,7 +17,7 @@
<result column="class_hour" jdbcType="VARCHAR" property="classHour"/>
<result column="lecturer_id" jdbcType="VARCHAR" property="lecturerId"/>
<result column="release_state" jdbcType="VARCHAR" property="releaseState"/>
<result column="course_type" jdbcType="VARCHAR" property="courseType"/>
<result column="course_id" jdbcType="VARCHAR" property="courseId"/>
<result column="person_number" jdbcType="VARCHAR" property="personNumber"/>
<result column="course_time" jdbcType="VARCHAR" property="courseTime"/>
<result column="course_description" jdbcType="VARCHAR" property="courseDescription"/>
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.rcisoft.business.blessonperson.dao.BLessonPersonRepository">
<mapper namespace="org.rcisoft.business.blesson.dao.BLessonPersonRepository">
<!--<resultMap id="BaseResultMap" type="org.rcisoft.business.blesson.entity.BLesson">-->
<!--<id column="business_id" jdbcType="VARCHAR" property="businessId"/>-->
<!--<result column="code" jdbcType="VARCHAR" property="code"/>-->
......@@ -19,7 +19,7 @@
<!--<result column="directionId" jdbcType="VARCHAR" property="directionId"/>-->
<!--</resultMap>-->
<resultMap id="BaseResultMap" type="org.rcisoft.business.blessonperson.entity.BLessonPerson">
<resultMap id="BaseResultMap" type="org.rcisoft.business.blesson.entity.BLessonPerson">
<id column="business_id" jdbcType="VARCHAR" property="businessId"/>
<result column="create_by" jdbcType="VARCHAR" property="createBy"/>
<result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
......
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