Selaa lähdekoodia

主班有报名状态的学员不允许合并

zouxuan 4 vuotta sitten
vanhempi
commit
29cde42a87

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentRegistrationDao.java

@@ -514,5 +514,5 @@ public interface StudentRegistrationDao extends BaseDAO<Long, StudentRegistratio
      * @param studentIds
      * @return
      */
-    Integer findApplyStudent(@Param("musicGroupId") String musicGroupId, @Param("studentIds") List<Integer> studentIds);
+    StudentRegistration findApplyStudent(@Param("musicGroupId") String musicGroupId, @Param("studentIds") List<Integer> studentIds);
 }

+ 4 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java

@@ -4016,9 +4016,10 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         //创建缴费项目
         MusicGroup musicGroup = musicGroupDao.findByClassGroupId(masterClassGroupId);
         //主班是否有报名状态的学员
-        Integer applyStudentNum = studentRegistrationDao.findApplyStudent(musicGroup.getId(), studentIds);
-        if (applyStudentNum != null && applyStudentNum > 0) {
-            throw new BizException("操作失败: 学员{学员姓名/学员编号}在主班所属乐团中为报名状态不可合并,请将该学员退团处理后再次合并");
+        StudentRegistration studentRegistration = studentRegistrationDao.findApplyStudent(musicGroup.getId(), studentIds);
+        if (studentRegistration != null) {
+            throw new BizException("操作失败: 学员 {}/{} 在 {} 中为报名状态不可合并,请将该学员退团处理后再次合并",
+                    studentRegistration.getName(),studentRegistration.getUserId(),musicGroup.getName());
         }
         //获取缴费状态在审核中或者已拒绝的缴费项目的学员
         String studentId = musicGroupPaymentCalenderDao.queryCalenderStudentIds(musicGroup.getId(), null);

+ 4 - 3
mec-biz/src/main/resources/config/mybatis/StudentRegistrationMapper.xml

@@ -959,12 +959,13 @@
     <select id="getPaymentStudentNum" resultType="int">
         SELECT COUNT(*) FROM student_registration WHERE music_group_id_ = #{musicGroupId} AND payment_status_ = 2 AND music_group_status_ = 'NORMAL'
     </select>
-    <select id="findApplyStudent" resultType="java.lang.Integer">
-        SELECT COUNT(id_) FROM student_registration
-        WHERE music_group_id_ = #{musicGroupId} AND payment_status_ = 1 AND music_group_status_ = 'APPLY'
+    <select id="findApplyStudent" resultMap="StudentRegistration">
+        SELECT * FROM student_registration
+        WHERE music_group_id_ = #{musicGroupId} AND music_group_status_ = 'APPLY'
         AND user_id_ IN
         <foreach collection="studentIds" item="studentId" open="(" close=")" separator=",">
             #{studentId}
         </foreach>
+        LIMIT 1
     </select>
 </mapper>