zouxuan 6 年 前
コミット
7637da9a12

+ 1 - 1
src/main/java/com/ym/mec/collectfee/dao/ApplyInfoDao.java

@@ -43,7 +43,7 @@ public interface ApplyInfoDao extends BaseDAO<Integer, ApplyInfo> {
      * @param userId
      * @param subId
      */
-    void updateUserSub(@Param("userId") Integer userId, @Param("subId")Integer subId, @Param("courseId")Integer courseId, @Param("updateTime") Date updateTime);
+    int updateUserSub(@Param("userId") Integer userId, @Param("subId")Integer subId, @Param("courseId")Integer courseId, @Param("updateTime") Date updateTime);
 
     List<String> findUserByClass(@Param("classId") Integer classId,@Param("status") Integer status);
 }

+ 5 - 33
src/main/resources/config/mybatis/ApplyInfoMapper.xml

@@ -132,7 +132,7 @@
 	</update>
 
     <update id="updateUserSub">
-            UPDATE apply_info SET sub_id_ = #{subId},course_id_ = #{courseId},update_time_ = #{updateTime} WHERE id_ = ${userId}
+            UPDATE apply_info SET sub_id_ = #{subId},course_id_ = #{courseId},update_time_ = #{updateTime} WHERE id_ = ${userId} AND status_ = 1
     </update>
 
     <!-- 根据主键删除一条记录 -->
@@ -184,23 +184,9 @@
 
 	<select id="queryUserPage" resultMap="ApplyInfoPage" parameterType="map">
 		SELECT ao.*,cgi.sub_name_ sub_name_ FROM (SELECT ai.*,o.amount amount_ FROM apply_info ai
-		LEFT JOIN `order` o ON ai.id_ = o.user_id
-		<where>
-			o.tui_fee IS NOT NULL AND o.`status` = 2
-			<if test="musicTeamId != null">
-				AND ai.class_id_ = #{musicTeamId}
-			</if>
-			<if test="name != null and name != ''">
-				AND ai.name_ = #{name}
-			</if>
-			<if test="status != null">
-				AND ai.status_ = #{status}
-			</if>
-			<if test="subId != null">
-				AND ai.sub_id_ = #{subId}
-			</if>
-		</where>
-		) ao LEFT JOIN course_group_info cgi ON ao.course_id_ = cgi.id_
+		LEFT JOIN (SELECT * FROM `order` WHERE id IN (SELECT DISTINCT(user_id) FROM `order` WHERE class_id = #{musicTeamId})) o
+		ON ai.id_ = o.user_id <include refid="studentsPage"/>) ao
+		LEFT JOIN course_group_info cgi ON ao.course_id_ = cgi.id_
 		ORDER BY ao.update_time_ DESC
 		<include refid="global.limit"/>
 	</select>
@@ -209,21 +195,7 @@
 		SELECT count(DISTINCT ai.id_) FROM apply_info ai
 		LEFT JOIN course_group_info cgi ON ai.sub_id_ = cgi.sub_id_
 		LEFT JOIN `order` o ON ai.id_ = o.user_id
-		<where>
-			AND o.tui_fee IS NOT NULL AND o.`status` = 2
-			<if test="musicTeamId != null">
-				AND ai.class_id_ = #{musicTeamId}
-			</if>
-			<if test="name != null and name != ''">
-				AND ai.name_ = #{name}
-			</if>
-			<if test="status != null">
-				AND ai.status_ = #{status}
-			</if>
-			<if test="subId != null">
-				AND ai.sub_id_ = #{subId}
-			</if>
-		</where>
+		<include refid="studentsPage"/>
 	</select>
 
 	<select id="findByUserId" resultMap="ApplyInfo">