|
@@ -0,0 +1,169 @@
|
|
|
+<?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.StudentPaymentRouteOrderDao">
|
|
|
+ <resultMap id="StudentPaymentRouteOrder" type="com.ym.mec.biz.dal.entity.StudentPaymentRouteOrder">
|
|
|
+ <!--@mbg.generated-->
|
|
|
+ <!--@Table student_payment_route_order-->
|
|
|
+ <id column="id_" property="id"/>
|
|
|
+ <result column="routing_organ_id_" property="routingOrganId"/>
|
|
|
+ <result column="route_amount_" property="routeAmount"/>
|
|
|
+ <result column="mer_no_" property="merNo"/>
|
|
|
+ <result column="order_id_" property="orderId"/>
|
|
|
+ <result column="memo_" property="memo"/>
|
|
|
+ <result column="create_time_" property="createTime"/>
|
|
|
+ <result column="update_time_" property="updateTime"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <resultMap id="StudentPaymentRouteOrderDto" type="com.ym.mec.biz.dal.dto.StudentPaymentRouteOrderDto"
|
|
|
+ extends="com.ym.mec.biz.dal.dao.StudentPaymentOrderDao.StudentPaymentOrder">
|
|
|
+ <result column="username_" property="user.username"/>
|
|
|
+ <result column="phone_" property="user.phone"/>
|
|
|
+ <result column="routing_organ_id_" property="routingOrganId"/>
|
|
|
+ <result column="route_amount_" property="routeAmount"/>
|
|
|
+ <result column="mer_no_" property="merNo"/>
|
|
|
+ <result column="order_id_" property="orderId"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <sql id="Base_Column_List">
|
|
|
+ <!--@mbg.generated-->
|
|
|
+ id_, routing_organ_id_, route_amount_, mer_no_, order_id_, memo_, create_time_, update_time_
|
|
|
+ </sql>
|
|
|
+ <select id="get" parameterType="java.lang.Long" resultMap="StudentPaymentRouteOrder">
|
|
|
+ <!--@mbg.generated-->
|
|
|
+ select
|
|
|
+ <include refid="Base_Column_List"/>
|
|
|
+ from student_payment_route_order
|
|
|
+ where id_ = #{id}
|
|
|
+ </select>
|
|
|
+ <delete id="delete" parameterType="java.lang.Long">
|
|
|
+ <!--@mbg.generated-->
|
|
|
+ delete from student_payment_route_order
|
|
|
+ where id_ = #{id}
|
|
|
+ </delete>
|
|
|
+ <insert id="insert" keyColumn="id_" keyProperty="id"
|
|
|
+ parameterType="com.ym.mec.biz.dal.entity.StudentPaymentRouteOrder" useGeneratedKeys="true">
|
|
|
+ <!--@mbg.generated-->
|
|
|
+ insert into student_payment_route_order (routing_organ_id_, route_amount_, mer_no_,
|
|
|
+ order_id_, memo_, create_time_,
|
|
|
+ update_time_)
|
|
|
+ values (#{routingOrganId}, #{routeAmount}, #{merNo},
|
|
|
+ #{orderId}, #{memo}, #{createTime},
|
|
|
+ #{updateTime})
|
|
|
+ </insert>
|
|
|
+ <update id="update" parameterType="com.ym.mec.biz.dal.entity.StudentPaymentRouteOrder">
|
|
|
+ <!--@mbg.generated-->
|
|
|
+ update student_payment_route_order
|
|
|
+ <set>
|
|
|
+ <if test="routingOrganId != null">
|
|
|
+ routing_organ_id_ = #{routingOrganId},
|
|
|
+ </if>
|
|
|
+ <if test="routeAmount != null">
|
|
|
+ route_amount_ = #{routeAmount},
|
|
|
+ </if>
|
|
|
+ <if test="merNo != null">
|
|
|
+ mer_no_ = #{merNo},
|
|
|
+ </if>
|
|
|
+ <if test="orderNo != null">
|
|
|
+ order_no_ = #{orderNo},
|
|
|
+ </if>
|
|
|
+ <if test="memo != null">
|
|
|
+ memo_ = #{memo},
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null">
|
|
|
+ create_time_ = #{createTime},
|
|
|
+ </if>
|
|
|
+ <if test="updateTime != null">
|
|
|
+ update_time_ = #{updateTime},
|
|
|
+ </if>
|
|
|
+ </set>
|
|
|
+ where id_ = #{id,jdbcType=BIGINT}
|
|
|
+ </update>
|
|
|
+
|
|
|
+
|
|
|
+ <select id="queryPageOrder" parameterType="map" resultMap="StudentPaymentRouteOrderDto">
|
|
|
+ SELECT spo.*,spro.*,u.username_,u.phone_ FROM student_payment_order spo
|
|
|
+ LEFT JOIN student_payment_route_order spro ON spo.id_ = spro.order_id_
|
|
|
+ left join sys_user u on spo.user_id_ = u.id_
|
|
|
+ <include refid="queryPaymentOrder"/>
|
|
|
+ ORDER BY spo.id_ DESC
|
|
|
+ <include refid="global.limit"/>
|
|
|
+ </select>
|
|
|
+ <select id="getOrderMoneyAmount" parameterType="map" resultMap="StudentPaymentRouteOrderDto">
|
|
|
+ SELECT SUM(spo.expect_amount_) expect_amount_,SUM(actual_amount_) actual_amount_,SUM(balance_payment_amount_)
|
|
|
+ balance_payment_amount_ FROM student_payment_order spo
|
|
|
+ <include refid="queryPaymentOrder"/>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getChargeAmount" parameterType="map" resultType="java.math.BigDecimal">
|
|
|
+ SELECT SUM(actual_amount_) FROM student_payment_order spo
|
|
|
+ LEFT JOIN sporadic_charge_info sci ON spo.music_group_id_ = sci.id_
|
|
|
+ <include refid="queryPaymentOrder"/>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 查询当前表的总记录数 -->
|
|
|
+ <select id="queryCount" resultType="int" parameterType="map">
|
|
|
+ SELECT COUNT(spo.id_) FROM student_payment_order spo
|
|
|
+ LEFT JOIN student_payment_route_order spro ON spo.id_ = spro.order_id_
|
|
|
+ LEFT JOIN sys_user u on spo.user_id_ = u.id_
|
|
|
+ <include refid="queryPaymentOrder"/>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <sql id="queryPaymentOrder">
|
|
|
+ <where>
|
|
|
+ <if test="organId != null">
|
|
|
+ AND FIND_IN_SET(spo.organ_id_,#{organId})
|
|
|
+ </if>
|
|
|
+ <if test="orderStartDate != null">
|
|
|
+ AND DATE_FORMAT(spo.create_time_,'%Y-%m-%d') >= #{orderStartDate}
|
|
|
+ </if>
|
|
|
+ <if test="orderEndDate != null">
|
|
|
+ AND DATE_FORMAT(spo.create_time_,'%Y-%m-%d') <= #{orderEndDate}
|
|
|
+ </if>
|
|
|
+ <if test="paymentType != null">
|
|
|
+ AND spo.type_ = #{paymentType}
|
|
|
+ </if>
|
|
|
+ <if test="remark != null">
|
|
|
+ AND spo.memo_ LIKE CONCAT('%',#{remark},'%')
|
|
|
+ </if>
|
|
|
+ <if test="studentId != null">
|
|
|
+ AND spo.user_id_ = #{studentId}
|
|
|
+ </if>
|
|
|
+ <if test="paymentStatus != null">
|
|
|
+ AND spo.status_ = #{paymentStatus}
|
|
|
+ </if>
|
|
|
+ <if test="paymentChannel != null">
|
|
|
+ AND spo.payment_channel_ NOT IN (#{paymentChannel})
|
|
|
+ </if>
|
|
|
+ <if test='orderType != null and orderType.toString()=="1".toString()'>
|
|
|
+ AND spo.com_amount_ > 0
|
|
|
+ </if>
|
|
|
+ <if test='orderType != null and orderType.toString()=="2".toString()'>
|
|
|
+ AND spo.per_amount_ > 0
|
|
|
+ </if>
|
|
|
+ <if test="routingOrganId != null">
|
|
|
+ AND FIND_IN_SET(spro.routing_organ_id_,#{routingOrganId})
|
|
|
+ </if>
|
|
|
+ <if test="actualAmount != null">
|
|
|
+ AND spo.actual_amount_ >= #{actualAmount}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="balancePaymentAmount != null">
|
|
|
+ AND spo.balance_payment_amount_ >= #{balancePaymentAmount}
|
|
|
+ </if>
|
|
|
+ <if test="orderNo != null">
|
|
|
+ AND spo.order_no_ = #{orderNo}
|
|
|
+ </if>
|
|
|
+ <if test="merNos != null">
|
|
|
+ AND spro.mer_no_ = #{merNos}
|
|
|
+ </if>
|
|
|
+ <if test="transNo != null">
|
|
|
+ AND spo.trans_no_ = #{transNo}
|
|
|
+ </if>
|
|
|
+ <if test="chargeType != null">
|
|
|
+ AND spo.group_type_='SPORADIC'
|
|
|
+ AND sci.charge_type_ = #{chargeType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </sql>
|
|
|
+
|
|
|
+</mapper>
|