Commit 815e2d91 authored by root's avatar root

修改接口

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