|  | @@ -14,7 +14,8 @@
 | 
	
		
			
				|  |  |          <result column="create_time_" property="createTime"/>
 | 
	
		
			
				|  |  |          <result column="update_time_" property="updateTime"/>
 | 
	
		
			
				|  |  |          <result column="payment_order_id_" property="paymentOrderId"/>
 | 
	
		
			
				|  |  | -        <result column="kit_group_purchase_type_" property="kitGroupPurchaseType" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
 | 
	
		
			
				|  |  | +        <result column="kit_group_purchase_type_" property="kitGroupPurchaseType"
 | 
	
		
			
				|  |  | +                typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
 | 
	
		
			
				|  |  |          <collection property="goodsList" ofType="com.ym.mec.biz.dal.entity.Goods">
 | 
	
		
			
				|  |  |              <result column="goods_id_" property="id"/>
 | 
	
		
			
				|  |  |              <result column="goods_name_" property="name"/>
 | 
	
	
		
			
				|  | @@ -27,7 +28,9 @@
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <!-- 根据主键查询一条记录 -->
 | 
	
		
			
				|  |  |      <select id="get" resultMap="StudentPaymentOrderDetail">
 | 
	
		
			
				|  |  | -        SELECT * FROM student_payment_order_detail WHERE id_ = #{id}
 | 
	
		
			
				|  |  | +        SELECT *
 | 
	
		
			
				|  |  | +        FROM student_payment_order_detail
 | 
	
		
			
				|  |  | +        WHERE id_ = #{id}
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <!-- 全查询 -->
 | 
	
	
		
			
				|  | @@ -68,7 +71,8 @@
 | 
	
		
			
				|  |  |                  payment_order_id_ = #{paymentOrderId},
 | 
	
		
			
				|  |  |              </if>
 | 
	
		
			
				|  |  |              <if test="kitGroupPurchaseType != null">
 | 
	
		
			
				|  |  | -                kit_group_purchase_type_ = #{kitGroupPurchaseType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
 | 
	
		
			
				|  |  | +                kit_group_purchase_type_ =
 | 
	
		
			
				|  |  | +                #{kitGroupPurchaseType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
 | 
	
		
			
				|  |  |              </if>
 | 
	
		
			
				|  |  |              <if test="type != null">
 | 
	
		
			
				|  |  |                  type_ = #{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
 | 
	
	
		
			
				|  | @@ -79,7 +83,9 @@
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <!-- 根据主键删除一条记录 -->
 | 
	
		
			
				|  |  |      <delete id="delete">
 | 
	
		
			
				|  |  | -        DELETE FROM student_payment_order_detail WHERE id_ = #{id}
 | 
	
		
			
				|  |  | +        DELETE
 | 
	
		
			
				|  |  | +        FROM student_payment_order_detail
 | 
	
		
			
				|  |  | +        WHERE id_ = #{id}
 | 
	
		
			
				|  |  |      </delete>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <!-- 分页查询 -->
 | 
	
	
		
			
				|  | @@ -107,27 +113,32 @@
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <!-- 查询注册订单详情 -->
 | 
	
		
			
				|  |  |      <select id="findApplyOrderSuccess" resultMap="StudentPaymentOrderDetail">
 | 
	
		
			
				|  |  | -        SELECT spod.* FROM student_payment_order spo
 | 
	
		
			
				|  |  | -        LEFT JOIN student_payment_order_detail spod ON spo.id_ = spod.payment_order_id_
 | 
	
		
			
				|  |  | -        LEFT JOIN student_registration sr ON spo.user_id_ = sr.user_id_
 | 
	
		
			
				|  |  | +        SELECT spod.*
 | 
	
		
			
				|  |  | +        FROM student_payment_order spo
 | 
	
		
			
				|  |  | +                 LEFT JOIN student_payment_order_detail spod ON spo.id_ = spod.payment_order_id_
 | 
	
		
			
				|  |  | +                 LEFT JOIN student_registration sr ON spo.user_id_ = sr.user_id_
 | 
	
		
			
				|  |  |          WHERE spo.music_group_id_ = #{musicGroupId}
 | 
	
		
			
				|  |  | -        AND spo.status_=#{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
 | 
	
		
			
				|  |  | -        AND spo.type_ = 'APPLY'
 | 
	
		
			
				|  |  | -        AND sr.music_group_id_=#{musicGroupId} AND sr.music_group_status_ != 'QUIT'
 | 
	
		
			
				|  |  | +          AND spo.status_ = #{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
 | 
	
		
			
				|  |  | +          AND spo.type_ = 'APPLY'
 | 
	
		
			
				|  |  | +          AND sr.music_group_id_ = #{musicGroupId}
 | 
	
		
			
				|  |  | +          AND sr.music_group_status_ != 'QUIT'
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <!-- 查询订单详情 -->
 | 
	
		
			
				|  |  |      <select id="findApplyOrderGoods" resultMap="StudentPaymentOrderDetail">
 | 
	
		
			
				|  |  | -        SELECT * FROM student_payment_order_detail WHERE payment_order_id_ = #{orderId}
 | 
	
		
			
				|  |  | +        SELECT *
 | 
	
		
			
				|  |  | +        FROM student_payment_order_detail
 | 
	
		
			
				|  |  | +        WHERE payment_order_id_ = #{orderId}
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <!-- 查询用户注册订单详情 -->
 | 
	
		
			
				|  |  |      <select id="findUserApplyOrder" resultMap="StudentPaymentOrderDetail">
 | 
	
		
			
				|  |  | -        SELECT spod.* FROM student_payment_order spo
 | 
	
		
			
				|  |  | -        LEFT JOIN student_payment_order_detail spod ON spo.id_ = spod.payment_order_id_
 | 
	
		
			
				|  |  | +        SELECT spod.*
 | 
	
		
			
				|  |  | +        FROM student_payment_order spo
 | 
	
		
			
				|  |  | +                 LEFT JOIN student_payment_order_detail spod ON spo.id_ = spod.payment_order_id_
 | 
	
		
			
				|  |  |          WHERE spo.user_id_ = #{userId}
 | 
	
		
			
				|  |  | -        AND spo.status_=#{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
 | 
	
		
			
				|  |  | -        AND spo.type_ = 'APPLY'
 | 
	
		
			
				|  |  | +          AND spo.status_ = #{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
 | 
	
		
			
				|  |  | +          AND spo.type_ = 'APPLY'
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  |      <resultMap id="musicalListDetailDtoMap" type="com.ym.mec.biz.dal.dto.MusicalListDetailDto">
 | 
	
		
			
				|  |  |          <result property="paymentOrderId" column="payment_order_id_"/>
 | 
	
	
		
			
				|  | @@ -143,10 +154,13 @@
 | 
	
		
			
				|  |  |          <result property="goodsNames" column="goods_names_"/>
 | 
	
		
			
				|  |  |      </resultMap>
 | 
	
		
			
				|  |  |      <select id="getMusicalListDetail" resultMap="musicalListDetailDtoMap">
 | 
	
		
			
				|  |  | -        SELECT MAX(spo.id_) payment_order_id_,spo.user_id_  FROM student_payment_order spo
 | 
	
		
			
				|  |  | -        LEFT JOIN student_registration sr ON spo.user_id_ = sr.user_id_
 | 
	
		
			
				|  |  | -        WHERE spo.music_group_id_ = #{musicGroupId} AND spo.status_ = 'SUCCESS'
 | 
	
		
			
				|  |  | -        AND sr.music_group_id_ = #{musicGroupId} AND sr.music_group_status_!='QUIT'
 | 
	
		
			
				|  |  | +        SELECT MAX(spo.id_) payment_order_id_, spo.user_id_
 | 
	
		
			
				|  |  | +        FROM student_payment_order spo
 | 
	
		
			
				|  |  | +                 LEFT JOIN student_registration sr ON spo.user_id_ = sr.user_id_
 | 
	
		
			
				|  |  | +        WHERE spo.music_group_id_ = #{musicGroupId}
 | 
	
		
			
				|  |  | +          AND spo.status_ = 'SUCCESS'
 | 
	
		
			
				|  |  | +          AND sr.music_group_id_ = #{musicGroupId}
 | 
	
		
			
				|  |  | +          AND sr.music_group_status_ != 'QUIT'
 | 
	
		
			
				|  |  |          GROUP BY spo.user_id_
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  |      <select id="queryGoodsNames" resultType="java.util.Map">
 | 
	
	
		
			
				|  | @@ -169,16 +183,48 @@
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <select id="findApplyOrderMusical" resultMap="StudentPaymentOrderDetail">
 | 
	
		
			
				|  |  | -        SELECT * FROM student_payment_order_detail WHERE payment_order_id_ = #{orderId} AND type_ = 'MUSICAL' LIMIT 1
 | 
	
		
			
				|  |  | +        SELECT *
 | 
	
		
			
				|  |  | +        FROM student_payment_order_detail
 | 
	
		
			
				|  |  | +        WHERE payment_order_id_ = #{orderId}
 | 
	
		
			
				|  |  | +          AND type_ = 'MUSICAL'
 | 
	
		
			
				|  |  | +        LIMIT 1
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <select id="getOrderDetail" resultMap="StudentPaymentOrderDetail">
 | 
	
		
			
				|  |  | -        SELECT spod.*,g.id_ goods_id_,g.name_ goods_name_,g.group_purchase_price_,g.discount_price_,g.agree_cost_price_,g.type_ goods_type_ FROM student_payment_order_detail spod
 | 
	
		
			
				|  |  | -                          LEFT JOIN goods g ON FIND_IN_SET(g.id_,spod.goods_id_list_)
 | 
	
		
			
				|  |  | -        WHERE spod.payment_order_id_ = #{orderId} AND spod.goods_id_list_ IS NOT NULL
 | 
	
		
			
				|  |  | +        SELECT spod.*,
 | 
	
		
			
				|  |  | +               g.id_   goods_id_,
 | 
	
		
			
				|  |  | +               g.name_ goods_name_,
 | 
	
		
			
				|  |  | +               g.group_purchase_price_,
 | 
	
		
			
				|  |  | +               g.discount_price_,
 | 
	
		
			
				|  |  | +               g.agree_cost_price_,
 | 
	
		
			
				|  |  | +               g.type_ goods_type_
 | 
	
		
			
				|  |  | +        FROM student_payment_order_detail spod
 | 
	
		
			
				|  |  | +                 LEFT JOIN goods g ON FIND_IN_SET(g.id_, spod.goods_id_list_)
 | 
	
		
			
				|  |  | +        WHERE spod.payment_order_id_ = #{orderId}
 | 
	
		
			
				|  |  | +          AND spod.goods_id_list_ IS NOT NULL
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <select id="getOrderDetailType" resultType="java.lang.String">
 | 
	
		
			
				|  |  | -        SELECT DISTINCT type_ FROM student_payment_order_detail WHERE payment_order_id_ = #{orderId}
 | 
	
		
			
				|  |  | +        SELECT DISTINCT type_
 | 
	
		
			
				|  |  | +        FROM student_payment_order_detail
 | 
	
		
			
				|  |  | +        WHERE payment_order_id_ = #{orderId}
 | 
	
		
			
				|  |  | +    </select>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <select id="getStudentApplyDetail" resultMap="StudentPaymentOrderDetail">
 | 
	
		
			
				|  |  | +        SELECT spod.*,
 | 
	
		
			
				|  |  | +               g.id_   goods_id_,
 | 
	
		
			
				|  |  | +               g.name_ goods_name_,
 | 
	
		
			
				|  |  | +               g.group_purchase_price_,
 | 
	
		
			
				|  |  | +               g.discount_price_,
 | 
	
		
			
				|  |  | +               g.agree_cost_price_,
 | 
	
		
			
				|  |  | +               g.type_ goods_type_
 | 
	
		
			
				|  |  | +        FROM student_payment_order_detail spod
 | 
	
		
			
				|  |  | +                 LEFT JOIN goods g ON FIND_IN_SET(g.id_, spod.goods_id_list_)
 | 
	
		
			
				|  |  | +                 LEFT JOIN student_payment_order spo on spod.payment_order_id_ = spo.id_
 | 
	
		
			
				|  |  | +        WHERE spo.user_id_ = #{studentId}
 | 
	
		
			
				|  |  | +          AND spo.music_group_id_ = #{musicGroupId}
 | 
	
		
			
				|  |  | +          AND spo.status_ = 'SUCCESS'
 | 
	
		
			
				|  |  | +          AND spo.type_ = 'APPLY'
 | 
	
		
			
				|  |  | +          AND spod.type_ IN ('MUSICAL', 'ACCESSORIES', 'TEACHING', 'OTHER', 'COURSE')
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  |  </mapper>
 |