liurunyu
3 天以前 1cf88d43994ec7ec403319032a9d118b39fe3571
pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeRefundMapper.xml
@@ -170,4 +170,77 @@
      remarks = #{remarks,jdbcType=VARCHAR}
    where id = #{id,jdbcType=BIGINT}
  </update>
  <!--根据钱包ID获取待审核的退款申请对象-->
  <select id="getRefundByWallerId" parameterType="java.lang.Long" resultMap="BaseResultMap">
    select
        <include refid="Base_Column_List" />
    from se_refund
    where refund_status = 1 AND wallet_id = ${walletId}
  </select>
  <!--根据指定条件获取电子钱包退款记录数-->
  <select id="getRecordCount" parameterType="java.util.Map" resultType="java.lang.Long">
    SELECT
        COUNT(*) AS recordCount
    FROM se_refund ref
        INNER JOIN se_client cli ON ref.client_id = cli.id
    <where>
      <if test = "refundStatus != null and refundStatus > 0">
        AND ref.refund_status = ${refundStatus}
      </if>
      <if test = "clientName != null and clientName !=''">
        AND cli.name like CONCAT('%',#{clientName},'%')
      </if>
    </where>
  </select>
  <!--根据指定条件获取电子钱包退款记录-->
  <select id="getWalletRefunds" resultType="com.dy.pipIrrGlobal.voSe.VoWalletRefund">
    SELECT
        cli.`name`,
        cli.clientNum,
        cli.phone,
        ref.refund_amount AS refundAmount,
        ref.application_time AS applicationTime,
        ref.refund_status AS refundStatus,
        (CASE
            WHEN ref.refund_status = 1 THEN '未退款'
            WHEN ref.refund_status = 2 THEN '已退款'
        End) AS refundStatusName,
        ref.audit_time AS auditTime,
        ref.remarks
    FROM se_refund ref
        INNER JOIN se_client cli ON ref.client_id = cli.id
    <where>
      <if test = "refundStatus != null and refundStatus > 0">
        AND ref.refund_status = ${refundStatus}
      </if>
      <if test = "clientName != null and clientName !=''">
        AND cli.name like CONCAT('%',#{clientName},'%')
      </if>
    </where>
    ORDER BY ref.application_time DESC
    <trim prefix="limit " >
      <if test="start != null and count != null">
        #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER}
      </if>
    </trim>
  </select>
  <!--获取指定日期微信退款(只计算已退的)总额,财务对账审核页使用-->
  <select id="getRefundSum" resultType="java.lang.Double">
    SELECT
        SUM(refund_amount) AS tradeAmount
    FROM se_refund
    <where>
      AND refund_status = 2
      <if test = "tradeDate != null and tradeDate !=''">
        AND Date(audit_time) = #{tradeDate}
      </if>
    </where>
    GROUP BY Date(audit_time)
  </select>
</mapper>