zouxuan há 5 anos atrás
pai
commit
1e8c614338

+ 3 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentManageDao.java

@@ -10,6 +10,7 @@ import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 /**
  * @Author Joburgess
@@ -235,4 +236,6 @@ public interface StudentManageDao {
      * @return
      */
     Integer countRepliedNum(Integer courseScheduleId);
+
+    List<StudentHasCourseDto> queryCourseStudent(@Param("userIds") Set<Integer> userIds);
 }

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

@@ -61,14 +61,14 @@ public class PracticeLessonApplyServiceImpl extends BaseServiceImpl<Integer, Pra
 		if (sysUser == null) {
 			throw new BizException("获取用户信息失败");
 		}
-		PracticeLessonApply practiceLessonApply = new PracticeLessonApply();
-		practiceLessonApply.setCreateTime(new Date());
-		practiceLessonApply.setMemo(memo);
-		practiceLessonApply.setUserId(sysUser.getId());
 		PracticeLessonApply lessonApply = practiceLessonApplyDao.findByUserId(sysUser.getId());
 		if(lessonApply != null){
 			throw new BizException("您已申请过陪练课!");
 		}
+		PracticeLessonApply practiceLessonApply = new PracticeLessonApply();
+		practiceLessonApply.setCreateTime(new Date());
+		practiceLessonApply.setMemo(memo);
+		practiceLessonApply.setUserId(sysUser.getId());
 		practiceLessonApplyDao.insert(practiceLessonApply);
 	}
 }

+ 2 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentManageServiceImpl.java

@@ -362,7 +362,8 @@ public class StudentManageServiceImpl implements StudentManageService {
 //        Set<Integer> vipUserIds = scheduleStudentPaymentDao.queryVipStudentPer();
 //        musicUserIds.addAll(vipUserIds);
         //学员编号", "姓名", "分部", "所在乐团", "乐团所属声部", "所在vip课","是否激活","是否预约
-        //获取编号,姓名,分部,"是否激活","是否预约
+//        获取编号,姓名,分部,"是否激活","是否预约
+//        List<StudentHasCourseDto> studentHasCourseDtos = studentManageDao.queryCourseStudent(vipUserIds);
         return studentManageDao.queryHasCourseStudent(organId);
     }
 

+ 1 - 1
mec-biz/src/main/resources/config/mybatis/PracticeLessonApplyMapper.xml

@@ -41,7 +41,7 @@
 		SELECT COUNT(*) FROM practice_lesson_apply
 	</select>
     <select id="findByUserId" resultMap="PracticeLessonApply">
-		SELECT * FROM practice_lesson_apply WHERE user_id_ = #{userId} LIMIT 1
+		SELECT * FROM practice_lesson_apply WHERE user_id_ = #{userId} LIMIT 1 FOR UPDATE
 	</select>
 	<resultMap id="practiceSumMap" type="com.ym.mec.biz.dal.dto.PracticeSumDto">
 		<result property="organName" column="organName"/>

+ 14 - 1
mec-biz/src/main/resources/config/mybatis/StudentManageDao.xml

@@ -677,10 +677,23 @@
         <result property="isActive" column="is_active_" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
         <result property="isMake" column="is_make_" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
     </resultMap>
+    <select id="queryCourseStudent" resultMap="StudentHasCourseDtoMap">
+        SELECT su.id_,su.username_,o.name_ organ_name_,
+        CASE WHEN su.password_ IS NULL THEN 0 ELSE 1 END is_active_,
+        CASE WHEN pla.id_ IS NULL THEN 0 ELSE 1 END is_make_
+        FROM sys_user su
+        LEFT JOIN organization o ON su.organ_id_ = o.id_
+        LEFT JOIN practice_lesson_apply pla ON pla.user_id_ = su.id_
+        WHERE su.id_ IN
+        <foreach collection="userIds" separator="," open="(" close=")" item="item">
+            #{item}
+        </foreach>
+    </select>
     <select id="queryHasCourseStudent" resultMap="StudentHasCourseDtoMap">
         SELECT su.id_,GROUP_CONCAT(DISTINCT su.username_) username_,GROUP_CONCAT(DISTINCT mg.name_) music_group_name_,
         GROUP_CONCAT(DISTINCT vg.name_) vip_group_name_,GROUP_CONCAT(DISTINCT o.name_) organ_name_,GROUP_CONCAT(DISTINCT s.name_) music_group_subject_,
-        IF(su.password_ IS NULL,0,1) is_active_,IF(pla.id_ IS NULL,0,1) is_make_
+        CASE WHEN su.password_ IS NULL THEN 0 ELSE 1 END is_active_,
+        CASE WHEN pla.id_ IS NULL THEN 0 ELSE 1 END is_make_
         FROM sys_user su
         LEFT JOIN course_schedule_student_payment cssp ON su.id_ = cssp.user_id_
         LEFT JOIN music_group mg ON cssp.music_group_id_ = mg.id_ AND cssp.group_type_ = 'MUSIC'