|  | @@ -1343,22 +1343,22 @@
 | 
	
		
			
				|  |  |          SELECT u.user_id_ userId,
 | 
	
		
			
				|  |  |          su.username_ studentName,
 | 
	
		
			
				|  |  |          <if test="orderByPerRegister == null">
 | 
	
		
			
				|  |  | -            IFNULL(spr.create_time_,'2099-12-31') perRegisterTime,
 | 
	
		
			
				|  |  | +            IFNULL(spr.create_time_, '2099-12-31') perRegisterTime,
 | 
	
		
			
				|  |  |          </if>
 | 
	
		
			
				|  |  | -        <if test="orderByPerRegister != null and orderByPerRegister=='ASC'">
 | 
	
		
			
				|  |  | -            IFNULL(spr.create_time_,'2099-12-31') perRegisterTime,
 | 
	
		
			
				|  |  | +        <if test="orderByPerRegister != null and orderByPerRegister == 'ASC'">
 | 
	
		
			
				|  |  | +            IFNULL(spr.create_time_, '2099-12-31') perRegisterTime,
 | 
	
		
			
				|  |  |          </if>
 | 
	
		
			
				|  |  | -        <if test="orderByPerRegister != null and orderByPerRegister=='DESC'">
 | 
	
		
			
				|  |  | -            IFNULL(spr.create_time_,'1990-12-31') perRegisterTime,
 | 
	
		
			
				|  |  | +        <if test="orderByPerRegister != null and orderByPerRegister == 'DESC'">
 | 
	
		
			
				|  |  | +            IFNULL(spr.create_time_, '1990-12-31') perRegisterTime,
 | 
	
		
			
				|  |  |          </if>
 | 
	
		
			
				|  |  |          <if test="orderByPayTime == null">
 | 
	
		
			
				|  |  | -            IFNULL(o.payTime,'2099-12-31') payTime,
 | 
	
		
			
				|  |  | +            IFNULL(o.payTime, '2099-12-31') payTime,
 | 
	
		
			
				|  |  |          </if>
 | 
	
		
			
				|  |  | -        <if test="orderByPayTime != null and orderByPayTime=='ASC'">
 | 
	
		
			
				|  |  | -            IFNULL(o.payTime,'2099-12-31') payTime,
 | 
	
		
			
				|  |  | +        <if test="orderByPayTime != null and orderByPayTime == 'ASC'">
 | 
	
		
			
				|  |  | +            IFNULL(o.payTime, '2099-12-31') payTime,
 | 
	
		
			
				|  |  |          </if>
 | 
	
		
			
				|  |  | -        <if test="orderByPayTime != null and orderByPayTime=='DESC'">
 | 
	
		
			
				|  |  | -            IFNULL(o.payTime,'1990-12-31') payTime,
 | 
	
		
			
				|  |  | +        <if test="orderByPayTime != null and orderByPayTime == 'DESC'">
 | 
	
		
			
				|  |  | +            IFNULL(o.payTime, '1990-12-31') payTime,
 | 
	
		
			
				|  |  |          </if>
 | 
	
		
			
				|  |  |          IFNULL(s2.name_, s1.name_) actualSubjectName
 | 
	
		
			
				|  |  |          FROM (SELECT user_id_
 | 
	
	
		
			
				|  | @@ -1384,27 +1384,27 @@
 | 
	
		
			
				|  |  |          GROUP BY spo.user_id_
 | 
	
		
			
				|  |  |          ) o ON o.user_id_ = u.user_id_
 | 
	
		
			
				|  |  |          <where>
 | 
	
		
			
				|  |  | -        <if test="userIds != null">
 | 
	
		
			
				|  |  | -            AND u.user_id_ IN
 | 
	
		
			
				|  |  | -            <foreach collection="userIds" item="userId" open="(" close=")" separator=",">
 | 
	
		
			
				|  |  | -                #{userId}
 | 
	
		
			
				|  |  | -            </foreach>
 | 
	
		
			
				|  |  | -        </if>
 | 
	
		
			
				|  |  | -        <if test="subjectId">
 | 
	
		
			
				|  |  | -            AND (sr.actual_subject_id_ = #{subjectId} OR spr.subject_first_ = #{subjectId})
 | 
	
		
			
				|  |  | -        </if>
 | 
	
		
			
				|  |  | +            <if test="userIds != null">
 | 
	
		
			
				|  |  | +                AND u.user_id_ IN
 | 
	
		
			
				|  |  | +                <foreach collection="userIds" item="userId" open="(" close=")" separator=",">
 | 
	
		
			
				|  |  | +                    #{userId}
 | 
	
		
			
				|  |  | +                </foreach>
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="subjectId">
 | 
	
		
			
				|  |  | +                AND (sr.actual_subject_id_ = #{subjectId} OR spr.subject_first_ = #{subjectId})
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  |          </where>
 | 
	
		
			
				|  |  |          <if test="orderByPerRegister != null and orderByPayTime == null">
 | 
	
		
			
				|  |  |              ORDER BY perRegisterTime ${orderByPerRegister},u.user_id_ ASC
 | 
	
		
			
				|  |  |          </if>
 | 
	
		
			
				|  |  |          <if test="orderByPerRegister != null and orderByPayTime != null">
 | 
	
		
			
				|  |  | -            ORDER BY perRegisterTime ${orderByPerRegister},payTime ${orderByPayTime},u.user_id_ ASC
 | 
	
		
			
				|  |  | +            ORDER BY perRegisterTime ${orderByPerRegister}, payTime ${orderByPayTime}, u.user_id_ ASC
 | 
	
		
			
				|  |  |          </if>
 | 
	
		
			
				|  |  |          <if test="orderByPerRegister == null and orderByPayTime != null">
 | 
	
		
			
				|  |  | -            ORDER BY payTime ${orderByPayTime},u.user_id_ ASC
 | 
	
		
			
				|  |  | +            ORDER BY payTime ${orderByPayTime}, u.user_id_ ASC
 | 
	
		
			
				|  |  |          </if>
 | 
	
		
			
				|  |  |          <if test="orderByPerRegister == null and orderByPayTime == null">
 | 
	
		
			
				|  |  | -            ORDER BY perRegisterTime ASC,u.user_id_ ASC
 | 
	
		
			
				|  |  | +            ORDER BY perRegisterTime ASC, u.user_id_ ASC
 | 
	
		
			
				|  |  |          </if>
 | 
	
		
			
				|  |  |          <include refid="global.limit"/>
 | 
	
		
			
				|  |  |      </select>
 | 
	
	
		
			
				|  | @@ -1459,4 +1459,27 @@
 | 
	
		
			
				|  |  |          GROUP BY spo.user_id_
 | 
	
		
			
				|  |  |          ) o ON o.user_id_ = u.user_id_
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <select id="getRegisterNum" resultType="int">
 | 
	
		
			
				|  |  | +        SELECT * FROM student_registration WHERE music_group_id_ = #{musicGroupId} AND music_group_status_ != 'QUIT'
 | 
	
		
			
				|  |  | +    </select>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <select id="getFirstPayNum" resultType="int">
 | 
	
		
			
				|  |  | +        SELECT COUNT(*) FROM student_registration sr
 | 
	
		
			
				|  |  | +        LEFT JOIN (
 | 
	
		
			
				|  |  | +        SELECT spo.user_id_, MAX(spo.pay_time_) payTime
 | 
	
		
			
				|  |  | +        FROM student_payment_order spo
 | 
	
		
			
				|  |  | +        WHERE spo.music_group_id_ = #{musicGroupId}
 | 
	
		
			
				|  |  | +        AND type_ = 'APPLY'
 | 
	
		
			
				|  |  | +        GROUP BY spo.user_id_
 | 
	
		
			
				|  |  | +        ) o ON o.user_id_ = sr.user_id_
 | 
	
		
			
				|  |  | +        WHERE music_group_id_ = #{musicGroupId} AND sr.payment_status_=2
 | 
	
		
			
				|  |  | +        <if test="startTime != null">
 | 
	
		
			
				|  |  | +            AND o.payTime >= #{startTime}
 | 
	
		
			
				|  |  | +        </if>
 | 
	
		
			
				|  |  | +        <if test="endTime != null">
 | 
	
		
			
				|  |  | +            <![CDATA[ AND o.payTime <= #{endTime}]]>
 | 
	
		
			
				|  |  | +        </if>
 | 
	
		
			
				|  |  | +        AND music_group_status_ != 'QUIT'
 | 
	
		
			
				|  |  | +    </select>
 | 
	
		
			
				|  |  |  </mapper>
 |