فهرست منبع

Merge remote-tracking branch 'origin/master'

周箭河 5 سال پیش
والد
کامیت
9afb4d9583

+ 17 - 5
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleDao.java

@@ -13,9 +13,7 @@ import com.ym.mec.common.page.PageInfo;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
 
@@ -969,7 +967,7 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
      * @param search: 搜索关键字
      * @return java.util.List<java.lang.Integer>
      */
-    List<Integer> findCourseIdsByStudent(String search);
+    Set<Integer> findCourseIdsByStudent(String search);
 
     /**
      * @describe 根据关键字查询教师相关的课程编号
@@ -978,7 +976,7 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
      * @param search: 搜索关键字
      * @return java.util.List<java.lang.Integer>
      */
-    List<Integer> findCourseIdsByTeacher(String search);
+    Set<Integer> findCourseIdsByTeacher(String search);
 
     /**
      * @describe 统计团体下的总课次
@@ -1012,4 +1010,18 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
      */
     Date findGroupCourseEndTime(@Param("groupType") GroupType groupType,
                                   @Param("groupId") String groupId);
+
+    /**
+     * 获取课程编号列表
+     * @param params
+     * @return
+     */
+    Set<Integer> queryMusicCourseScheduleIds(Map<String, Object> params);
+
+    /**
+     * 获取课程编号列表
+     * @param params
+     * @return
+     */
+    Set<Integer> queryVipCourseScheduleIds(Map<String, Object> params);
 }

+ 17 - 13
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java

@@ -363,7 +363,6 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
             return pageInfo;
         }
 
-
         List<CourseScheduleDto> dataList = null;
         int count = courseScheduleDao.countCourseSchedulesWithDate(params);
         if (count > 0) {
@@ -2266,24 +2265,29 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
         PageInfo pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
         Map<String, Object> params = new HashMap<>(16);
         MapUtil.populateMap(params, queryInfo);
+        Set<Integer> courseScheduleIdSet = new HashSet<>();
 
         if(StringUtils.isNotBlank(queryInfo.getSearch())||StringUtils.isNotBlank(queryInfo.getOrganIdList())){
-            params.put("musicGroupStatus", MusicGroupStatusEnum.PROGRESS);
-            params.put("vipGroupStatus", VipGroupStatusEnum.PROGRESS);
-            List<Group> groups = groupDao.searchGroups(params);
-            if(!CollectionUtils.isEmpty(groups)){
+//            params.put("musicGroupStatus", MusicGroupStatusEnum.PROGRESS);
+//            params.put("vipGroupStatus", VipGroupStatusEnum.PROGRESS);
+            //获取相关的乐团和vip课集合
+            courseScheduleIdSet.addAll(courseScheduleDao.queryMusicCourseScheduleIds(params));
+            courseScheduleIdSet.addAll(courseScheduleDao.queryVipCourseScheduleIds(params));
+            if(courseScheduleIdSet.size() > 0){
+                params.put("courseScheduleIds", courseScheduleIdSet);
+            }
+            /*List<Group> groups = groupDao.searchGroups(params);
+            if(groups != null && groups.size() > 0){
                 params.put("groups", groups);
-            }else{
-                if(StringUtils.isNotBlank(queryInfo.getOrganIdList())){
-                    return pageInfo;
-                }
             }
-            List<Integer> studentCourseIds=courseScheduleDao.findCourseIdsByStudent(queryInfo.getSearch());
-            List<Integer> teacherCourseIds=courseScheduleDao.findCourseIdsByTeacher(queryInfo.getSearch());
+            //通过search获取相关学员课程
+            Set<Integer> studentCourseIds=courseScheduleDao.findCourseIdsByStudent(queryInfo.getSearch());
+            //通过search获取相关老师课程
+            Set<Integer> teacherCourseIds=courseScheduleDao.findCourseIdsByTeacher(queryInfo.getSearch());
             studentCourseIds.addAll(teacherCourseIds);
-            if(!CollectionUtils.isEmpty(studentCourseIds)){
+            if(studentCourseIds.size() > 0){
                 params.put("courseIds", studentCourseIds);
-            }
+            }*/
         }
 
         if(StringUtils.isNotBlank(queryInfo.getTeacherName())){

+ 53 - 51
mec-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml

@@ -1245,6 +1245,7 @@
     <select id="queryTeacherCourseScheduleListByTimeRangeAndType" resultMap="CourseSchedule" parameterType="map">
         SELECT
             cs.id_,
+            cs.music_group_id_,
             cs.class_group_id_,
             cs.status_,
             cs.subsidy_,
@@ -1922,64 +1923,15 @@
 
     <sql id="endFindCourseSchedulesCondition">
         <where>
-            <if test="search != null">
-                AND (cs.name_ LIKE CONCAT('%',#{search},'%') OR cs.id_ = #{search}
-                  <if test="groups != null and organIdList==null">
-                      OR cs.music_group_id_ IN
-                      <foreach collection="groups" item="group" open="(" close=")" separator=",">
-                          #{group.id}
-                      </foreach>
-                  </if>
-                  <if test="courseIds != null and organIdList==null">
-                    OR cs.id_ IN
-                    <foreach collection="courseIds" item="courseId" open="(" close=")" separator=",">
-                        #{courseId}
-                    </foreach>
-                  </if>
-                )
-            </if>
-            <if test="groups != null and organIdList!=null">
-                AND cs.music_group_id_ IN
-                <foreach collection="groups" item="group" open="(" close=")" separator=",">
-                    #{group.id}
-                </foreach>
-            </if>
-            <if test="courseIds != null and organIdList!=null">
+            <if test="courseScheduleIds != null">
                 AND cs.id_ IN
-                <foreach collection="courseIds" item="courseId" open="(" close=")" separator=",">
+                <foreach collection="courseScheduleIds" item="courseId" open="(" close=")" separator=",">
                     #{courseId}
                 </foreach>
             </if>
             <if test="teacherIdList != null">
                 AND FIND_IN_SET(cs.actual_teacher_id_,#{teacherIdList})
             </if>
-            <if test="groupType != null">
-                AND cs.group_type_=#{groupType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
-            </if>
-            <if test="groupId != null">
-                AND cs.music_group_id_=#{groupId}
-            </if>
-            <if test="classGroupId != null">
-                AND cs.class_group_id_=#{classGroupId}
-            </if>
-            <if test="startTime!=null and endTime==null">
-                AND cs.class_date_ &gt; DATE_FORMAT(#{startTime},"%Y-%m-%d")
-            </if>
-            <if test="startTime==null and endTime!=null">
-                AND cs.class_date_ &lt; DATE_FORMAT(#{endTime},"%Y-%m-%d")
-            </if>
-            <if test="startTime!=null and endTime!=null">
-                AND cs.class_date_ BETWEEN DATE_FORMAT(#{startTime},"%Y-%m-%d") AND DATE_FORMAT(#{endTime},"%Y-%m-%d")
-            </if>
-            <if test="courseStatus!=null">
-                AND cs.status_ = #{courseStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
-            </if>
-            <if test="courseType!=null">
-                AND cs.type_ = #{courseType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
-            </if>
-            <if test="schoolId!=null">
-                AND cs.schoole_id_ = #{schoolId}
-            </if>
         </where>
     </sql>
 
@@ -2075,4 +2027,54 @@
         WHERE group_type_=#{groupType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
                 AND music_group_id_=#{groupId}
     </select>
+    <select id="queryMusicCourseScheduleIds" resultType="java.lang.Integer">
+        SELECT cs.id_ FROM course_schedule cs
+        LEFT JOIN music_group mg ON cs.music_group_id_ = mg.id_
+        LEFT JOIN class_group cg ON cs.class_group_id_ = cg.id_
+        WHERE cs.group_type_ = 'MUSIC' AND mg.status_ = 'PROGRESS' AND cs.del_flag_ = 0 AND cg.del_flag_ = 0
+        <if test="search != null and search != ''">
+            AND (mg.id_ = #{search} OR mg.name_ LIKE CONCAT('%',#{search},'%')
+            OR cs.id_ = #{search} OR cs.name_ LIKE CONCAT('%',#{search},'%')
+            OR cg.id_ = #{search} OR cg.name_ LIKE CONCAT('%',#{search},'%'))
+        </if>
+        <if test="organIdList != null and organIdList != ''">
+            AND FIND_IN_SET(mg.organ_id_,#{organIdList})
+        </if>
+        <include refid="queryVipCourseScheduleIds"/>
+    </select>
+    <sql id="queryVipCourseScheduleIds">
+        <if test="startTime!=null and endTime==null">
+            AND cs.class_date_ &gt; DATE_FORMAT(#{startTime},"%Y-%m-%d")
+        </if>
+        <if test="startTime==null and endTime!=null">
+            AND cs.class_date_ &lt; DATE_FORMAT(#{endTime},"%Y-%m-%d")
+        </if>
+        <if test="startTime!=null and endTime!=null">
+            AND cs.class_date_ BETWEEN DATE_FORMAT(#{startTime},"%Y-%m-%d") AND DATE_FORMAT(#{endTime},"%Y-%m-%d")
+        </if>
+        <if test="courseStatus!=null">
+            AND cs.status_ = #{courseStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+        </if>
+        <if test="courseType!=null">
+            AND cs.type_ = #{courseType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+        </if>
+        <if test="schoolId!=null">
+            AND cs.schoole_id_ = #{schoolId}
+        </if>
+    </sql>
+    <select id="queryVipCourseScheduleIds" resultType="java.lang.Integer">
+        SELECT cs.id_ FROM course_schedule cs
+        LEFT JOIN vip_group vg ON cs.music_group_id_ = vg.id_
+        LEFT JOIN class_group cg ON cs.class_group_id_ = cg.id_
+        WHERE cs.group_type_ = 'VIP' AND vg.status_ = '2' AND cs.del_flag_ = 0 AND cg.del_flag_ = 0
+        <if test="search != null and search != ''">
+            AND (vg.id_ = #{search} OR vg.name_ LIKE CONCAT('%',#{search},'%')
+            OR cs.id_ = #{search} OR cs.name_ LIKE CONCAT('%',#{search},'%')
+            OR cg.id_ = #{search} OR cg.name_ LIKE CONCAT('%',#{search},'%'))
+        </if>
+        <if test="organIdList != null and organIdList != ''">
+            AND FIND_IN_SET(vg.organ_id_,#{organIdList})
+        </if>
+        <include refid="queryVipCourseScheduleIds"/>
+    </select>
 </mapper>