Commit 61830035 authored by root's avatar root

修改接口

parent c927c282
......@@ -116,7 +116,7 @@ public class BLessonController extends PaginationController<BLesson> {
@ApiOperation(value="606 分页查询大家都在学", notes="分页查询大家都在学")
@GetMapping(value = "/queryPersonMoreByPagination")
public Result queryPersonMoreByPagination(CurUser curUser,@Valid FirstPageQueryDTO firstPageQueryDTO, BindingResult bindingResult) {
public Result queryPersonMoreByPagination(CurUser curUser) {
String userId = curUser.getUserId();
bLessonService.queryPersonMoreByPagination(getPaginationUtility(),userId);
GridModel gridModel = getGridModelResponse();
......@@ -128,7 +128,7 @@ public class BLessonController extends PaginationController<BLesson> {
@ApiOperation(value="607 分页查询企业推荐", notes="分页查询企业推荐")
@GetMapping(value = "/queryRecommendByPagination")
public Result queryRecommendByPagination(CurUser curUser,@Valid FirstPageQueryDTO firstPageQueryDTO, BindingResult bindingResult) {
public Result queryRecommendByPagination(CurUser curUser) {
String userId = curUser.getUserId();
bLessonService.queryRecommendByPagination(getPaginationUtility(),userId);
GridModel gridModel = getGridModelResponse();
......@@ -237,13 +237,4 @@ public class BLessonController extends PaginationController<BLesson> {
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));
}
}
......@@ -2,7 +2,6 @@ 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.blesson.dto.ILearnLessonDTO;
import org.rcisoft.core.base.BaseMapper;
......@@ -29,6 +28,8 @@ public interface BLessonPersonRepository extends BaseMapper<BLabel> {
" and blp.person_id = #{userId} " +
" <if test= \" param.isFinish != null and param.isFinish != ''\">and blp.is_finish = #{param.isFinish} </if> " +
" <if test= \" param.lessonType !=null and param.lessonType != ''\">and bl.lesson_type = #{param.lessonType} </if> " +
// " <if test= \" param.startFlag !=null and param.startFlag != ''\">and blp.start_flag = #{param.startFlag} </if> " +
" <if test= \" param.isAppoint !=null and param.isAppoint != ''\">and blp.is_appoint = #{param.isAppoint} </if> " +
" order by blp.update_date desc</script>")
@ResultMap(value = "BaseResultMap")
List<BLesson> queryLearnBLessons(@Param("param") ILearnLessonDTO param, @Param("userId") String userId);
......@@ -39,12 +40,5 @@ 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);
}
......@@ -115,7 +115,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" <if test= \" lessonType !=null and lessonType != ''\">and bl.lesson_type = #{lessonType} </if> " +
" <if test= \" recommend !=null and recommend != ''\">and bl.recommend = #{recommend} </if> " +
" <if test= \" lecturerName !=null and lecturerName != ''\">and bl.lesson_name like CONCAT('%',#{lecturerName},'%') </if> " +
" order by bl.release_date desc" +
" order by bl.release_date desc " +
"</script>")
@ResultMap(value = "BaseResultMap")
List<BLesson> queryAllBLesson(FindAllLessonDTO param);
......@@ -140,8 +140,10 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" and bv.del_flag != 1 and bv.flag = 1 " +
" and bl.release_state = 2 " +
" and ((bvs.type = 0 and bvs.target_id = #{userId}) " +
" <if test=\"departs != null and departs.size() > 0 \"> " +
" 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>) " +
" </if>) " +
" and bl.person_number > (select `value` from b_dictionary where type = 'ZXRS') " + //ZXRS 在学人数
" order by bl.person_number,bl.release_date desc " +
"</script>")
......@@ -182,8 +184,10 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" and br.del_flag != 1 and br.flag = 1 " +
" and bl.release_state = 2 " +
" and ((brs.type = 0 and brs.target_id = #{userId}) " +
" <if test=\"departs != null and departs.size() > 0 \"> " +
" or (brs.type = 1 and brs.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>) " +
" </if>) " +
" order by br.update_date " +
"</script>")
@ResultMap(value = "BaseResultMap")
......@@ -228,8 +232,10 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" and bv.del_flag != 1 and bv.flag = 1 " +
" and bl.release_state = 2 " +
" and ((bvs.type = 0 and bvs.target_id = #{userId}) " +
" <if test=\"departs != null and departs.size() > 0 \"> " +
" 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>) " +
" </if>) " +
" and bl.person_number > (select `value` from b_dictionary where type = 'GZRS') " + //ZXRS 关注人数
" order by bl.collect_number,bl.release_date desc " +
"</script>")
......@@ -250,7 +256,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
// " order by bl.hot_number desc " +
// "</script>")
// @ResultMap(value = "BaseResultMap")
@Select(" <script> SELECT b.* " +
@Select(" <script> SELECT DISTINCT b.* " +
" ,su.name lecturerName " +
" ,suc.name createByName " +
" FROM " +
......@@ -274,7 +280,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" ) 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 bv on b.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 " +
......@@ -285,8 +291,10 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" where blp.person_id = #{userId} ) " +
" and b.release_state = 2 " +
" and ((bvs.type = 0 and bvs.target_id = #{userId}) " +
" <if test=\"departs != null and departs.size() > 0 \"> " +
" 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>) " +
" </if>) " +
" order by T.bsum , b.collect_number " +
"</script>")
List<BLesson> queryInterested(@Param("userId") String userId, @Param("departs") List<String> departs);
......@@ -302,17 +310,31 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
"</script>")
List<QueryLabelResDTO> queryLabelByLessonId(String lessonId);
/**
* 首页分页查询全部课程
* @param firstPageQueryDTO
* @param sonCourseIds
* @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 " +
" left join s_user suc on suc.business_id = bl.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 " +
// " 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 " +
" and ((bvs.type = 0 and bvs.target_id = #{param.userId}) " +
" <if test=\"param.departs != null and param.departs.size() > 0 \"> " +
" or (bvs.type = 1 and bvs.target_id in " +
" <foreach item='item' index='index' collection='param.departs' open='(' separator=',' close=')'> #{item} </foreach>)" +
" </if>) " +
" <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_id in " +
......@@ -346,8 +368,9 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
"(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 " +
"(select COUNT(1) from b_lesson_person where person_id = #{userId} and is_finish = '2') finishCount, " +
"(select COUNT(1) from b_lesson_person where person_id = #{userId} and is_finish = '1') notFinishCount, " +
"(select COUNT(1) from b_lesson_person where person_id = #{userId} and is_finish = '0') notStartCount " +
"</script>"})
ILessonCountDTO iLessonCount(String userId);
......
......@@ -51,4 +51,10 @@ public class AddLessonDTO {
@ApiModelProperty(value = "标签集合,使用','分隔")
private String labels;
@ApiModelProperty(value = "可见范围(人)多人之间用','隔开")
private String viewRangePerson;
@ApiModelProperty(value = "可见范围(部门)多人之间用','隔开")
private String viewRangeDepart;
}
package org.rcisoft.business.blesson.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
@Data
public class BViewRangeSonDTO {
@ApiModelProperty(value = "主键")
@Length(min = 1,max = 64,message = "长度最小为1,最大为50")
private String value;
@ApiModelProperty(value = "可见范围id")
@Length(min = 1,max = 64,message = "长度最小为1,最大为50")
private String viewrangeId;
@ApiModelProperty(value = "可见类型(0:人 1:部门)")
@Length(min = 1,max = 1,message = "长度最小为1,最大为1")
private String type;
@ApiModelProperty(value = "人/部门id")
@Length(min = 1,max = 64,message = "长度最小为1,最大为50")
private String targetId;
}
......@@ -4,6 +4,8 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import java.util.List;
@Data
public class FirstPageQueryDTO {
......@@ -15,4 +17,9 @@ public class FirstPageQueryDTO {
@ApiModelProperty(value = "查询参数",required = false)
private String viewParam;
private String userId;
//部门id
private List<String> departs;
}
package org.rcisoft.business.blesson.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class ILearnCountDTO {
}
......@@ -9,6 +9,7 @@ import org.hibernate.validator.constraints.Length;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
@Entity
@Table(name = "b_lesson_label")
......@@ -18,11 +19,20 @@ import javax.persistence.Table;
public class ILearnLessonDTO {
@Length(min = 1,max = 1,message = "长度最小为1,最大为1")
@ApiModelProperty(value = "是否学完 0:未学完 1:已学完")
@ApiModelProperty(value = "是否已学完(0:未开始 1:已开始 2: 已学完)")
private String isFinish;
@Length(min = 1,max = 1,message = "长度最小为1,最大为1")
@ApiModelProperty(value = "课程类型 0 课程 1 培训")
private String lessonType;
// @ApiModelProperty(value = "是否开始学习")
// private String startFlag;
@ApiModelProperty(value = "是否为指派课程(0非必修(自选) 1必修(指派))")
private String isAppoint;
// @ApiModelProperty(value = "指派课程id")
// private String appointId;
}
......@@ -27,4 +27,7 @@ public class ILessonCountDTO {
@ApiModelProperty(value = "我未学完课程数量")
private String notFinishCount;
@ApiModelProperty(value = "我未开始课程数量")
private String notStartCount;
}
......@@ -121,5 +121,13 @@ public class BLesson extends IdEntity<BLesson> {
@ApiModelProperty(value = "分类名")
@Transient
private String courseName;
@ApiModelProperty(value = "可见范围(人)多人之间用','隔开")
@Transient
private String viewRangePerson;
@ApiModelProperty(value = "可见范围(部门)多人之间用','隔开")
@Transient
private String viewRangeDepart;
}
......@@ -36,7 +36,7 @@ public class BLessonPerson extends IdEntity<BLessonPerson> {
@Length(min = 1,max = 64,message = "长度最小为1,最大为50")
private String learnProgress;
@ApiModelProperty(value = "是否学完 0:未学完 1:已学完")
@ApiModelProperty(value = "是否已学完(0:未开始 1:已开始 2: 已学完)")
@NotBlank
@Length(min = 1,max = 1,message = "长度最小为1,最大为1")
private String isFinish;
......@@ -46,6 +46,19 @@ public class BLessonPerson extends IdEntity<BLessonPerson> {
@Length(min = 1,max = 1,message = "长度最小为1,最大为1")
private String isCollect;
@ApiModelProperty(value = "指派id")
@Length(min = 1,max = 1,message = "长度最小为1,最大为1")
private String appointId;
// @ApiModelProperty(value = "是否开始")
// @Length(min = 1,max = 1,message = "长度最小为1,最大为1")
// private String startFlag;
@ApiModelProperty(value = "是否为指派(0自选(选修) 1指派(必修))")
@Length(min = 1,max = 1,message = "长度最小为1,最大为1")
private String isAppoint;
@ApiModelProperty(value = "课程名称")
@Transient
private String lessonName;
......@@ -86,4 +99,6 @@ public class BLessonPerson extends IdEntity<BLessonPerson> {
@Transient
private String lessonType;
}
package org.rcisoft.business.blesson.entity;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;
import org.rcisoft.core.entity.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
@Entity
@Table(name = "b_viewrange")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class BViewrange extends IdEntity<BViewrange> {
@ApiModelProperty(value = "课程id")
@Length(min = 1,max = 64,message = "长度最小为1,最大为50")
private String lessonId;
@ApiModelProperty(value = "可视范围类型(0 人 1 部门 2 人和部门)")
@Length(min = 1,max = 1,message = "长度最小为1,最大为50")
private String type;
}
package org.rcisoft.business.blesson.service;
import org.rcisoft.business.blesson.dto.ILearnCountDTO;
import org.rcisoft.business.blesson.entity.BLesson;
import org.rcisoft.business.blesson.dto.ILearnLessonDTO;
import org.rcisoft.core.aop.PageUtil;
......@@ -27,10 +26,5 @@ public interface BLessonPersonService {
*/
List<BLesson> queryLearnBLessonsByPagination(PageUtil pageUtil, ILearnLessonDTO model, String userId);
/**
* 我学习的课程总数
* @param userId
* @return
*/
ILearnCountDTO iLearnLessonCount(String userId);
}
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.blesson.dao.BLessonPersonRepository;
import org.rcisoft.business.blesson.dto.ILearnLessonDTO;
......@@ -38,10 +37,6 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
return bLessonPersonRepository.queryLearnBLessons(model, userId);
}
@Override
public ILearnCountDTO iLearnLessonCount(String userId) {
return bLessonPersonRepository.iLearnLessonCount(userId);
}
}
......@@ -113,6 +113,7 @@ public class BLessonServiceImpl implements BLessonService {
BLesson model = new BLesson();
BeanUtils.copyProperties(addLessonDTO,model);
int line = 0;
//标签集合
List<BLessonLabel> bLessonLabels = new ArrayList<>();
if(model.getBusinessId()==null) {
model.setDefaultUrl(global.getDEFAULT_COURSE_LOCATION());
......@@ -135,6 +136,12 @@ public class BLessonServiceImpl implements BLessonService {
model.setCollectNumber("0");
//添加课程表
line = bLessonRepository.insertSelective(model);
//添加可见范围
//添加课程标签表
if (StringUtils.isNotEmpty(model.getLabels())){
String[] labels = model.getLabels().split(",");
......@@ -189,6 +196,11 @@ public class BLessonServiceImpl implements BLessonService {
@Override
public List<BLesson> queryHomeBLessonsByPagination(PageUtil pageUtil, FirstPageQueryDTO firstPageQueryDTO,List<AllCourseDTO> allCourse) {
List<String> departs = new ArrayList<>();
departs.add("1");
departs.add("2");
departs.add("3");
firstPageQueryDTO.setDeparts(departs);
List<String> sonCourseIds = null;
if (allCourse != null){
sonCourseIds = recursion.FindSons(firstPageQueryDTO.getCourseLevelOne(),allCourse);
......
......@@ -33,6 +33,8 @@
<result column="learn_progress" jdbcType="VARCHAR" property="learnProgress"/>
<result column="is_finish" jdbcType="VARCHAR" property="isFinish"/>
<result column="is_collect" jdbcType="VARCHAR" property="isCollect"/>
<result column="appoint_id" jdbcType="VARCHAR" property="appointId"/>
<!--<result column="start_flag" jdbcType="VARCHAR" property="startFlag"/>-->
<result column="is_appoint" jdbcType="VARCHAR" property="isAppoint"/>
</resultMap>
</mapper>
\ No newline at end of file
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