|
@@ -0,0 +1,126 @@
|
|
|
+<?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.CooperationShareProfitDao">
|
|
|
+
|
|
|
+ <resultMap type="com.ym.mec.biz.dal.entity.CooperationShareProfit" id="CooperationShareProfit">
|
|
|
+ <result column="id_" property="id" />
|
|
|
+ <result column="organ_id_" property="organId" />
|
|
|
+ <result column="cooperation_id_" property="cooperationId" />
|
|
|
+ <result column="music_group_id_" property="musicGroupId" />
|
|
|
+ <result column="musical_num_" property="musicalNum" />
|
|
|
+ <result column="total_amount_" property="totalAmount" />
|
|
|
+ <result column="payment_status_" property="paymentStatus" />
|
|
|
+ <result column="payment_no_" property="paymentNo" />
|
|
|
+ <result column="memo_" property="memo" />
|
|
|
+ <result column="credentials_" property="credentials" />
|
|
|
+ <result column="create_time_" property="createTime" />
|
|
|
+ <result column="update_time_" property="updateTime" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <!-- 根据主键查询一条记录 -->
|
|
|
+ <select id="get" resultMap="CooperationShareProfit" >
|
|
|
+ SELECT * FROM cooperation_share_profit WHERE id_ = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 全查询 -->
|
|
|
+ <select id="findAll" resultMap="CooperationShareProfit">
|
|
|
+ SELECT * FROM cooperation_share_profit ORDER BY id_
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 向数据库增加一条记录 -->
|
|
|
+ <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.CooperationShareProfit" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
|
|
+ INSERT INTO cooperation_share_profit (organ_id_,cooperation_id_,music_group_id_,musical_num_,total_amount_,payment_status_,payment_no_,memo_,create_time_,update_time_)
|
|
|
+ VALUES(#{organId},#{cooperationId},#{musicGroupId},#{musicalNum},#{totalAmount},#{paymentStatus},#{paymentNo},#{memo},NOW(),NOW())
|
|
|
+ </insert>
|
|
|
+ <insert id="batchInsert">
|
|
|
+ INSERT INTO cooperation_share_profit (organ_id_,cooperation_id_,music_group_id_,musical_num_,total_amount_,
|
|
|
+ payment_status_,payment_no_,memo_,create_time_,update_time_)
|
|
|
+ VALUES
|
|
|
+ <foreach collection="profits" item="bean" separator=",">
|
|
|
+ (#{bean.organId},#{bean.cooperationId},#{bean.musicGroupId},#{bean.musicalNum},#{bean.totalAmount},
|
|
|
+ #{bean.paymentStatus},NOW(),NOW())
|
|
|
+ </foreach>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <!-- 根据主键查询一条记录 -->
|
|
|
+ <update id="update" parameterType="com.ym.mec.biz.dal.entity.CooperationShareProfit">
|
|
|
+ UPDATE cooperation_share_profit <set>
|
|
|
+ <if test="paymentNo != null">
|
|
|
+ payment_no_ = #{paymentNo},
|
|
|
+ </if>
|
|
|
+ <if test="paymentStatus != null">
|
|
|
+ payment_status_ = #{paymentStatus},
|
|
|
+ </if>
|
|
|
+ <if test="memo != null">
|
|
|
+ memo_ = #{memo},
|
|
|
+ </if>
|
|
|
+ update_time_ = NOW()
|
|
|
+ </set> WHERE id_ = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <!-- 根据主键删除一条记录 -->
|
|
|
+ <delete id="delete" >
|
|
|
+ DELETE FROM cooperation_share_profit WHERE id_ = #{id}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <!-- 分页查询 -->
|
|
|
+ <select id="queryPage" resultMap="CooperationShareProfit" parameterType="map">
|
|
|
+ SELECT * FROM cooperation_share_profit ORDER BY id_ <include refid="global.limit"/>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 查询当前表的总记录数 -->
|
|
|
+ <select id="queryCount" resultType="int">
|
|
|
+ SELECT COUNT(*) FROM cooperation_share_profit
|
|
|
+ </select>
|
|
|
+ <select id="queryNotShare" resultType="java.lang.String">
|
|
|
+ select music_group_id_ from cooperation_share_profit where music_group_id_ IN
|
|
|
+ <foreach collection="musicGroupIds" item="id" open="(" close=")">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </select>
|
|
|
+ <select id="initShareProfit" resultMap="CooperationShareProfit">
|
|
|
+ select spo.organ_id_,mg.cooperation_organ_id_ cooperation_id_,sr.music_group_id_,COUNT(distinct spod.id_) musical_num_,
|
|
|
+ SUM(CASE WHEN spod.price_ IS NULL THEN 0 ELSE spod.price_ END) total_amount_ from student_registration sr
|
|
|
+ left join music_group mg ON mg.id_ = sr.music_group_id_
|
|
|
+ left join music_group_payment_calender mgpc ON mgpc.id_ = sr.music_group_payment_calender_id_
|
|
|
+ left join student_payment_order spo ON spo.calender_id_ = sr.music_group_payment_calender_id_
|
|
|
+ left join student_payment_order_detail spod ON spod.payment_order_id_ = spo.id_
|
|
|
+ where sr.music_group_status_ = 'NORMAL' AND mgpc.payment_type_ = 'MUSIC_APPLY' AND sr.music_group_id_ IN
|
|
|
+ <foreach collection="musicGroupIds" item="id" open="(" close=")">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ AND spo.type_ = 'APPLY' AND spo.status_ = 'SUCCESS' AND spod.type_ = 'ORGAN_SHARE_PROFIT'
|
|
|
+ </select>
|
|
|
+ <resultMap id="CooperationShareProfitDto" type="com.ym.mec.biz.dal.entity.CooperationShareProfitDto" extends="CooperationShareProfit">
|
|
|
+ <result property="educationUserId" column="education_user_id_"/>
|
|
|
+ <result property="cooperationName" column="cooperation_organ_name_"/>
|
|
|
+ </resultMap>
|
|
|
+ <sql id="queryDtoPageSql">
|
|
|
+ <where>
|
|
|
+ <if test="organId != null and organId != ''">
|
|
|
+ AND FIND_IN_SET(csp.organ_id_,#{organId})
|
|
|
+ </if>
|
|
|
+ <if test="cooperationOrganId != null">
|
|
|
+ AND csp.cooperation_id_ = #{cooperationOrganId}
|
|
|
+ </if>
|
|
|
+ <if test="paymentStatus != null and paymentStatus != ''">
|
|
|
+ AND csp.payment_status_ = #{paymentStatus}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </sql>
|
|
|
+ <select id="countDto" resultType="java.lang.Integer">
|
|
|
+ SELECT COUNT(csp.id_) FROM cooperation_share_profit csp
|
|
|
+ <include refid="queryDtoPageSql"/>
|
|
|
+ </select>
|
|
|
+ <select id="queryDtoPage" resultMap="CooperationShareProfitDto">
|
|
|
+ SELECT csp.*,co.education_user_id_,co.name_ cooperation_organ_name_ FROM cooperation_share_profit csp
|
|
|
+ left join cooperation_organ co ON co.id_ = csp.cooperation_id_
|
|
|
+ <include refid="queryDtoPageSql"/>
|
|
|
+ ORDER BY csp.id_
|
|
|
+ <include refid="global.limit"/>
|
|
|
+ </select>
|
|
|
+</mapper>
|