wuzeyu
2024-06-12 e9e91d14c9436b29292054e3de0445dbb7d8601c
pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeRefundMapper.xml
@@ -178,4 +178,69 @@
    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>