zouxuan 5 years ago
parent
commit
523a86bf30

+ 6 - 4
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/PracticeLessonApplyDao.java

@@ -2,8 +2,10 @@ package com.ym.mec.biz.dal.dao;
 
 import com.ym.mec.biz.dal.dto.PracticeSumDto;
 import com.ym.mec.biz.dal.entity.PracticeLessonApply;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
+import java.util.Set;
 
 public interface PracticeLessonApplyDao extends com.ym.mec.common.dal.BaseDAO<Integer, PracticeLessonApply> {
 
@@ -19,23 +21,23 @@ public interface PracticeLessonApplyDao extends com.ym.mec.common.dal.BaseDAO<In
      * 陪练课列表页
      * @return
      */
-    List<PracticeSumDto> practiceSum();
+    List<PracticeSumDto> practiceSum(@Param("userIds") Set<Integer> userIds);
 
     /**
      * 获取学生总人数
      * @return
      */
-    Integer getTotalNum();
+    Integer getTotalNum(@Param("userIds") Set<Integer> userIds);
 
     /**
      * 激活总人数
      * @return
      */
-    Integer getActiveNum();
+    Integer getActiveNum(@Param("userIds") Set<Integer> userIds);
 
     /**
      * 预约总人数
      * @return
      */
-    Integer getMakeNum();
+    Integer getMakeNum(@Param("userIds") Set<Integer> userIds);
 }

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

@@ -1,5 +1,6 @@
 package com.ym.mec.biz.service.impl;
 
+import com.ym.mec.biz.dal.dao.CourseScheduleStudentPaymentDao;
 import com.ym.mec.biz.dal.dto.PracticeSumDto;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -13,12 +14,15 @@ import com.ym.mec.common.service.impl.BaseServiceImpl;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 @Service
 public class PracticeLessonApplyServiceImpl extends BaseServiceImpl<Integer, PracticeLessonApply>  implements PracticeLessonApplyService {
 	
 	@Autowired
 	private PracticeLessonApplyDao practiceLessonApplyDao;
+	@Autowired
+	private CourseScheduleStudentPaymentDao scheduleStudentPaymentDao;
 
 	@Override
 	public BaseDAO<Integer, PracticeLessonApply> getDAO() {
@@ -32,11 +36,14 @@ public class PracticeLessonApplyServiceImpl extends BaseServiceImpl<Integer, Pra
 
 	@Override
 	public Map<String, Object> practiceSum() {
-		List<PracticeSumDto> practiceSumDtos = practiceLessonApplyDao.practiceSum();
-		Integer totalNum = practiceLessonApplyDao.getTotalNum();
-		Integer activeNum = practiceLessonApplyDao.getActiveNum();
-		Integer makeNum = practiceLessonApplyDao.getMakeNum();
-		Map<String,Object> map = new HashMap<>();
+		Set<Integer> musicUserIds = scheduleStudentPaymentDao.queryMusicStudentPer();
+		Set<Integer> vipUserIds = scheduleStudentPaymentDao.queryVipStudentPer();
+		musicUserIds.addAll(vipUserIds);
+		List<PracticeSumDto> practiceSumDtos = practiceLessonApplyDao.practiceSum(musicUserIds);
+		Integer totalNum = practiceLessonApplyDao.getTotalNum(musicUserIds);
+		Integer activeNum = practiceLessonApplyDao.getActiveNum(musicUserIds);
+		Integer makeNum = practiceLessonApplyDao.getMakeNum(musicUserIds);
+		Map<String,Object> map = new HashMap<>(4);
 		map.put("totalNum",totalNum);
 		map.put("activeNum",activeNum);
 		map.put("makeNum",makeNum);

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

@@ -55,17 +55,26 @@
 		LEFT JOIN practice_lesson_apply pla ON pla.user_id_ = su.id_
 		LEFT JOIN organization o ON o.id_ = su.organ_id_
 		LEFT JOIN sys_user ps ON ps.id_ = su.id_ AND ps.password_ IS NOT NULL
-		WHERE su.user_type_ LIKE '%STUDENT%' AND su.organ_id_ NOT IN (36,38,39)
+		WHERE su.user_type_ LIKE '%STUDENT%' AND su.organ_id_ NOT IN (36,38,39) AND su.id_ IN
+		<foreach collection="userIds" separator="," open="(" close=")" item="item">
+			#{item}
+		</foreach>
 		GROUP BY su.organ_id_
 		ORDER BY per DESC
 	</select>
 	<select id="getTotalNum" resultType="java.lang.Integer">
 		SELECT COUNT(su.id_) FROM sys_user su
-		WHERE su.user_type_ LIKE '%STUDENT%' AND su.organ_id_ NOT IN (36,38,39)
+		WHERE su.user_type_ LIKE '%STUDENT%' AND su.organ_id_ NOT IN (36,38,39) AND su.id_ IN
+		<foreach collection="userIds" separator="," open="(" close=")" item="item">
+			#{item}
+		</foreach>
 	</select>
 	<select id="getActiveNum" resultType="java.lang.Integer">
 		SELECT COUNT(su.id_) FROM sys_user su
-		WHERE su.user_type_ LIKE '%STUDENT%' AND su.password_ IS NOT NULL AND su.organ_id_ NOT IN (36,38,39)
+		WHERE su.user_type_ LIKE '%STUDENT%' AND su.password_ IS NOT NULL AND su.organ_id_ NOT IN (36,38,39) AND su.id_ IN
+		<foreach collection="userIds" separator="," open="(" close=")" item="item">
+			#{item}
+		</foreach>
 	</select>
 	<select id="getMakeNum" resultType="java.lang.Integer">
 		SELECT COUNT(id_) FROM practice_lesson_apply