Browse Source

增加小班,添加学员接口

周箭河 5 years ago
parent
commit
9106be2162

+ 9 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/ClassGroupRelationDao.java

@@ -12,6 +12,7 @@ public interface ClassGroupRelationDao extends BaseDAO<Integer, ClassGroupRelati
 
     /**
      * 批量插入班级关联关系
+     *
      * @param classGroupRelationList
      * @return
      */
@@ -19,7 +20,15 @@ public interface ClassGroupRelationDao extends BaseDAO<Integer, ClassGroupRelati
 
     /**
      * 删除班级关系
+     *
      * @param classGroupId
      */
     void deleteByClassId(Integer classGroupId);
+
+    /**
+     * 根据子班id'查询父班id
+     * @param subClassGroupId
+     * @return
+     */
+    ClassGroupRelation findClassGroupRelation(@Param("subClassGroupId") Integer subClassGroupId);
 }

+ 6 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/ClassGroupRelationService.java

@@ -17,4 +17,10 @@ public interface ClassGroupRelationService extends BaseService<Integer, ClassGro
      */
     int classGroupRelationsInsert(List<ClassGroupRelation> classGroupRelationList);
 
+    /**
+     * 查询班级父班级id
+     */
+
+    ClassGroupRelation findClassGroupRelation(Integer subClassGroupId);
+
 }

+ 5 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupRelationServiceImpl.java

@@ -26,4 +26,9 @@ public class ClassGroupRelationServiceImpl extends BaseServiceImpl<Integer, Clas
     public int classGroupRelationsInsert(List<ClassGroupRelation> classGroupRelationList) {
 		return classGroupRelationDao.classGroupRelationsInsert(classGroupRelationList);
     }
+
+    @Override
+    public ClassGroupRelation findClassGroupRelation(Integer subClassGroupId) {
+	    return classGroupRelationDao.findClassGroupRelation(subClassGroupId);
+    }
 }

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupStudentMapperServiceImpl.java

@@ -28,6 +28,8 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
     private CourseScheduleStudentPaymentService courseScheduleStudentPaymentService;
     @Autowired
     private ClassGroupService classGroupService;
+    @Autowired
+    private ClassGroupRelationService classGroupRelationService;
 
     @Override
     public BaseDAO<Long, ClassGroupStudentMapper> getDAO() {
@@ -135,6 +137,15 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
         //3、学生加入新班级未开始课程
         List<CourseSchedule> courseScheduleList = courseScheduleService.findNoStartCoursesByClassGroupId(classGroupId);
 
+        //4、班级在合奏班、添加合奏课程
+        ClassGroupRelation classGroupRelation = classGroupRelationService.findClassGroupRelation(classGroupId);
+        if(classGroupRelation != null){
+            //合奏班增加人数
+            classGroupService.updateClassStudentNum(classGroupRelation.getClassGroupId().longValue(), userIdStrSet.size());
+            List<CourseSchedule> mixCourseScheduleList = courseScheduleService.findNoStartCoursesByClassGroupId(classGroupRelation.getClassGroupId());
+            courseScheduleList.addAll(mixCourseScheduleList);
+        }
+
         BigDecimal coursePrice = new BigDecimal("0");
 
         List<CourseScheduleStudentPayment> courseScheduleStudentPayments = new ArrayList<>();

+ 5 - 0
mec-biz/src/main/resources/config/mybatis/ClassGroupRelationMapper.xml

@@ -78,4 +78,9 @@
             (#{item.classGroupId},#{item.subClassGroupId},now())
         </foreach>
     </insert>
+
+    <!-- 查询班级父班级id -->
+    <select id="findClassGroupRelation" resultMap="ClassGroupRelation">
+        SELECT * FROM class_group_relation WHERE sub_class_group_id_ = #{subClassGroupId}
+    </select>
 </mapper>

+ 1 - 1
mec-web/src/main/java/com/ym/mec/web/controller/ClassGroupStudentController.java

@@ -53,7 +53,7 @@ public class ClassGroupStudentController extends BaseController {
     }
 
 
-    @ApiOperation(value = "添加学生(小班课)")
+    @ApiOperation(value = "添加学生(小班课,单技班通用)")
     @PostMapping("/addStudents")
     @PreAuthorize("@pcs.hasPermissions('classGroupStudent/addStudents')")
     @ApiImplicitParams({