| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219 | 
							- <?xml version="1.0" encoding="UTF-8" ?>
 
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 
- <!-- 这个文件是自动生成的。 不要修改此文件。所有改动将在下次重新自动生成时丢失。 -->
 
- <mapper namespace="com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDetailDao">
 
- 	<resultMap type="com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderDetail"
 
- 		id="MusicGroupPaymentCalenderDetail">
 
- 		<result column="id_" property="id" />
 
- 		<result column="music_group_payment_calender_id_" property="musicGroupPaymentCalenderId" />
 
- 		<result column="user_id_" property="userId" />
 
- 		<result column="expect_amount_" property="expectAmount" />
 
- 		<result column="actual_amount_" property="actualAmount" />
 
- 		<result column="payment_status_" property="paymentStatus" />
 
- 		<result column="user_status_" property="userStatus" />
 
- 		<result column="pay_time_" property="payTime" />
 
- 		<result column="start_payment_date_" property="startPaymentDate" />
 
- 		<result column="deadline_payment_date_" property="deadlinePaymentDate" />
 
- 		<result column="update_time_" property="updateTime" />
 
- 		<result column="create_time_" property="createTime" />
 
- 		<result column="open_" property="open" />
 
- 		<association property="sysUser" javaType="com.ym.mec.auth.api.entity.SysUser">
 
- 			<result column="username_" property="username" />
 
- 		</association>
 
- 		<association property="studentRegistration" javaType="com.ym.mec.biz.dal.entity.StudentRegistration">
 
- 			<result column="subject_names_" property="subjectName" />
 
- 			<result column="music_group_status_" property="musicGroupStatus" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
 
- 		</association>
 
- 	</resultMap>
 
- 	<!-- 根据主键查询一条记录 -->
 
- 	<select id="get" resultMap="MusicGroupPaymentCalenderDetail">
 
- 		SELECT * FROM music_group_payment_calender_detail WHERE id_ = #{id}
 
- 	</select>
 
- 	<!-- 全查询 -->
 
- 	<select id="findAll" resultMap="MusicGroupPaymentCalenderDetail">
 
- 		SELECT * FROM music_group_payment_calender_detail ORDER BY id_
 
- 	</select>
 
- 	<!-- 向数据库增加一条记录 -->
 
- 	<insert id="insert"
 
- 		parameterType="com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderDetail"
 
- 		useGeneratedKeys="true" keyColumn="id" keyProperty="id">
 
- 		INSERT INTO music_group_payment_calender_detail
 
- 		(id_,music_group_payment_calender_id_,user_id_,expect_amount_,actual_amount_,payment_status_,
 
- 		user_status_,pay_time_,update_time_,create_time_,open_,start_payment_date_,deadline_payment_date_)
 
- 		VALUES(#{id},#{musicGroupPaymentCalenderId},#{userId},#{expectAmount},#{actualAmount},#{paymentStatus},
 
- 		#{userStatus},#{payTime},#{updateTime},#{createTime},#{open},#{startPaymentDate},#{deadlinePaymentDate})
 
- 	</insert>
 
-     <insert id="batchInsert" parameterType="com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderDetail">
 
-         INSERT INTO music_group_payment_calender_detail
 
- 		(id_,music_group_payment_calender_id_,user_id_,expect_amount_,actual_amount_,
 
- 		payment_status_,user_status_,pay_time_,update_time_,create_time_,open_,start_payment_date_,deadline_payment_date_)
 
- 		VALUES
 
- 		<foreach collection="list" item="item" separator=",">
 
-             (#{item.id},#{item.musicGroupPaymentCalenderId},#{item.userId},#{item.expectAmount},
 
-             #{item.actualAmount},#{item.paymentStatus},#{item.userStatus},#{item.payTime},
 
-             #{item.updateTime},#{item.createTime},#{item.open},#{item.startPaymentDate},#{item.deadlinePaymentDate})
 
-         </foreach>
 
-     </insert>
 
- 	<!-- 根据主键查询一条记录 -->
 
- 	<update id="update"
 
- 		parameterType="com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderDetail">
 
- 		UPDATE music_group_payment_calender_detail
 
- 		<set>
 
- 			<if test="startPaymentDate != null">
 
- 				start_payment_date_ = #{startPaymentDate},
 
- 			</if>
 
- 			<if test="deadlinePaymentDate != null">
 
- 				deadline_payment_date_ = #{deadlinePaymentDate},
 
- 			</if>
 
- 			<if test="open != null">
 
- 				open_ = #{open},
 
- 			</if>
 
- 			<if test="userId != null">
 
- 				user_id_ = #{userId},
 
- 			</if>
 
- 			<if test="userStatus != null">
 
- 				user_status_ = #{userStatus},
 
- 			</if>
 
- 			<if test="paymentStatus != null">
 
- 				payment_status_ = #{paymentStatus},
 
- 			</if>
 
- 			<if test="expectAmount != null">
 
- 				expect_amount_ = #{expectAmount},
 
- 			</if>
 
- 			<if test="updateTime != null">
 
- 				update_time_ = #{updateTime},
 
- 			</if>
 
- 			<if test="musicGroupPaymentCalenderId != null">
 
- 				music_group_payment_calender_id_ = #{musicGroupPaymentCalenderId},
 
- 			</if>
 
- 			<if test="actualAmount != null">
 
- 				actual_amount_ = #{actualAmount},
 
- 			</if>
 
- 			<if test="payTime != null">
 
- 				pay_time_ = #{payTime},
 
- 			</if>
 
- 		</set>
 
- 		WHERE id_ = #{id}
 
- 	</update>
 
- 	<update id="batchUpdate">
 
- 		<foreach collection="calenderDetails" item="item" index="index" open="" close="" separator=";">
 
- 			UPDATE music_group_payment_calender_detail
 
- 			<set>
 
- 				<if test="item.open != null">
 
- 					open_ = #{item.open},
 
- 				</if>
 
- 				<if test="item.userId != null">
 
- 					user_id_ = #{item.userId},
 
- 				</if>
 
- 				<if test="item.userStatus != null">
 
- 					user_status_ = #{item.userStatus},
 
- 				</if>
 
- 				<if test="item.paymentStatus != null">
 
- 					payment_status_ = #{item.paymentStatus},
 
- 				</if>
 
- 				<if test="item.expectAmount != null">
 
- 					expect_amount_ = #{item.expectAmount},
 
- 				</if>
 
- 				<if test="item.updateTime != null">
 
- 					update_time_ = #{item.updateTime},
 
- 				</if>
 
- 				<if test="item.musicGroupPaymentCalenderId != null">
 
- 					music_group_payment_calender_id_ = #{item.musicGroupPaymentCalenderId},
 
- 				</if>
 
- 				<if test="item.actualAmount != null">
 
- 					actual_amount_ = #{item.actualAmount},
 
- 				</if>
 
- 				<if test="item.payTime != null">
 
- 					pay_time_ = #{item.payTime}
 
- 				</if>
 
- 			</set>
 
- 			WHERE id_ = #{item.id}
 
- 		</foreach>
 
- 	</update>
 
- 	<!-- 根据主键删除一条记录 -->
 
- 	<delete id="delete">
 
- 		DELETE FROM music_group_payment_calender_detail WHERE id_ = #{id}
 
- 	</delete>
 
- 	<!-- 分页查询 -->
 
- 	<select id="queryPage" resultMap="MusicGroupPaymentCalenderDetail"
 
- 		parameterType="map">
 
- 		SELECT mgpcd.*,su.username_,st.name_ subject_names_,sr.music_group_status_
 
- 		FROM music_group_payment_calender_detail mgpcd
 
- 		LEFT JOIN sys_user su ON su.id_ = mgpcd.user_id_
 
- 		LEFT JOIN student_registration sr ON sr.user_id_ = mgpcd.user_id_
 
- 		LEFT JOIN `subject` st ON st.id_ = sr.actual_subject_id_
 
- 		LEFT JOIN music_group_payment_calender mgpc ON mgpc.id_ = mgpcd.music_group_payment_calender_id_
 
- 		<where>
 
- 			mgpc.music_group_id_ = sr.music_group_id_
 
- 			<if test="userId != null">
 
- 				AND mgpcd.user_id_ = #{userId}
 
- 			</if>
 
- 			<if test="id != null">
 
- 				AND mgpcd.music_group_payment_calender_id_ = #{id}
 
- 			</if>
 
- 			<if test="paymentStatus != null">
 
- 				AND mgpcd.payment_status_ = #{paymentStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
 
- 			</if>
 
- 			<if test="subjectId != null">
 
- 				AND #{subjectId} = sr.actual_subject_id_
 
- 			</if>
 
- 		</where>
 
- 		ORDER BY mgpc.create_time_
 
- 		<include refid="global.limit" />
 
- 	</select>
 
- 	<!-- 查询当前表的总记录数 -->
 
- 	<select id="queryCount" resultType="int">
 
- 		SELECT COUNT(DISTINCT mgpcd.id_) FROM music_group_payment_calender_detail mgpcd
 
- 		LEFT JOIN student_registration sr ON sr.user_id_ = mgpcd.user_id_
 
- 		LEFT JOIN `subject` st ON st.id_ = sr.actual_subject_id_
 
- 		<where>
 
- 			<if test="userId != null">
 
- 				AND mgpcd.user_id_ = #{userId}
 
- 			</if>
 
- 			<if test="id != null">
 
- 				AND mgpcd.music_group_payment_calender_id_ = #{id}
 
- 			</if>
 
- 			<if test="subjectId != null">
 
- 				AND #{subjectId} = sr.actual_subject_id_
 
- 			</if>
 
- 			<if test="paymentStatus != null">
 
- 				AND mgpcd.payment_status_ = #{paymentStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
 
- 			</if>
 
- 		</where>
 
- 	</select>
 
- 	<select id="queryListByIds" resultMap="MusicGroupPaymentCalenderDetail">
 
- 		SELECT * FROM music_group_payment_calender_detail WHERE FIND_IN_SET(id_,#{ids})
 
- 	</select>
 
- 	
 
- 	<select id="queryByCalenderId" resultMap="MusicGroupPaymentCalenderDetail">
 
- 		SELECT * FROM music_group_payment_calender_detail where music_group_payment_calender_id_ = #{calenderId}
 
- 	</select>
 
-     <select id="findMusicGroupStudentWithSubject" resultType="com.ym.mec.biz.dal.dto.SimpleUserDto">
 
- 		SELECT DISTINCT su.id_ userId,su.username_ userName, su.avatar_ avatar, su.phone_ phone
 
- 		from music_group_student_fee_ mgstf
 
- 		LEFT JOIN sys_user su ON su.id_=mgstf.user_id_
 
- 		WHERE mgstf.music_group_id_=#{musicGroupId}
 
- 		AND mgstf.subject_id_=#{subjectId}
 
- 		AND mgstf.remain_network_class_times_>0
 
- 	</select>
 
- 	<select id="sumActualAmount" resultType="java.math.BigDecimal">
 
- 		SELECT SUM(mgpcd.actual_amount_) FROM music_group_payment_calender_detail mgpcd
 
- 		WHERE mgpcd.music_group_payment_calender_id_ = #{id} AND mgpcd.payment_status_ = "PAID_COMPLETED"
 
- 	</select>
 
- 	<select id="getUserLastCalenderDetail" resultMap="MusicGroupPaymentCalenderDetail">
 
- 		SELECT * FROM music_group_payment_calender_detail mgpcd
 
- 		LEFT JOIN music_group_payment_calender mgpc ON mgpcd.music_group_payment_calender_id_ = mgpc.id_
 
- 		WHERE mgpc.music_group_id_=#{musicGroupId} AND mgpcd.user_id_=#{userId} AND mgpcd.payment_status_ = 'PROCESSING'
 
- 		ORDER BY mgpc.start_payment_date_ DESC
 
- 	</select>
 
- </mapper>
 
 
  |