Commit f753c01b authored by root's avatar root

修改接口、添加新接口

parent 27880130
......@@ -442,7 +442,7 @@ public class BLessonController extends PaginationController<BLesson> {
// MessageConstant.MESSAGE_ALERT_ERROR,
// appointLessonDTO);
// }
//
// @ApiOperation(value="625 添加我学习的课程", notes="添加我学习的课程")
// @PostMapping(value = "/addMyLearnLesson")
// public Result addMyLearnLesson(CurUser curUser,@Valid AddMyLearnLessonDTO addMyLearnLessonDTO,BindingResult bindingResult) {
......
......@@ -222,7 +222,7 @@ public interface BLessonPersonRepository extends BaseMapper<BLessonPerson> {
@Insert("<script>" +
" insert into b_lesson_person(" +
" business_id,create_by,create_date,update_by,update_date, " +
" del_flag,flag,remarks,person_id,lesson_id " +
" del_flag,flag,remarks,person_id,lesson_id, " +
" learn_progress,is_finish,is_collect, " +
" is_appoint) " +
" values " +
......@@ -231,5 +231,5 @@ public interface BLessonPersonRepository extends BaseMapper<BLessonPerson> {
" #{param.learnProgress}, #{param.isFinish},#{param.isCollect}," +
" #{param.isAppoint}) " +
"</script>")
int insertBlessonPerson(@Param("param") BLessonPerson param);
int insertBLessonPerson(@Param("param") BLessonPerson param);
}
......@@ -502,23 +502,26 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" ,suc.name createByName " +
" from b_lesson bl " +
" left join s_user su on su.business_id = bl.lecturer_id " +
" and su.del_flag != 1 and su.flag = 1 " +
" and su.corp_id = #{model.corpId} "+
" left join s_user suc on suc.business_id = bl.create_by " +
" and suc.del_flag != 1 and suc.flag = 1 " +
" and suc.corp_id = #{model.corpId} "+
" left join b_viewrange bv on bl.business_id = bv.lesson_id " +
" and bv.del_flag != 1 and bv.flag = 1 " +
" and bv.corp_id = #{model.corpId} "+
" left join b_viewrange_son bvs on bv.business_id = bvs.viewrange_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 bv.del_flag != 1 and bv.flag = 1 " +
// " and bla.del_flag != 1 and bla.flag = 1 " +
" and bl.corp_id = #{model.corpId} "+
" and su.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.lessonType !=null and model.lessonType != ''\">and bl.lesson_type = #{model.lessonType}</if>" +
......
......@@ -114,6 +114,8 @@ public class BLessonPerson extends IdEntity<BLessonPerson> {
this.setIsCollect("0");
//设置不指派
this.setIsAppoint("0");
//设置不指派
this.setRemarks("");
}
}
......@@ -10,6 +10,7 @@ import org.rcisoft.business.blesson.dao.BLessonPersonRepository;
import org.rcisoft.business.blesson.entity.BLessonPerson;
import org.rcisoft.business.blesson.service.BLessonPersonService;
import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.core.constant.MessageConstant;
import org.rcisoft.core.exception.ServiceException;
import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.result.ResultExceptionEnum;
......@@ -119,18 +120,23 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
public PersistModel addMyLearnLesson(AddMyLearnLessonDTO addMyLearnLessonDTO) {
List<BLessonPerson> bLessonPersons = bLessonPersonRepository.selectByPersonAndLesson(addMyLearnLessonDTO);
BLessonPerson bLessonPerson;
if (bLessonPersons != null && bLessonPersons.size()>0 ){
int line = 0;
//被指派未开始
if (bLessonPersons != null && bLessonPersons.size()>0 && "0".equals(bLessonPersons.get(0).getIsFinish()) ){
bLessonPerson = bLessonPersons.get(0);
bLessonPerson.setIsFinish("1");
bLessonPersonRepository.updateByPrimaryKeySelective(bLessonPerson);
}else {
line = bLessonPersonRepository.updateByPrimaryKeySelective(bLessonPerson);
//课程在学人数+1
bLessonRepository.personNumberPlusOne(addMyLearnLessonDTO.getLessonId());
}else if (bLessonPersons == null || bLessonPersons.size() < 1){ //未指派
bLessonPerson = new BLessonPerson();
bLessonPerson.initModel();
bLessonPerson.setLessonId(addMyLearnLessonDTO.getLessonId());
bLessonPersonRepository.insertBlessonPerson(bLessonPerson);
bLessonPerson.setPersonId(addMyLearnLessonDTO.getUserId());
line = bLessonPersonRepository.insertBLessonPerson(bLessonPerson);
//课程在学人数+1
bLessonRepository.personNumberPlusOne(addMyLearnLessonDTO.getLessonId());
}
bLessonRepository.personNumberPlusOne(addMyLearnLessonDTO.getLessonId());
return null;
return new PersistModel(line);
}
}
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