Commit 815e2d91 authored by root's avatar root

修改接口

parent f753c01b
......@@ -433,24 +433,24 @@ public class BLessonController extends PaginationController<BLesson> {
bLessonService.queryRecommendByLessonId(param));
}
// @ApiOperation(value="624 指派课程", notes="根据ID指派课程")
// @PostMapping(value = "/appointLessonToPerson")
// public Result appointLessonToPerson(CurUser curUser,@Valid AppointLessonDTO appointLessonDTO,BindingResult bindingResult) {
// PersistModel data = bLessonService.appointLessonToPerson(appointLessonDTO);
// return Result.builder(data,
// MessageConstant.MESSAGE_ALERT_SUCCESS,
// MessageConstant.MESSAGE_ALERT_ERROR,
// appointLessonDTO);
// }
//
// @ApiOperation(value="625 添加我学习的课程", notes="添加我学习的课程")
// @PostMapping(value = "/addMyLearnLesson")
// public Result addMyLearnLesson(CurUser curUser,@Valid AddMyLearnLessonDTO addMyLearnLessonDTO,BindingResult bindingResult) {
// PersistModel data = bLessonPersonService.addMyLearnLesson(addMyLearnLessonDTO);
// return Result.builder(data,
// MessageConstant.MESSAGE_ALERT_SUCCESS,
// MessageConstant.MESSAGE_ALERT_ERROR,
// addMyLearnLessonDTO);
// }
@ApiOperation(value="624 指派课程", notes="根据ID指派课程")
@PostMapping(value = "/appointLessonToPerson")
public Result appointLessonToPerson(CurUser curUser,@Valid AppointLessonDTO appointLessonDTO,BindingResult bindingResult) {
PersistModel data = bLessonService.appointLessonToPerson(appointLessonDTO);
return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
appointLessonDTO);
}
@ApiOperation(value="625 添加我学习的课程", notes="添加我学习的课程")
@PostMapping(value = "/addMyLearnLesson")
public Result addMyLearnLesson(CurUser curUser,@Valid AddMyLearnLessonDTO addMyLearnLessonDTO,BindingResult bindingResult) {
PersistModel data = bLessonPersonService.addMyLearnLesson(addMyLearnLessonDTO);
return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
addMyLearnLessonDTO);
}
}
package org.rcisoft.business.blesson.dao;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.rcisoft.business.blesson.dto.AppointLessonDTO;
import org.rcisoft.business.blesson.dto.CancelAppointDTO;
import org.rcisoft.business.blesson.entity.BAppoint;
......@@ -42,5 +44,18 @@ public interface BAppointRepository extends BaseMapper<BAppoint> {
+ "</script>")
@ResultMap(value = "BaseResultMap" )
List<BAppoint> selectByLessonId(AppointLessonDTO param);
@Insert("<script>" +
" insert into b_appoint(" +
" business_id,create_by,create_date,update_by,update_date, " +
" del_flag,flag,remarks,lesson_id,appointer_id, " +
" designated_id) " +
" values " +
" (#{param.businessId}, #{param.createBy},#{param.createDate},#{param.updateBy},#{param.updateDate}, " +
" #{param.delFlag}, #{param.flag},#{param.remarks},#{param.lessonId},#{param.appointerId}, " +
" #{param.designatedId}) " +
"</script>")
int insertAppoint(@Param("param") BAppoint param);
}
......@@ -8,6 +8,7 @@ import org.rcisoft.business.blesson.entity.BLessonPerson;
import org.rcisoft.core.base.BaseMapper;
import org.springframework.stereotype.Repository;
import java.util.Date;
import java.util.List;
@Repository
......@@ -179,30 +180,29 @@ public interface BLessonPersonRepository extends BaseMapper<BLessonPerson> {
* @return
*/
@Update("<script>" +
" <foreach collection='param' item='item' index='index' separator=';'> " +
" update b_lesson_person " +
" <set> " +
" <if test=\"item.updateBy != null and item.updateBy != ''\">update_by=#{item.updateBy},</if>"+
" <if test=\"item.updateDate != null and item.updateDate != ''\">update_date=#{item.updateDate},</if>"+
" appoint_id=#{item.appointId}, " +
" is_appoint=#{item.isAppoint}, " +
" <if test=\"param.updateBy != null and param.updateBy != ''\">update_by=#{param.updateBy},</if>"+
" <if test=\"param.updateDate != null \">update_date=#{param.updateDate},</if>"+
" appoint_id=#{param.appointId}, " +
" is_appoint=#{param.isAppoint} " +
" </set> " +
" where business_id=#{item.businessId} " +
" </foreach>"+
" where business_id in " +
" <foreach item='item' index='index' collection='ids' open='(' separator=',' close=')'> #{item} </foreach>" +
"</script>")
int updateList(@Param("param") List<BLessonPerson> param);
int updateList(@Param("param") BLessonPerson param, @Param("ids")List<String> ids);
@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 " +
" learn_progress,is_finish,finish_date,is_collect,appoint_id, " +
" del_flag,flag,remarks,person_id,lesson_id, " +
" learn_progress,is_finish,is_collect,appoint_id, " +
" is_appoint) " +
" values " +
" <foreach collection='list' index='index' item='item' separator=','> " +
" <foreach collection='param' index='index' item='item' separator=','>(" +
" #{item.businessId}, #{item.createBy},#{item.createDate},#{item.updateBy},#{item.updateDate}, " +
" #{item.delFlag}, #{item.flag},#{item.remarks},#{item.personId},#{item.lessonId}, " +
" #{item.learnProgress}, #{item.isFinish},#{item.finishDate},#{item.isCollect},#{item.appointId}, " +
" #{item.learnProgress}, #{item.isFinish},#{item.isCollect},#{item.appointId}, " +
" #{item.isAppoint}) " +
" </foreach>" +
"</script>")
......
......@@ -395,7 +395,7 @@ public class BLessonServiceImpl implements BLessonService {
bAppoint.setAppointerId(appointLessonDTO.getUserId());
bAppoint.setDesignatedId(appointLessonDTO.getAppointPerson());
UserUtil.setCurrentPersistOperation(bAppoint);
bAppointRepository.insertSelective(bAppoint);
bAppointRepository.insertAppoint(bAppoint);
}else {
bAppoint = bAppoints.get(0);
bAppoint.setAppointerId(appointLessonDTO.getUserId());
......@@ -416,18 +416,23 @@ public class BLessonServiceImpl implements BLessonService {
appointLessonDTO.setAppointPersonList(userIds);
//查询已学该课程的学习business_id
List<BLessonPerson> inLessonPersons = bLessonPersonRepository.selectPersonIdByLessonId(appointLessonDTO);
if (inLessonPersons != null && inLessonPersons.size() > 0){
List<String> inLessonIds = new ArrayList<>();
for (BLessonPerson inLessonPerson : inLessonPersons) {
UserUtil.setCurrentMergeOperation(inLessonPerson);
inLessonPerson.setIsAppoint("1");
inLessonPerson.setAppointId(bAppoint.getBusinessId());
inLessonIds.add(inLessonPerson.getPersonId());
}
//创建对象用于更新
BLessonPerson updateBLessonPerson = new BLessonPerson();
updateBLessonPerson.setIsAppoint("1");
updateBLessonPerson.setAppointId(bAppoint.getBusinessId());
UserUtil.setCurrentMergeOperation(updateBLessonPerson);
//更新b_lesson_person表
bLessonPersonRepository.updateList(inLessonPersons);
bLessonPersonRepository.updateList(updateBLessonPerson,inLessonIds);
//从学生Id中删除已更新的学生id
userIds.removeAll(inLessonIds);
}
//剩余学生添加至b_lesson_person表
List<BLessonPerson> bLessonPersonOthers = new ArrayList<>();
userIds.forEach(userId->{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment