123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492 |
- <?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.MusicGroupPaymentCalenderDao">
- <resultMap type="com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender" id="MusicGroupPaymentCalender">
- <result column="id_" property="id"/>
- <result column="music_group_id_" property="musicGroupId"/>
- <result column="music_group_organization_course_settings_id_" property="musicGroupOrganizationCourseSettingId"/>
- <result column="pay_user_type_" property="payUserType" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
- <result column="start_payment_date_" property="startPaymentDate"/>
- <result column="deadline_payment_date_" property="deadlinePaymentDate"/>
- <result column="status_" property="status" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
- <result column="expect_num_" property="expectNum"/>
- <result column="actual_num_" property="actualNum"/>
- <result column="memo_" property="memo"/>
- <result column="audit_memo_" property="auditMemo"/>
- <result column="reject_reason_" property="rejectReason"/>
- <result column="is_give_music_network_" property="isGiveMusicNetwork"/>
- <result column="create_time_" property="createTime"/>
- <result column="update_time_" property="updateTime"/>
- <result column="payment_valid_start_date_" property="paymentValidStartDate"/>
- <result column="payment_valid_end_date_" property="paymentValidEndDate"/>
- <result column="payment_pattern_" property="paymentPattern"/>
- <result column="payment_type_" property="paymentType" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
- <result column="batch_no_" property="batchNo"/>
- <result column="payment_amount_" property="paymentAmount"/>
- <result column="attribute1_" property="attribute1"/>
- <result column="attribute2_" property="attribute2"/>
- </resultMap>
- <!-- 根据主键查询一条记录 -->
- <select id="get" resultMap="MusicGroupPaymentCalender">
- SELECT * FROM music_group_payment_calender WHERE id_ = #{id}
- </select>
- <!-- 全查询 -->
- <select id="findAll" resultMap="MusicGroupPaymentCalender">
- SELECT * FROM music_group_payment_calender ORDER BY id_
- </select>
- <!-- 向数据库增加一条记录 -->
- <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender" useGeneratedKeys="true"
- keyColumn="id_" keyProperty="id">
- INSERT INTO music_group_payment_calender
- (music_group_id_,music_group_organization_course_settings_id_,pay_user_type_,reject_reason_,start_payment_date_,deadline_payment_date_,status_,expect_num_,
- actual_num_,memo_,is_give_music_network_,create_time_,update_time_,payment_valid_start_date_,payment_valid_end_date_,
- payment_pattern_,payment_type_,payment_amount_,batch_no_,audit_memo_,operator_,attribute1_,attribute2_)
- VALUES(#{musicGroupId},#{musicGroupOrganizationCourseSettingId},#{payUserType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
- #{rejectReason},#{startPaymentDate},#{deadlinePaymentDate},#{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
- #{expectNum},#{actualNum},#{memo},#{isGiveMusicNetwork},now(),now(),
- #{paymentValidStartDate},#{paymentValidEndDate},#{paymentPattern},#{paymentType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
- #{paymentAmount},#{batchNo},#{auditMemo},#{operator},#{attribute1},#{attribute2})
- </insert>
- <insert id="batchInsert" parameterType="com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender" useGeneratedKeys="true"
- keyColumn="id_" keyProperty="id">
- INSERT INTO music_group_payment_calender
- (music_group_id_,music_group_organization_course_settings_id_,pay_user_type_,reject_reason_,start_payment_date_,deadline_payment_date_,status_,expect_num_,
- actual_num_,memo_,is_give_music_network_,create_time_,update_time_,payment_valid_start_date_,payment_valid_end_date_,payment_pattern_,payment_amount_,
- payment_type_,batch_no_,audit_memo_,operator_,attribute1_,attribute2_)
- VALUES
- <foreach collection="list" item="item" index="index" separator=",">
- (#{item.musicGroupId},#{item.musicGroupOrganizationCourseSettingId},#{item.payUserType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{item.rejectReason},#{item.startPaymentDate},#{item.deadlinePaymentDate},#{item.status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
- #{item.expectNum},#{item.actualNum},#{item.memo},#{item.isGiveMusicNetwork},now(),now(),
- #{item.paymentValidStartDate},#{item.paymentValidEndDate},#{item.paymentPattern},#{item.paymentAmount},#{item.paymentType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
- #{item.batchNo},#{item.auditMemo},#{item.operator},#{item.attribute1},#{item.attribute2})
- </foreach>
- </insert>
- <!-- 根据主键查询一条记录 -->
- <update id="update" parameterType="com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender">
- UPDATE music_group_payment_calender
- <set>
- <if test="auditMemo != null and auditMemo != ''">
- audit_memo_ = #{auditMemo},
- </if>
- <if test="paymentType != null">
- payment_type_ = #{paymentType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
- </if>
- <if test="paymentValidStartDate != null">
- payment_valid_start_date_ = #{paymentValidStartDate},
- payment_valid_end_date_ = #{paymentValidEndDate},
- </if>
- <if test="paymentPattern != null">
- payment_pattern_ = #{paymentPattern},
- </if>
- <if test="isGiveMusicNetwork != null">
- is_give_music_network_ = #{isGiveMusicNetwork},
- </if>
- <if test="deadlinePaymentDate != null">
- deadline_payment_date_ = #{deadlinePaymentDate},
- </if>
- <if test="status != null">
- status_ = #{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
- </if>
- <if test="expectNum != null">
- expect_num_ = #{expectNum},
- </if>
- <if test="actualNum != null">
- actual_num_ = #{actualNum},
- </if>
- <if test="memo != null">
- memo_ = #{memo},
- </if>
- <if test="startPaymentDate != null">
- start_payment_date_ = #{startPaymentDate},
- </if>
- <if test="musicGroupOrganizationCourseSettingId != null">
- music_group_organization_course_settings_id_ = #{musicGroupOrganizationCourseSettingId},
- </if>
- <if test="payUserType != null">
- pay_user_type_ = #{payUserType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
- </if>
- <if test="rejectReason != null">
- reject_reason_ = #{rejectReason},
- </if>
- <if test="updateTime != null">
- update_time_ = NOW(),
- </if>
- <if test="musicGroupId != null">
- music_group_id_ = #{musicGroupId},
- </if>
- <if test="batchNo != null">
- batch_no_ = #{batchNo},
- </if>
- <if test="paymentAmount != null">
- payment_amount_ = #{paymentAmount},
- </if>
- <if test="attribute1 != null">
- attribute1_ = #{attribute1},
- </if>
- <if test="attribute2 != null">
- attribute2_ = #{attribute2},
- </if>
- </set>
- WHERE id_ = #{id}
- </update>
-
- <update id="batchUpdate" parameterType="com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender">
- <foreach collection="list" item="item" index="index" open="" close="" separator=";">
- UPDATE music_group_payment_calender
- <set>
- <if test="item.paymentPattern != null">
- payment_pattern_ = #{item.paymentPattern},
- </if>
- <if test="item.isGiveMusicNetwork != null">
- is_give_music_network_ = #{item.isGiveMusicNetwork},
- </if>
- <if test="item.deadlinePaymentDate != null">
- deadline_payment_date_ = #{item.deadlinePaymentDate},
- </if>
- <if test="item.status != null">
- status_ = #{item.status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
- </if>
- <if test="item.expectNum != null">
- expect_num_ = #{item.expectNum},
- </if>
- <if test="item.actualNum != null">
- actual_num_ = #{item.actualNum},
- </if>
- <if test="item.memo != null">
- memo_ = #{item.memo},
- </if>
- <if test="item.startPaymentDate != null">
- start_payment_date_ = #{item.startPaymentDate},
- </if>
- <if test="item.musicGroupOrganizationCourseSettingId != null">
- music_group_organization_course_settings_id_ = #{item.musicGroupOrganizationCourseSettingId},
- </if>
- <if test="item.payUserType != null">
- pay_user_type_ = #{item.payUserType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
- </if>
- <if test="item.rejectReason != null">
- reject_reason_ = #{item.rejectReason},
- </if>
- <if test="item.updateTime != null">
- update_time_ = NOW(),
- </if>
- <if test="item.musicGroupId != null">
- music_group_id_ = #{item.musicGroupId},
- </if>
- <if test="item.batchNo != null">
- batch_no_ = #{item.batchNo},
- </if>
- <if test="item.paymentAmount != null">
- payment_amount_ = #{item.paymentAmount},
- </if>
- <if test="item.attribute1 != null">
- attribute1_ = #{item.attribute1},
- </if>
- <if test="item.attribute2 != null">
- attribute2_ = #{item.attribute2},
- </if>
- </set>
- WHERE id_ = #{item.id}
- </foreach>
- </update>
- <!-- 根据主键删除一条记录 -->
- <delete id="delete">
- DELETE FROM music_group_payment_calender WHERE id_ = #{id}
- </delete>
- <delete id="delByGroupId">
- DELETE FROM music_group_payment_calender WHERE music_group_id_ = #{musicGroupId}
- </delete>
- <!-- 分页查询 -->
- <select id="queryPage" resultMap="MusicGroupPaymentCalender" parameterType="map">
- SELECT * FROM music_group_payment_calender mgpc
- <where>
- <if test="musicGroupId != null">
- and mgpc.music_group_id_ = #{musicGroupId}
- </if>
- <if test="payUserType != null">
- and mgpc.pay_user_type_ = #{payUserType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
- </if>
- <if test="status != null">
- and mgpc.status_ = #{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
- </if>
- </where>
- ORDER BY mgpc.payment_valid_start_date_ DESC
- <include refid="global.limit"/>
- </select>
- <!-- 查询当前表的总记录数 -->
- <select id="queryCount" resultType="int">
- SELECT COUNT(mgpc.id_) FROM music_group_payment_calender mgpc
- <where>
- <if test="musicGroupId != null">
- and mgpc.music_group_id_ = #{musicGroupId}
- </if>
- <if test="payUserType != null">
- and mgpc.pay_user_type_ = #{payUserType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
- </if>
- <if test="status != null">
- and mgpc.status_ = #{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
- </if>
- </where>
- </select>
-
- <select id="findByMusicGroupId" resultMap="MusicGroupPaymentCalender">
- SELECT * FROM music_group_payment_calender mgpc
- WHERE music_group_id_ = #{musicGroupId}
- ORDER BY id_
- </select>
-
- <select id="queryByPaymentStatus" resultMap="MusicGroupPaymentCalender">
- SELECT * FROM music_group_payment_calender mgpc
- <where>
- <if test="status != null">
- status_ in
- <foreach collection="status" item="item" open="(" close=")" separator=",">
- #{item,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
- </foreach>
- </if>
- <if test="payUserType != null">
- AND pay_user_type_ = #{payUserType}
- </if>
- </where>
- </select>
- <select id="getForLock" resultMap="MusicGroupPaymentCalender">
- SELECT * FROM music_group_payment_calender WHERE id_ = #{id} FOR UPDATE
- </select>
-
- <select id="queryIntersectionByPaymentDate" resultType="int" parameterType="map">
- SELECT count(*) FROM music_group_payment_calender mgpc
- WHERE music_group_id_ = #{musicGroupId}
- and (start_payment_date_ between #{startPaymentDate} and #{deadlinePaymentDate}
- or deadline_payment_date_ between #{startPaymentDate} and #{deadlinePaymentDate})
- <if test="calenderId != null">
- AND mgpc.id_ != #{calenderId}
- </if>
- </select>
-
- <select id="getLastStartOne" resultMap="MusicGroupPaymentCalender">
- SELECT * FROM music_group_payment_calender WHERE music_group_id_ = #{musicGroupId} ORDER BY start_payment_date_ DESC LIMIT 1
- </select>
- <select id="queryIntersectionByDate" resultType="java.lang.Integer">
- SELECT COUNT(DISTINCT mgpcd.id_) FROM music_group_payment_calender mgpc
- LEFT JOIN music_group_payment_calender_detail mgpcd ON mgpc.id_ = mgpcd.music_group_payment_calender_id_
- WHERE mgpc.music_group_id_ = #{musicGroupId} AND mgpcd.payment_status_ != 'PAID_COMPLETED'
- AND (DATE_FORMAT(mgpcd.start_payment_date_,'%Y-%m-%d') between #{startTime} AND #{endTime}
- OR DATE_FORMAT(mgpcd.deadline_payment_date_,'%Y-%m-%d') between #{startTime} AND #{endTime})
- </select>
- <select id="queryIntersectionByValidDate" resultType="java.lang.Integer">
- SELECT COUNT(*) FROM music_group_payment_calender mgpc
- WHERE music_group_id_ = #{musicGroupId}
- AND (payment_valid_end_date_ IS NULL OR payment_valid_start_date_ BETWEEN #{paymentValidStartDate} AND #{paymentValidEndDate}
- OR payment_valid_end_date_ BETWEEN #{paymentValidStartDate} AND #{paymentValidEndDate}) AND payment_valid_start_date_ IS NOT NULL
- <if test="payUserType != null">
- and pay_user_type_ = #{payUserType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
- </if>
- <if test="calenderId != null">
- AND mgpc.id_ != #{calenderId}
- </if>
- </select>
- <select id="queryCalenderByDay" resultType="java.util.Map">
- SELECT mgpcd.music_group_payment_calender_id_ 'key',COUNT(mgpcd.payment_status_) 'value'
- FROM music_group_payment_calender_detail mgpcd
- WHERE mgpcd.music_group_payment_calender_id_ IN
- (SELECT id_ FROM music_group_payment_calender WHERE status_ != 0
- AND DATEDIFF(#{format},DATE_FORMAT(start_payment_date_,'%Y-%m-%d')) = #{configValue})
- AND mgpcd.payment_status_ = 'NON_PAYMENT'
- GROUP BY mgpcd.music_group_payment_calender_id_
- </select>
- <select id="queryByIds" resultMap="MusicGroupPaymentCalender">
- SELECT * FROM music_group_payment_calender WHERE id_ IN
- <foreach collection="calenderId" open="(" close=")" item="item" separator=",">
- #{item}
- </foreach>
- </select>
- <select id="queryEndIds" resultType="java.lang.Long">
- SELECT DISTINCT mgpc.id_ FROM music_group_payment_calender mgpc
- WHERE mgpc.payment_valid_end_date_ IS NOT NULL AND DATEDIFF(mgpc.payment_valid_end_date_,#{format}) = #{configValue} AND mgpc.payment_type_ IN ('MUSIC_APPLY','MUSIC_RENEW')
- </select>
- <resultMap id="CalenderPushDto" type="com.ym.mec.biz.dal.dto.CalenderPushDto">
- <result property="paymentValidEndDate" column="payment_valid_end_date_"/>
- <result property="paymentValidStartDate" column="payment_valid_start_date_"/>
- <result property="teacherId" column="educational_teacher_id_"/>
- <result property="musicGroupName" column="name_"/>
- <result property="teacherPhone" column="phone_"/>
- <result property="calenderId" column="id_"/>
- </resultMap>
- <select id="getCalenderPushDto" resultMap="CalenderPushDto">
- SELECT mgpc.id_,mgpc.payment_valid_start_date_,mgpc.payment_valid_end_date_,
- mg.educational_teacher_id_,mg.name_,su.phone_
- FROM music_group_payment_calender mgpc
- LEFT JOIN music_group mg ON mgpc.music_group_id_ = mg.id_
- LEFT JOIN sys_user su ON su.id_ = mg.educational_teacher_id_
- WHERE mgpc.id_ IN
- <foreach collection="calenderIds" open="(" close=")" separator="," item="item">
- #{item}
- </foreach>
- </select>
- <select id="getMusicCalenderPushDto" resultMap="CalenderPushDto">
- SELECT mg.payment_valid_start_date_,mg.payment_valid_end_date_,
- mg.educational_teacher_id_,su.phone_,mg.name_ FROM music_group mg
- LEFT JOIN sys_user su ON mg.educational_teacher_id_ = su.id_
- WHERE mg.payment_valid_end_date_ IS NOT NULL AND
- DATEDIFF(mg.payment_valid_end_date_,#{format}) = #{configValue}
- </select>
- <select id="getMusicGroupUnusedFirstPaymentCalender" resultMap="MusicGroupPaymentCalender">
- SELECT
- mgpc.*
- FROM
- music_group_payment_calender_detail mgpcd
- LEFT JOIN music_group_payment_calender mgpc ON mgpcd.music_group_payment_calender_id_ = mgpc.id_
- LEFT JOIN music_group_payment_calender_course_settings mgpccs ON mgpc.id_ = mgpccs.music_group_payment_calender_id_
- WHERE
- mgpcd.music_group_payment_calender_id_ = mgpccs.music_group_payment_calender_id_
- AND mgpc.music_group_id_ = #{musicGroupId}
- AND mgpcd.use_in_course_ = 0
- AND mgpcd.user_id_ IN
- <foreach collection="studentIds" item="studentId" open="(" close=")" separator=",">
- #{studentId}
- </foreach>
- ORDER BY
- mgpc.payment_valid_start_date_
- LIMIT 1;
- </select>
- <select id="getUnusedFirstPaymentCalenderWithCalenders" resultMap="MusicGroupPaymentCalender">
- SELECT * FROM music_group_payment_calender mgpc
- WHERE id_ IN
- <foreach collection="calenderIds" item="calenderId" open="(" close=")" separator=",">
- #{calenderId}
- </foreach>
- ORDER BY create_time_ LIMIT 1;
- </select>
- <select id="findByBatchNo" resultMap="MusicGroupPaymentCalender">
- SELECT * FROM music_group_payment_calender WHERE batch_no_=#{batchNo}
- </select>
- <resultMap id="MusicGroupPaymentCalenderAuditDtoMap" type="com.ym.mec.biz.dal.dto.MusicGroupPaymentCalenderAuditDto">
- <result property="musicGroupId" column="music_group_id_"/>
- <result property="musicGroupName" column="music_group_name_"/>
- <result property="organId" column="organ_id_"/>
- <result property="createTime" column="create_time_"/>
- <result property="paymentType" column="payment_type_"/>
- <result property="memo" column="memo_"/>
- <result property="operator" column="operator_"/>
- <result property="auditStatus" column="status_"/>
- <result property="addCourseTotalTime" column="course_total_minuties_"/>
- <result property="courseCurrentPrice" column="course_current_price_"/>
- <result property="courseOriginalPrice" column="course_original_price_"/>
- <result property="musicGroupPaymentCalenderId" column="id_"/>
- <result property="payUserType" column="pay_user_type_"/>
- <result property="calenderSettingsName" column="calender_settings_name_"/>
- <result property="paymentPattern" column="payment_pattern_"/>
- <result property="paymentValidStartDate" column="payment_valid_start_date_"/>
- <result property="paymentValidEndDate" column="payment_valid_end_date_"/>
- <result property="startPaymentDate" column="start_payment_date_"/>
- <result property="deadlinePaymentDate" column="deadline_payment_date_"/>
- <result property="auditMemo" column="audit_memo_"/>
- <result property="paymentAmount" column="payment_amount_"/>
- <result property="isGiveMusicNetwork" column="is_give_music_network_"/>
- </resultMap>
- <sql id="MusicGroupPaymentCalenderAuditDtoSql">
- <where>
- <if test="paymentType != null">
- AND mgpc.payment_type_ = #{paymentType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
- </if>
- <if test="status != null">
- AND mgpc.status_ = #{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
- </if>
- <if test="organId != null and organId != ''">
- AND FIND_IN_SET(mg.organ_id_,#{organId})
- </if>
- <if test="search != null and search != ''">
- AND (mg.id_ LIKE CONCAT('%',#{search},'%') OR mg.name_ LIKE CONCAT('%',#{search},'%'))
- </if>
- </where>
- </sql>
- <select id="countAuditList" resultType="java.lang.Integer">
- SELECT COUNT(DISTINCT mgpc.id_)
- FROM music_group_payment_calender mgpc
- LEFT JOIN music_group mg ON mg.id_ = mgpc.music_group_id_
- <include refid="MusicGroupPaymentCalenderAuditDtoSql"/>
- </select>
- <select id="queryAuditList" resultMap="MusicGroupPaymentCalenderAuditDtoMap">
- SELECT mgpc.id_,mgpc.music_group_id_,mgpc.create_time_,mgpc.payment_type_,mgpc.operator_,
- mgpc.pay_user_type_,mgpc.memo_,mgpc.status_,SUM(mgpccs.course_total_minuties_) course_total_minuties_,
- SUM(mgpccs.course_original_price_) course_original_price_,SUM(mgpccs.course_current_price_) course_current_price_,
- MAX(mg.name_) music_group_name_,MAX(mg.organ_id_) organ_id_,mgpc.payment_pattern_
- FROM music_group_payment_calender mgpc
- LEFT JOIN music_group mg ON mg.id_ = mgpc.music_group_id_
- LEFT JOIN music_group_payment_calender_course_settings mgpccs ON mgpc.id_ = mgpccs.music_group_payment_calender_id_
- <include refid="MusicGroupPaymentCalenderAuditDtoSql"/>
- GROUP BY mgpc.id_
- ORDER BY create_time_ DESC
- <include refid="global.limit"/>
- </select>
- <select id="countExpectNum" resultType="java.util.Map">
- SELECT mgpcd.music_group_payment_calender_id_ 'key',COUNT(DISTINCT mgpcd.user_id_) 'value' FROM music_group_payment_calender_detail mgpcd
- WHERE mgpcd.music_group_payment_calender_id_ = #{id}
- GROUP BY mgpcd.music_group_payment_calender_id_
- </select>
- <select id="countActualNum" resultType="java.util.Map">
- SELECT mgpcd.music_group_payment_calender_id_ 'key',COUNT(DISTINCT mgpcd.user_id_) 'value' FROM music_group_payment_calender_detail mgpcd
- WHERE mgpcd.music_group_payment_calender_id_ = #{id}
- AND mgpcd.payment_status_ = 'PAID_COMPLETED'
- GROUP BY mgpcd.music_group_payment_calender_id_
- </select>
- <select id="getAuditDetail" resultMap="MusicGroupPaymentCalenderAuditDtoMap">
- SELECT mgpc.id_,mgpc.music_group_id_,mgpc.create_time_,mgpc.payment_type_,mgpc.operator_,
- mgpc.pay_user_type_,mgpc.memo_,mgpc.status_,SUM(mgpccs.course_total_minuties_) course_total_minuties_,
- SUM(mgpccs.course_original_price_) course_original_price_,SUM(mgpccs.course_current_price_) course_current_price_,
- MAX(mg.name_) music_group_name_,MAX(mg.organ_id_) organ_id_,MAX(mgpccs.name_) calender_settings_name_,mgpc.payment_pattern_,mgpc.payment_valid_start_date_,
- mgpc.payment_valid_end_date_,mgpc.start_payment_date_,mgpc.deadline_payment_date_,mgpc.audit_memo_,mgpc.payment_amount_,mgpc.is_give_music_network_
- FROM music_group_payment_calender mgpc
- LEFT JOIN music_group mg ON mg.id_ = mgpc.music_group_id_
- LEFT JOIN music_group_payment_calender_course_settings mgpccs ON mgpc.id_ = mgpccs.music_group_payment_calender_id_
- WHERE mgpc.id_ = #{calenderId} LIMIT 1
- </select>
- <select id="findByMusicGroupRegCalender" resultMap="MusicGroupPaymentCalender">
- SELECT * FROM music_group_payment_calender WHERE music_group_id_=#{musicGroupId} AND payment_type_='MUSIC_APPLY'
- </select>
- <select id="getCalenderSettingsName" resultType="java.lang.String">
- SELECT name_ FROM music_group_payment_calender_course_settings
- WHERE music_group_payment_calender_id_ = #{calenderId} LIMIT 1
- </select>
- <select id="countAuditReject" resultType="java.lang.Integer">
- SELECT COUNT(0) FROM music_group_payment_calender
- WHERE music_group_id_ = #{musicGroupId} AND payment_type_='MUSIC_APPLY' AND status_ IN ('REJECT','AUDITING')
- <if test="calenderId != null">
- AND id_ != #{calenderId}
- </if>
- </select>
- <select id="getMusicGroupRegCalender" resultMap="MusicGroupPaymentCalender">
- SELECT * FROM music_group_payment_calender
- WHERE music_group_id_ = #{musicGroupId}
- AND payment_type_ = 'MUSIC_APPLY'
- AND pay_user_type_='STUDENT'
- AND status_='OPEN'
- </select>
- <select id="queryUserPaymentStatus" resultType="java.util.Map">
- SELECT mg.id_ 'key',CASE WHEN COUNT(mgpc.id_) = 0 OR COUNT(DISTINCT mgpcd.id_) > 0 THEN 'NON_PAYMENT' ELSE 'PAID_COMPLETED' END 'value'
- FROM music_group mg
- LEFT JOIN music_group_payment_calender mgpc ON mgpc.music_group_id_ = mg.id_
- LEFT JOIN music_group_payment_calender_detail mgpcd ON mgpc.id_ = mgpcd.music_group_payment_calender_id_
- AND mgpcd.user_id_ = #{userId} AND mgpcd.payment_status_ = 'NON_PAYMENT'
- WHERE FIND_IN_SET(mg.id_,#{musicGroupId})
- GROUP BY mg.id_
- </select>
- </mapper>
|