Commit 940f93f8 authored by root's avatar root

修改接口

parent 2dfec72d
...@@ -78,12 +78,12 @@ public class BBannerController extends PaginationController<BBanner> { ...@@ -78,12 +78,12 @@ public class BBannerController extends PaginationController<BBanner> {
@ApiOperation(value = "104 分页获取banner", notes = "根据条件分页查询", response = BBanner.class) @ApiOperation(value = "104 分页获取banner", notes = "根据条件分页查询", response = BBanner.class)
@GetMapping(value = "/queryBBannerByPagination") @GetMapping(value = "/queryBBannerByPagination")
public Result queryBBannerByPagination(CurUser curUser, @Valid FindBannerPaginDTO param, BindingResult bindingResult) { public Result queryBBannerByPagination(CurUser curUser, @Valid FindBannerPaginDTO param, BindingResult bindingResult) {
// bBannerService.queryBanner(param); bBannerService.queryBannerByPagination(getPaginationUtility(), param);
// GridModel gridModel = getGridModelResponse(); GridModel gridModel = getGridModelResponse();
return Result.builder(new PersistModel(1), return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR, MessageConstant.MESSAGE_ALERT_ERROR,
bBannerService.queryBanner(param)); gridModel);
} }
/* /*
......
...@@ -4,6 +4,7 @@ import org.apache.ibatis.annotations.Param; ...@@ -4,6 +4,7 @@ import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap; import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update; import org.apache.ibatis.annotations.Update;
import org.rcisoft.business.bbanner.dto.AddOrUpdateDTO;
import org.rcisoft.business.bbanner.dto.FindBannerPaginDTO; import org.rcisoft.business.bbanner.dto.FindBannerPaginDTO;
import org.rcisoft.business.bbanner.dto.TopDownDTO; import org.rcisoft.business.bbanner.dto.TopDownDTO;
import org.rcisoft.core.base.BaseMapper; import org.rcisoft.core.base.BaseMapper;
...@@ -27,15 +28,21 @@ public interface BBannerRepository extends BaseMapper<BBanner> { ...@@ -27,15 +28,21 @@ public interface BBannerRepository extends BaseMapper<BBanner> {
* @param param * @param param
* @return * @return
*/ */
@Select("<script>select * from b_banner where del_flag='0' and flag = '1' " + @Select("<script>select bb.* , bl.lesson_name lessonName from b_banner bb " +
" <if test=\"businessId!=null and businessId != ''\">and business_id = #{businessId})</if>" + " left join b_lesson bl on bb.course_id = bl.business_id " +
" <if test=\"title!=null and title != ''\">and title like CONCAT('%',#{title},'%')</if>" +
" <if test=\"isExternalLink!=null and isExternalLink != ''\">and is_external_link=#{isExternalLink}</if>" +
" <if test=\"lineType!=null and lineType != ''\">and line_type=#{lineType}</if>" +
// " corp_id = #{param.corpId} "+ " and bl.corp_id = #{corpId} "+
" order by banner_sort asc " + " and bl.del_flag='0' and bl.flag = '1'" +
" where bb.del_flag='0' and bb.flag = '1' " +
" <if test=\"businessId!=null and businessId != ''\">and bb.business_id = #{businessId})</if>" +
" <if test=\"title!=null and title != ''\">and bb.title like CONCAT('%',#{title},'%')</if>" +
" <if test=\"isExternalLink!=null and isExternalLink != ''\">and bb.is_external_link=#{isExternalLink}</if>" +
" <if test=\"lineType!=null and lineType != ''\">and bb.line_type=#{lineType}</if>" +
" and bb.corp_id = #{corpId} "+
" order by bb.banner_sort asc " +
"</script>") "</script>")
@ResultMap(value = "BaseResultMap" ) @ResultMap(value = "BaseResultMap" )
List<BBanner> queryBanners(FindBannerPaginDTO param); List<BBanner> queryBanners(FindBannerPaginDTO param);
...@@ -54,8 +61,10 @@ public interface BBannerRepository extends BaseMapper<BBanner> { ...@@ -54,8 +61,10 @@ public interface BBannerRepository extends BaseMapper<BBanner> {
* @return * @return
*/ */
@Select("<script>select count(1) from b_banner where " + @Select("<script>select count(1) from b_banner where " +
" del_flag = 0 and flag = 1 </script>") " del_flag = 0 and flag = 1 " +
int selectCountBanner(); " and corp_id = corpId " +
"</script>")
int selectCountBanner(AddOrUpdateDTO param);
/** /**
* 获取sort最大值 +1 * 获取sort最大值 +1
......
...@@ -56,4 +56,7 @@ public class BBanner extends IdEntity<SysDept> { ...@@ -56,4 +56,7 @@ public class BBanner extends IdEntity<SysDept> {
@ApiModelProperty(value = "排序") @ApiModelProperty(value = "排序")
private Integer bannerSort; private Integer bannerSort;
@ApiModelProperty(value = "课程名")
private String lessonName;
} }
\ No newline at end of file
...@@ -39,10 +39,11 @@ public interface BBannerService { ...@@ -39,10 +39,11 @@ public interface BBannerService {
/** /**
* 获取图片分页 * 获取图片分页
* @param pageUtil
* @param model * @param model
* @return * @return
*/ */
List<BBanner> queryBanner(FindBannerPaginDTO model); List<BBanner> queryBannerByPagination(PageUtil pageUtil, FindBannerPaginDTO model);
/** /**
......
...@@ -61,10 +61,10 @@ public class BBannerServiceImpl implements BBannerService { ...@@ -61,10 +61,10 @@ public class BBannerServiceImpl implements BBannerService {
} else { } else {
UserUtil.setCurrentPersistOperation(model); UserUtil.setCurrentPersistOperation(model);
//查询Banner是否大于等于5个,大于等于五个不允许添加 //查询Banner是否大于等于5个,大于等于五个不允许添加
// int countBanner = bBannerRepository.selectCountBanner(); int countBanner = bBannerRepository.selectCountBanner(addOrUpdateDTO);
// if(countBanner >= 5){ if(countBanner >= 5){
// throw new ServiceException(ResultExceptionEnum.NOT_MORE_COUNT); throw new ServiceException(ResultExceptionEnum.NOT_MORE_COUNT);
// } }
//查询最大排序值+1后放入Banner中 //查询最大排序值+1后放入Banner中
int sort = bBannerRepository.selectMaxSort(); int sort = bBannerRepository.selectMaxSort();
model.setBannerSort(sort); model.setBannerSort(sort);
...@@ -92,7 +92,7 @@ public class BBannerServiceImpl implements BBannerService { ...@@ -92,7 +92,7 @@ public class BBannerServiceImpl implements BBannerService {
} }
@Override @Override
public List<BBanner> queryBanner(FindBannerPaginDTO model) { public List<BBanner> queryBannerByPagination(PageUtil pageUtil, FindBannerPaginDTO model) {
return bBannerRepository.queryBanners(model); return bBannerRepository.queryBanners(model);
} }
......
...@@ -137,7 +137,7 @@ public class BLessonController extends PaginationController<BLesson> { ...@@ -137,7 +137,7 @@ public class BLessonController extends PaginationController<BLesson> {
@ApiOperation(value="608 分页查询最受关注", notes="分页查询最受关注", response = BLesson.class) @ApiOperation(value="608 分页查询最受关注", notes="分页查询最受关注", response = BLesson.class)
@GetMapping(value = "/queryConcernByPagination") @GetMapping(value = "/queryConcernByPagination")
public Result queryConcernByPagination(CurUser curUser) { public Result queryConcernByPagination(CurUser curUser, BindingResult bindingResult) {
bLessonService.queryConcernByPagination(getPaginationUtility(),curUser); bLessonService.queryConcernByPagination(getPaginationUtility(),curUser);
GridModel gridModel = getGridModelResponse(); GridModel gridModel = getGridModelResponse();
return Result.builder(new PersistModel(1), return Result.builder(new PersistModel(1),
...@@ -186,14 +186,14 @@ public class BLessonController extends PaginationController<BLesson> { ...@@ -186,14 +186,14 @@ public class BLessonController extends PaginationController<BLesson> {
@ApiOperation(value="612 课程培训条件查询", notes="课程培训条件查询(Banner内部资源)", response = BLesson.class) @ApiOperation(value="612 课程培训条件查询", notes="课程培训条件查询(Banner内部资源)", response = BLesson.class)
@ApiImplicitParam(name = "businessId", value = "businessId", required = true, dataType = "varchar") @ApiImplicitParam(name = "businessId", value = "businessId", required = true, dataType = "varchar")
@GetMapping(value = "/findLessonAtBannerByPagination") @GetMapping(value = "/findLessonAtBanner")
public Result findLessonAtBannerByPagination(CurUser curUser, @Valid LessonTrainAtBannerDTO lessonTrainDTO, BindingResult bindingResult) { public Result findLessonAtBanner(CurUser curUser, @Valid LessonTrainAtBannerDTO lessonTrainDTO, BindingResult bindingResult) {
bLessonService.findLessonAtBannerByPagination(getPaginationUtility(),lessonTrainDTO); // bLessonService.findLessonAtBannerByPagination(getPaginationUtility(),lessonTrainDTO);
GridModel gridModel = getGridModelResponse(); // GridModel gridModel = getGridModelResponse();
return Result.builder(new PersistModel(1), return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR, MessageConstant.MESSAGE_ALERT_ERROR,
gridModel); bLessonService.findLessonAtBanner(lessonTrainDTO));
} }
@ApiOperation(value="613 我的课程总数(学习和发布)", notes="我的课程总数") @ApiOperation(value="613 我的课程总数(学习和发布)", notes="我的课程总数")
...@@ -307,20 +307,42 @@ public class BLessonController extends PaginationController<BLesson> { ...@@ -307,20 +307,42 @@ public class BLessonController extends PaginationController<BLesson> {
cancelAppointDTO); cancelAppointDTO);
} }
@ApiOperation(value="622 分页查询列表页推荐", notes="分页查询列表页推荐", response = BLesson.class) // @ApiOperation(value="622 分页查询列表页推荐", notes="分页查询列表页推荐", response = BLesson.class)
@GetMapping(value = "/queryRecommendListByPagination") // @GetMapping(value = "/queryRecommendListByPagination")
public Result queryRecommendListByPagination(CurUser curUser, @Valid FindListLessonDTO param, BindingResult bindingResult) { // public Result queryRecommendListByPagination(CurUser curUser, @Valid FindListLessonDTO param, BindingResult bindingResult) {
List<AllCourseDTO> allCourse = null; // List<AllCourseDTO> allCourse = null;
if (StringUtils.isNotEmpty(param.getCourse())){ // if (StringUtils.isNotEmpty(param.getCourse())){
allCourse = bCourseService.findAllCourse(curUser.getCorpId()); // allCourse = bCourseService.findAllCourse(curUser.getCorpId());
} // }
bLessonService.queryRecommendListByPagination(getPaginationUtility(),param,allCourse); // bLessonService.queryRecommendListByPagination(getPaginationUtility(),param,allCourse);
GridModel gridModel = getGridModelResponse(); // GridModel gridModel = getGridModelResponse();
return Result.builder(new PersistModel(1), // return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS, // MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR, // MessageConstant.MESSAGE_ALERT_ERROR,
gridModel); // gridModel);
} // }
//
// @ApiOperation(value="623 分页查询列表页在学", notes="分页查询列表页推荐", response = BLesson.class)
// @GetMapping(value = "/queryLearnListByPagination")
// public Result queryLearnListByPagination(CurUser curUser, @Valid FindListLessonDTO param, BindingResult bindingResult) {
// bLessonService.queryLearnListByPagination(getPaginationUtility(),param);
// GridModel gridModel = getGridModelResponse();
// return Result.builder(new PersistModel(1),
// MessageConstant.MESSAGE_ALERT_SUCCESS,
// MessageConstant.MESSAGE_ALERT_ERROR,
// gridModel);
// }
//
// @ApiOperation(value="624 分页查询列表页收藏", notes="分页查询列表页收藏", response = BLesson.class)
// @GetMapping(value = "/queryCollectListByPagination")
// public Result queryCollectListByPagination(CurUser curUser, @Valid FindListLessonDTO param, BindingResult bindingResult) {
// bLessonService.queryCollectListByPagination(getPaginationUtility(),param);
// GridModel gridModel = getGridModelResponse();
// return Result.builder(new PersistModel(1),
// MessageConstant.MESSAGE_ALERT_SUCCESS,
// MessageConstant.MESSAGE_ALERT_ERROR,
// gridModel);
// }
// @ApiOperation(value="619 推荐课程", notes="根据ID推荐课程") // @ApiOperation(value="619 推荐课程", notes="根据ID推荐课程")
// @PostMapping(value = "/recommend") // @PostMapping(value = "/recommend")
......
...@@ -418,7 +418,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -418,7 +418,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" order by bl.release_date desc " + " order by bl.release_date desc " +
"</script>") "</script>")
@ResultMap(value = "BaseResultMap") @ResultMap(value = "BaseResultMap")
List<BLesson> findLessonAtBannerByPagination(@Param("param") LessonTrainAtBannerDTO param); List<BLesson> findLessonAtBanner(@Param("param") LessonTrainAtBannerDTO param);
/** /**
* 查询我发布和我学习课程数量 * 查询我发布和我学习课程数量
...@@ -478,7 +478,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -478,7 +478,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
int personNumberMinusOne(String BusinessId); int personNumberMinusOne(String BusinessId);
/** /**
* 页分页查询全部课程 * 列表页分页查询全部课程
* @param model * @param model
* @return * @return
*/ */
...@@ -503,8 +503,8 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -503,8 +503,8 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" and suc.corp_id = #{model.corpId} "+ " and suc.corp_id = #{model.corpId} "+
" and bv.corp_id = #{model.corpId} "+ " and bv.corp_id = #{model.corpId} "+
" <if test=\"model.labelId !=null and model.labelId != ''\">and bll.label_id = #{model.labelId})</if>" + " <if test=\"model.labelId !=null and model.labelId != ''\">and bll.label_id = #{model.labelId}</if>" +
" <if test=\"model.lessonType !=null and model.lessonType != ''\">and bl.lesson_type = #{model.lessonType})</if>" + " <if test=\"model.lessonType !=null and model.lessonType != ''\">and bl.lesson_type = #{model.lessonType}</if>" +
" and bl.release_state = 2 " + " and bl.release_state = 2 " +
" and ((bvs.type = 0 and bvs.target_id = #{model.userId}) " + " and ((bvs.type = 0 and bvs.target_id = #{model.userId}) " +
" <if test=\"model.departs != null and model.departs.size() > 0 \"> " + " <if test=\"model.departs != null and model.departs.size() > 0 \"> " +
...@@ -569,7 +569,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -569,7 +569,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
/** /**
* 页分页查询推荐课程 * 列表页分页查询推荐课程
* @param model * @param model
* @return * @return
*/ */
...@@ -594,8 +594,8 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -594,8 +594,8 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" and suc.corp_id = #{model.corpId} "+ " and suc.corp_id = #{model.corpId} "+
" and br.corp_id = #{model.corpId} "+ " and br.corp_id = #{model.corpId} "+
" <if test=\"model.labelId !=null and model.labelId != ''\">and bll.label_id = #{model.labelId})</if>" + " <if test=\"model.labelId !=null and model.labelId != ''\">and bll.label_id = #{model.labelId}</if>" +
" <if test=\"model.lessonType !=null and model.lessonType != ''\">and bl.lesson_type = #{model.lessonType})</if>" + " <if test=\"model.lessonType !=null and model.lessonType != ''\">and bl.lesson_type = #{model.lessonType}</if>" +
" and bl.release_state = 2 " + " and bl.release_state = 2 " +
" and ((brs.type = 0 and brs.target_id = #{model.userId}) " + " and ((brs.type = 0 and brs.target_id = #{model.userId}) " +
" <if test=\"model.departs != null and model.departs.size() > 0 \"> " + " <if test=\"model.departs != null and model.departs.size() > 0 \"> " +
...@@ -613,5 +613,110 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -613,5 +613,110 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
"</script>") "</script>")
@ResultMap(value = "BaseResultMap") @ResultMap(value = "BaseResultMap")
List<BLesson> queryRecommendListByPagination(@Param("model") FindListLessonDTO model); List<BLesson> queryRecommendListByPagination(@Param("model") FindListLessonDTO model);
/**
* 列表页分页查询在学课程
* @param model
* @return
*/
@Select(" <script> select distinct bl.* " +
" ,su.name lecturerName " +
" ,suc.name createByName " +
" 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 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_lesson_label bll on bl.business_id = bll.lesson_id " +
// " left join b_label bla on bla.business_id = bll.label_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 blp.del_flag != 1 and blp.flag = 1 " +
// " and br.del_flag != 1 and br.flag = 1 " +
// " and bla.del_flag != 1 and bla.flag = 1 " +
" and bl.corp_id = #{model.corpId} "+
" and su.corp_id = #{model.corpId} "+
" and suc.corp_id = #{model.corpId} "+
// " and br.corp_id = #{model.corpId} "+
" <if test=\"model.labelId !=null and model.labelId != ''\">and bll.label_id = #{model.labelId}</if>" +
" <if test=\"model.lessonType !=null and model.lessonType != ''\">and bl.lesson_type = #{model.lessonType}</if>" +
" and bl.release_state = 2 " +
" and blp.person_id = #{model.userId} " +
// " and ((brs.type = 0 and brs.target_id = #{model.userId}) " +
// " <if test=\"model.departs != null and model.departs.size() > 0 \"> " +
// " or (brs.type = 1 and brs.target_id in " +
// " <foreach item='item' index='index' collection='model.departs' open='(' separator=',' close=')'> #{item} </foreach>)" +
// " </if>) " +
" <if test= \" model.viewParam !=null and model.viewParam != ''\">and (bl.lesson_name like CONCAT('%',#{model.viewParam},'%') " +
" or su.name like CONCAT('%',#{model.viewParam},'%'))</if> " +
" <if test= \" model.courseIds !=null and model.courseIds.size() > 0 \">and course_id in " +
" <foreach item='item' index='index' collection='model.courseIds' open='(' separator=',' close=')'> #{item} </foreach> " +
" </if> " +
" <if test=\"model.releaseDateSort !=null and model.releaseDateSort !='' and model.releaseDateSort =='0'.toString()\"> ORDER BY bl.release_date DESC </if> "+
" <if test=\"model.releaseDateSort !=null and model.releaseDateSort !='' and model.releaseDateSort =='1'.toString()\"> ORDER BY bl.release_date ASC "+
" </if> "+
"</script>")
@ResultMap(value = "BaseResultMap")
List<BLesson> queryLearnListByPagination(@Param("model") FindListLessonDTO model);
/**
* 列表页分页查询收藏课程
* @param model
* @return
*/
@Select(" <script> select distinct bl.* " +
" ,su.name lecturerName " +
" ,suc.name createByName " +
" 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 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_lesson_label bll on bl.business_id = bll.lesson_id " +
// " left join b_label bla on bla.business_id = bll.label_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 blp.del_flag != 1 and blp.flag = 1 " +
// " and br.del_flag != 1 and br.flag = 1 " +
// " and bla.del_flag != 1 and bla.flag = 1 " +
" and bl.corp_id = #{model.corpId} "+
" and su.corp_id = #{model.corpId} "+
" and suc.corp_id = #{model.corpId} "+
// " and br.corp_id = #{model.corpId} "+
" <if test=\"model.labelId !=null and model.labelId != ''\">and bll.label_id = #{model.labelId}</if>" +
" <if test=\"model.lessonType !=null and model.lessonType != ''\">and bl.lesson_type = #{model.lessonType}</if>" +
" and bl.release_state = 2 " +
" and blp.is_collect = 1 " +
" and blp.person_id = #{model.userId} " +
// " and ((brs.type = 0 and brs.target_id = #{model.userId}) " +
// " <if test=\"model.departs != null and model.departs.size() > 0 \"> " +
// " or (brs.type = 1 and brs.target_id in " +
// " <foreach item='item' index='index' collection='model.departs' open='(' separator=',' close=')'> #{item} </foreach>)" +
// " </if>) " +
" <if test= \" model.viewParam !=null and model.viewParam != ''\">and (bl.lesson_name like CONCAT('%',#{model.viewParam},'%') " +
" or su.name like CONCAT('%',#{model.viewParam},'%'))</if> " +
" <if test= \" model.courseIds !=null and model.courseIds.size() > 0 \">and course_id in " +
" <foreach item='item' index='index' collection='model.courseIds' open='(' separator=',' close=')'> #{item} </foreach> " +
" </if> " +
" <if test=\"model.releaseDateSort !=null and model.releaseDateSort !='' and model.releaseDateSort =='0'.toString()\"> ORDER BY bl.release_date DESC </if> "+
" <if test=\"model.releaseDateSort !=null and model.releaseDateSort !='' and model.releaseDateSort =='1'.toString()\"> ORDER BY bl.release_date ASC "+
" </if> "+
"</script>")
@ResultMap(value = "BaseResultMap")
List<BLesson> queryCollectListByPagination(@Param("model") FindListLessonDTO model);
} }
...@@ -24,9 +24,12 @@ public class FindListLessonDTO { ...@@ -24,9 +24,12 @@ public class FindListLessonDTO {
@NotNull @NotNull
private String releaseDateSort; private String releaseDateSort;
@ApiModelProperty(value = "课程类型",required = true) @ApiModelProperty(value = "课程类型 0 课程 1 培训")
private String lessonType; private String lessonType;
@ApiModelProperty(value = "查询类型 0 全部 1 推荐 2在学 3收藏",required = true)
private String searchType;
private List<String> courseIds; private List<String> courseIds;
private String userId; private String userId;
......
...@@ -120,11 +120,10 @@ public interface BLessonService{ ...@@ -120,11 +120,10 @@ public interface BLessonService{
/** /**
* 课程培训条件查询 * 课程培训条件查询
* @param pageUtil
* @param lessonTrainDTO * @param lessonTrainDTO
* @return * @return
*/ */
List<BLesson> findLessonAtBannerByPagination(PageUtil pageUtil, LessonTrainAtBannerDTO lessonTrainDTO); List<BLesson> findLessonAtBanner(LessonTrainAtBannerDTO lessonTrainDTO);
/** /**
* 我发布的总数 * 我发布的总数
...@@ -150,11 +149,27 @@ public interface BLessonService{ ...@@ -150,11 +149,27 @@ public interface BLessonService{
*/ */
List<BLesson> theLessonMangageByPagination(PageUtil pageUtil,CurUser curUser,BLesson bLesson); List<BLesson> theLessonMangageByPagination(PageUtil pageUtil,CurUser curUser,BLesson bLesson);
/** // /**
* 分页查询列表页推荐 // * 分页查询列表页推荐
* @param pageUtil // * @param pageUtil
* @param model // * @param model
* @return // * @return
*/ // */
List<BLesson> queryRecommendListByPagination(PageUtil pageUtil, FindListLessonDTO model, List<AllCourseDTO> allCourse); // List<BLesson> queryRecommendListByPagination(PageUtil pageUtil, FindListLessonDTO model, List<AllCourseDTO> allCourse);
//
// /**
// * 分页查询列表页在学
// * @param pageUtil
// * @param model
// * @return
// */
// List<BLesson> queryLearnListByPagination(PageUtil pageUtil, FindListLessonDTO model);
//
// /**
// * 分页查询列表页收藏
// * @param pageUtil
// * @param model
// * @return
// */
// List<BLesson> queryCollectListByPagination(PageUtil pageUtil, FindListLessonDTO model);
} }
...@@ -281,8 +281,8 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -281,8 +281,8 @@ public class BLessonServiceImpl implements BLessonService {
} }
@Override @Override
public List<BLesson> findLessonAtBannerByPagination(PageUtil pageUtil, LessonTrainAtBannerDTO lessonTrainDTO) { public List<BLesson> findLessonAtBanner(LessonTrainAtBannerDTO lessonTrainDTO) {
return bLessonRepository.findLessonAtBannerByPagination(lessonTrainDTO); return bLessonRepository.findLessonAtBanner(lessonTrainDTO);
} }
@Override @Override
...@@ -302,7 +302,25 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -302,7 +302,25 @@ public class BLessonServiceImpl implements BLessonService {
courseIds.add(model.getCourse()); courseIds.add(model.getCourse());
model.setCourseIds(courseIds); model.setCourseIds(courseIds);
} }
List<BLesson> ListAllLesson = bLessonRepository.queryListAllLessonByPagination(model); List<BLesson> ListAllLesson = null;
//根据不同传值 查询列表页内容 searchType:查询类型 0 全部 1 推荐 2在学 3收藏"
switch (model.getSearchType()){
case "0":
ListAllLesson = bLessonRepository.queryListAllLessonByPagination(model);
break;
case "1":
ListAllLesson = bLessonRepository.queryRecommendListByPagination(model);
break;
case "2":
ListAllLesson = bLessonRepository.queryLearnListByPagination(model);
break;
case "3":
ListAllLesson = bLessonRepository.queryCollectListByPagination(model);
break;
default:
throw new ServiceException(ResultExceptionEnum.INVALID_PARAMETER_VALUE);
}
return ListAllLesson; return ListAllLesson;
} }
...@@ -378,19 +396,34 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -378,19 +396,34 @@ public class BLessonServiceImpl implements BLessonService {
return bLessons; return bLessons;
} }
@Override // @Override
public List<BLesson> queryRecommendListByPagination(PageUtil pageUtil, FindListLessonDTO model, List<AllCourseDTO> allCourse) { // public List<BLesson> queryRecommendListByPagination(PageUtil pageUtil, FindListLessonDTO model, List<AllCourseDTO> allCourse) {
List<String> departs = getDeparts(); // List<String> departs = getDeparts();
model.setDeparts(departs); // model.setDeparts(departs);
List<String> courseIds; // List<String> courseIds;
if (allCourse != null){ // if (allCourse != null){
//查询出所有子分类 // //查询出所有子分类
courseIds = recursion.FindSons(model.getCourse(),allCourse); // courseIds = recursion.FindSons(model.getCourse(),allCourse);
//将一级分类放入分类集合中 // //将一级分类放入分类集合中
courseIds.add(model.getCourse()); // courseIds.add(model.getCourse());
model.setCourseIds(courseIds); // model.setCourseIds(courseIds);
} // }
List<BLesson> ListAllLesson = bLessonRepository.queryRecommendListByPagination(model); // List<BLesson> ListAllLesson = bLessonRepository.queryRecommendListByPagination(model);
return ListAllLesson; // return ListAllLesson;
} // }
//
//
// @Override
// public List<BLesson> queryLearnListByPagination(PageUtil pageUtil, FindListLessonDTO model) {
//
// List<BLesson> ListAllLesson = bLessonRepository.queryLearnListByPagination(model);
// return ListAllLesson;
// }
//
// @Override
// public List<BLesson> queryCollectListByPagination(PageUtil pageUtil, FindListLessonDTO model) {
//
// List<BLesson> ListAllLesson = bLessonRepository.queryCollectListByPagination(model);
// return ListAllLesson;
// }
} }
...@@ -34,9 +34,9 @@ public class FileUploadController extends FileController { ...@@ -34,9 +34,9 @@ public class FileUploadController extends FileController {
private Global global; private Global global;
@ApiOperation(value="901 上传图片", notes="上传图片到服务器") @ApiOperation(value="901 上传图片", notes="上传图片到服务器")
@ApiImplicitParams({@ApiImplicitParam(name = "importFile", value = "图片文件", required = true, dataType = "MultipartFile"), // @ApiImplicitParams({@ApiImplicitParam(name = "file", value = "图片文件", required = true, dataType = "MultipartFile"),
// @ApiImplicitParam(name = "businessId", value = "课程id", required = true, dataType = "varchar") //// @ApiImplicitParam(name = "businessId", value = "课程id", required = true, dataType = "varchar")
}) // })
@PostMapping(value = "upload") @PostMapping(value = "upload")
public Result upload(CurUser curUser, @Valid MultipartFile file, BindingResult bindingResult) throws Exception { public Result upload(CurUser curUser, @Valid MultipartFile file, BindingResult bindingResult) throws Exception {
Result result = new Result(); Result result = new Result();
......
package org.rcisoft.common.model;
import java.util.HashMap;
import java.util.Map;
public class MenuMap {
public static final Map<String, String> menuMap;
static {
menuMap = new HashMap<String, String>();
menuMap.put("M-CTS-F", "001");
menuMap.put("M-EOL", "002");
menuMap.put("M-MTS", "003");
menuMap.put("F-COURSE", "031");
menuMap.put("F-TRAIN", "032");
menuMap.put("F-DATA", "033");
menuMap.put("F-FOLLOW", "034");
menuMap.put("F-INTEGRAL", "035");
menuMap.put("M-CTS-B", "0001");
menuMap.put("M-QDB", "0002");
menuMap.put("M-PAPER", "0003");
menuMap.put("M-ANALYSIS", "0004");
menuMap.put("M-SYSTEM", "0005");
menuMap.put("F-ONLINE", "0011");
menuMap.put("F-COURSE-RECOMMEND", "0012");
menuMap.put("F-UNDERLINE", "0013");
menuMap.put("F-CATEGORY", "0014");
menuMap.put("F-LABEL", "0015");
menuMap.put("F-INTEGRAL-M", "0016");
menuMap.put("F-QDB", "0021");
menuMap.put("F-QES", "0022");
menuMap.put("F-PAPER-CATE", "0031");
menuMap.put("F-PAPER", "0032");
menuMap.put("P-ANA-PAPER", "0041");
menuMap.put("P-ANA-EXAM", "0042");
menuMap.put("P-ANA-SCORE", "0043");
menuMap.put("F-MAIN-MANAGE", "0051");
menuMap.put("F-USERS", "0052");
menuMap.put("F-ROLE-MANAGE", "0053");
}
}
...@@ -7,23 +7,41 @@ import org.aspectj.lang.Signature; ...@@ -7,23 +7,41 @@ import org.aspectj.lang.Signature;
import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before; import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.reflect.MethodSignature; import org.aspectj.lang.reflect.MethodSignature;
import org.rcisoft.common.model.MenuMap;
import org.rcisoft.core.exception.ServiceException; import org.rcisoft.core.exception.ServiceException;
import org.rcisoft.core.result.ResultExceptionEnum; import org.rcisoft.core.result.ResultExceptionEnum;
import org.rcisoft.core.util.IdGen;
import org.rcisoft.core.util.UserUtil; import org.rcisoft.core.util.UserUtil;
import org.rcisoft.core.validate.ValidatedResult; import org.rcisoft.core.validate.ValidatedResult;
import org.rcisoft.sys.role.dto.InitAddAdminDTO;
import org.rcisoft.sys.role.dto.RoleMenuDTO;
import org.rcisoft.sys.role.dto.UserRoleDTO;
import org.rcisoft.sys.role.entity.SysRole;
import org.rcisoft.sys.role.service.SysRoleService;
import org.rcisoft.sys.user.bean.CurUser; import org.rcisoft.sys.user.bean.CurUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/** /**
* Created by lcy on 17/11/23. * Created by lcy on 17/11/23.
*/ */
@Slf4j @Slf4j
@Aspect @Aspect
@Transactional(propagation = Propagation.REQUIRED,readOnly = false)
public class CurUserAspect { public class CurUserAspect {
@Autowired
private SysRoleService sysRoleService;
/** /**
* 获取当前登陆人 * 获取当前登陆人
* @param joinPoint * @param joinPoint
*/ */
@Transactional(propagation = Propagation.REQUIRED,readOnly = false)
@Before("execution(* org.rcisoft..*.controller.*.*(..))") @Before("execution(* org.rcisoft..*.controller.*.*(..))")
public void beforeInsert(JoinPoint joinPoint) { public void beforeInsert(JoinPoint joinPoint) {
if (joinPoint.getArgs().length < 2) if (joinPoint.getArgs().length < 2)
...@@ -46,6 +64,43 @@ public class CurUserAspect { ...@@ -46,6 +64,43 @@ public class CurUserAspect {
if(StringUtils.isEmpty(curUser.getUserId()) || StringUtils.isEmpty(curUser.getCorpId())) if(StringUtils.isEmpty(curUser.getUserId()) || StringUtils.isEmpty(curUser.getCorpId()))
throw new ServiceException(ResultExceptionEnum.USER_NO_AUTHEN); throw new ServiceException(ResultExceptionEnum.USER_NO_AUTHEN);
UserUtil.setCurUser(curUser); UserUtil.setCurUser(curUser);
//查询本部门是否有管理员
int countAdmin = sysRoleService.queryAdminInCorp(curUser.getCorpId());
if (countAdmin==0){
//随机生成角色Id
String rId = IdGen.uuid();
log.info("----------该企业正在初始化----------");
InitAddAdminDTO initAddAdminDTO = new InitAddAdminDTO();
initAddAdminDTO.setRId(rId);
initAddAdminDTO.setRName("超级管理员");
initAddAdminDTO.setRStatus("1");
initAddAdminDTO.setRCreatedate(new Date());
initAddAdminDTO.setRPrivilege("M-QDB,F-QDB,P-QDB-ADD,P-QDB-DELETE,P-QDB-UPDATE,P-QDB-VIEW,F-QES,P-QES-ADD,P-QES-DELETE,P-QES-UPDATE,P-QES-VIEW,P-QES-IMPORT,M-PAPER,F-PAPER,P-PAPER-ADD,P-PAPER-DELETE,P-PAPER-CLONE,P-PAPER-EXPORTWORD,P-PAPER-UPDATE,P-PAPER-VIEW,P-PAPER-HISTORY-VIEW,P-PAPER-HISTORY-CHECK,P-PAPER-HISTORY-REMOVE,M-ANALYSIS,F-ANALYSIS,P-ANA-EXAM,P-ANA-PAPER,P-ANA-SCORE,M-USERS,F-USERS,P-USER-ADD,P-USER-IMPORT,P-USER-DELETE,P-USER-UPDATE,P-USER-VIEW,P-USER-EXAMVIEW,F-BRANCH,P-BRANCH-ADD,P-BRANCH-DELETE,P-BRANCH-UPDATE,P-BRANCH-VIEW,F-UPOSITION,P-UPOSITION-ADD,P-UPOSITION-DELETE,P-UPOSITION-UPDATE,P-UPOSITION-VIEW,M-LEARNING,F-COURSE,P-COURSE-ADD,P-COURSE-DELETE,P-COURSE-UPDATE,P-COURSE-DATAVIEW,F-COURSE-CATEGORY,P-COURSE-CATEGORY-ADD,P-COURSE-CATEGORY-DELETE,P-COURSE-CATEGORY-UPDATE,F-COURSE-TEACHER,P-COURSE-TEACHER-ADD,P-COURSE-TEACHER-DELETE,P-COURSE-TEACHER-UPDATE,M-SYSTEM,F-SYS,P-SYS-CONFIG,P-SYS-LOG,F-ADMIN,P-ADMIN-ADD,P-ADMIN-DELETE,P-ADMIN-UPDATE,P-ADMIN-VIEW,F-ROLE,P-ROLE-ADD,P-ROLE-DELETE,P-ROLE-UPDATE,P-ROLE-VIEW,M-OTHER,F-SUPER,P-OTH-SUPER");
initAddAdminDTO.setType("1");
initAddAdminDTO.setCorpId(curUser.getCorpId());
initAddAdminDTO.setRType("0");
//插入tm_admin_role表
int tmAdminRoleResult = sysRoleService.addAdminRole(initAddAdminDTO);
List<String> menuIds = new ArrayList<String>(MenuMap.menuMap.values());
//插入s_role_menu表
List<RoleMenuDTO> roleMenuDTOS = new ArrayList<>();
menuIds.forEach(menuId->{
RoleMenuDTO roleMenuDTO = new RoleMenuDTO();
roleMenuDTO.setBusinessId(IdGen.uuid());
roleMenuDTO.setRoleId(rId);
roleMenuDTO.setMenuId(IdGen.uuid());
roleMenuDTOS.add(roleMenuDTO);
});
int roleMenuResult = sysRoleService.addRoleMenu(roleMenuDTOS);
//插入s_r_user_role表
UserRoleDTO userRoleDTO = new UserRoleDTO();
userRoleDTO.setBusinessId(IdGen.uuid());
userRoleDTO.setRoleId(rId);
userRoleDTO.setUserId(curUser.getUserId());
int userRoleResult = sysRoleService.addUserRole(userRoleDTO);
log.info("----------初始化完成----------");
}
} }
} }
...@@ -29,7 +29,8 @@ public enum ResultExceptionEnum { ...@@ -29,7 +29,8 @@ public enum ResultExceptionEnum {
NOT_MORE_COUNT(4013,"添加超过规定个数"), NOT_MORE_COUNT(4013,"添加超过规定个数"),
APPOINT_NOT_CLOSE(4014,"必修不能退出"), APPOINT_NOT_CLOSE(4014,"必修不能退出"),
STATE_NOT_RELEASE(4015,"该课程状态不能发布"), STATE_NOT_RELEASE(4015,"该课程状态不能发布"),
APPOINT_NOT_CANCEL(4016,"该课程不能取消指派") APPOINT_NOT_CANCEL(4016,"该课程不能取消指派"),
INVALID_PARAMETER_VALUE(4017,"参数值无效")
; ;
private Integer code; private Integer code;
......
package org.rcisoft.sys.role.dao; package org.rcisoft.sys.role.dao;
import org.apache.ibatis.annotations.Delete; import org.apache.ibatis.annotations.*;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.rcisoft.core.base.BaseMapper; import org.rcisoft.core.base.BaseMapper;
import org.rcisoft.sys.dept.entity.DeptRole; import org.rcisoft.sys.dept.entity.DeptRole;
import org.rcisoft.sys.role.dto.InitAddAdminDTO;
import org.rcisoft.sys.role.dto.RoleMenuDTO;
import org.rcisoft.sys.role.dto.UserRoleDTO;
import org.rcisoft.sys.role.entity.SysRole; import org.rcisoft.sys.role.entity.SysRole;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
...@@ -238,4 +238,29 @@ public interface SysRoleRepository extends BaseMapper<SysRole> { ...@@ -238,4 +238,29 @@ public interface SysRoleRepository extends BaseMapper<SysRole> {
"\t\t\t) ab\n" + "\t\t\t) ab\n" +
"\t)") "\t)")
int deleteUserRoleByChildrenId(@Param("tb") String tableByKey, @Param("cid") String businessId); int deleteUserRoleByChildrenId(@Param("tb") String tableByKey, @Param("cid") String businessId);
@Select("<script>select count(1) " +
"from tm_admin_role " +
"where corp_id = #{corpId} " +
"and r_type = 0 " +
"</script>")
int queryAdminInCorp(String corpId);
@Insert("<script>insert into tm_admin_role(r_id,r_name,r_status,r_createdate,r_privilege,type,r_type,corp_id) " +
"values(#{rId},#{rName},#{rStatus},#{rCreatedate},#{rPrivilege},#{type},#{rType},#{corpId}) " +
"</script>")
int addAdminRole(InitAddAdminDTO param);
@Insert("<script>INSERT INTO s_role_menu " +
"(business_id,role_id,menu_id)VALUES" +
"<foreach collection=\"list\" item=\"item\" separator=\",\">" +
"(#{item.businessId},#{item.roleId},#{item.menuId})" +
"</foreach></script>")
int addRoleMenu(List<RoleMenuDTO> param);
@Insert("<script>insert into s_r_user_role(business_id,user_id,role_id) " +
"values(#{businessId},#{userId},#{roleId}) " +
"</script>")
int addUserRole(UserRoleDTO param);
} }
package org.rcisoft.sys.role.dto;
import lombok.Data;
import java.util.Date;
@Data
public class InitAddAdminDTO {
private String rId;
private String rName;
private String rStatus;
private Date rCreatedate;
private String rPrivilege;
private String type;
private String corpId;
private String rType;
}
package org.rcisoft.sys.role.dto;
import lombok.Data;
@Data
public class RoleMenuDTO {
private String businessId;
private String roleId;
private String menuId;
}
package org.rcisoft.sys.role.dto;
import lombok.Data;
@Data
public class UserRoleDTO {
private String businessId;
private String userId;
private String roleId;
}
...@@ -5,8 +5,7 @@ package org.rcisoft.sys.role.service; ...@@ -5,8 +5,7 @@ package org.rcisoft.sys.role.service;
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.dept.entity.DeptRole; import org.rcisoft.sys.dept.entity.DeptRole;
import org.rcisoft.sys.role.dto.AddOrUpdateRoleDTO; import org.rcisoft.sys.role.dto.*;
import org.rcisoft.sys.role.dto.FindRolePaginDTO;
import org.rcisoft.sys.role.entity.SysRole; import org.rcisoft.sys.role.entity.SysRole;
import java.util.List; import java.util.List;
...@@ -75,4 +74,13 @@ public interface SysRoleService { ...@@ -75,4 +74,13 @@ public interface SysRoleService {
* @return * @return
*/ */
List<SysRole> queryDeptRolesByPagination(PageUtil<SysRole> paginationUtility, String DeptId, SysRole sysRole); List<SysRole> queryDeptRolesByPagination(PageUtil<SysRole> paginationUtility, String DeptId, SysRole sysRole);
int queryAdminInCorp(String corpId);
int addAdminRole(InitAddAdminDTO initAddAdminDTO);
int addRoleMenu(List<RoleMenuDTO> roleMenuDTOS);
int addUserRole(UserRoleDTO userRoleDTO);
} }
...@@ -10,8 +10,7 @@ import org.rcisoft.core.util.IdGen; ...@@ -10,8 +10,7 @@ import org.rcisoft.core.util.IdGen;
import org.rcisoft.core.util.UserUtil; import org.rcisoft.core.util.UserUtil;
import org.rcisoft.sys.dept.entity.DeptRole; import org.rcisoft.sys.dept.entity.DeptRole;
import org.rcisoft.sys.role.dao.SysRoleRepository; import org.rcisoft.sys.role.dao.SysRoleRepository;
import org.rcisoft.sys.role.dto.AddOrUpdateRoleDTO; import org.rcisoft.sys.role.dto.*;
import org.rcisoft.sys.role.dto.FindRolePaginDTO;
import org.rcisoft.sys.role.entity.SysRole; import org.rcisoft.sys.role.entity.SysRole;
import org.rcisoft.sys.role.service.SysRoleService; import org.rcisoft.sys.role.service.SysRoleService;
import org.rcisoft.sys.user.dao.SysUserMapper; import org.rcisoft.sys.user.dao.SysUserMapper;
...@@ -163,7 +162,25 @@ public class SysRoleServiceImpl implements SysRoleService { ...@@ -163,7 +162,25 @@ public class SysRoleServiceImpl implements SysRoleService {
return sysRoleRepository.queryRolesSelect(sysRole); return sysRoleRepository.queryRolesSelect(sysRole);
} }
@Override
public int queryAdminInCorp(String corpId) {
return sysRoleRepository.queryAdminInCorp(corpId);
}
@Override
public int addAdminRole(InitAddAdminDTO initAddAdminDTO) {
return sysRoleRepository.addAdminRole(initAddAdminDTO);
}
@Override
public int addRoleMenu(List<RoleMenuDTO> roleMenuDTOS) {
return sysRoleRepository.addRoleMenu(roleMenuDTOS);
}
@Override
public int addUserRole(UserRoleDTO userRoleDTO) {
return sysRoleRepository.addUserRole(userRoleDTO);
}
} }
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