TdCBusinessAcctPayoutSMapper.xml 3.6 KB
<?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.zteits.business.mapper.smapper.TdCBusinessAcctPayoutSMapper">
  <resultMap id="BaseResultMap" type="com.zteits.business.domain.TdCBusinessAcctPayout">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="payout_bill_id" jdbcType="VARCHAR" property="payoutBillId" />
    <result column="acct_id" jdbcType="VARCHAR" property="acctId" />
    <result column="business_id" jdbcType="VARCHAR" property="businessId" />
    <result column="business_name" jdbcType="VARCHAR" property="businessName" />
    <result column="user_phone" jdbcType="VARCHAR" property="userPhone" />
    <result column="acct_type" jdbcType="INTEGER" property="acctType" />
    <result column="trade_type" jdbcType="INTEGER" property="tradeType" />
    <result column="trade_detial_type" jdbcType="INTEGER" property="tradeDetialType" />
    <result column="trade_fee" jdbcType="DECIMAL" property="tradeFee" />
    <result column="trade_balance" jdbcType="DECIMAL" property="tradeBalance" />
    <result column="trader_id" jdbcType="VARCHAR" property="traderId" />
    <result column="trader_name" jdbcType="VARCHAR" property="traderName" />
    <result column="trade_time" jdbcType="TIMESTAMP" property="tradeTime" />
    <result column="rlt_payorder_id" jdbcType="VARCHAR" property="rltPayorderId" />
    <result column="rlt_order_id" jdbcType="VARCHAR" property="rltOrderId" />
    <result column="rlt_order_type" jdbcType="VARCHAR" property="rltOrderType" />
    <result column="org_id" jdbcType="BIGINT" property="orgId" />
    <result column="org_name" jdbcType="VARCHAR" property="orgName" />
    <result column="data_state" jdbcType="INTEGER" property="dataState" />
    <result column="create_empid" jdbcType="VARCHAR" property="createEmpid" />
    <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
    <result column="modfiy_empid" jdbcType="VARCHAR" property="modfiyEmpid" />
    <result column="modfiy_date" jdbcType="TIMESTAMP" property="modfiyDate" />
  </resultMap>
  <!-- 统计商户端充值记录 -->
  <select id="queryBusinessPayoutFeeStatic" resultType="com.zteits.clouds.api.dto.business.dto.BusinessAcctPayoutStaticDTO"
          parameterType="com.zteits.clouds.api.dto.business.param.TdCBusinessAcctPayoutRequest">
    SELECT
    IFNULL( count( CASE WHEN trade_type IN ( 1, 2 ) THEN trade_fee END ), 0 ) totalNum,
    IFNULL( sum( CASE WHEN trade_type IN ( 1, 2 ) THEN trade_fee END ), 0 ) total,
    IFNULL( count( CASE WHEN trade_type = 1 THEN trade_fee END ), 0 ) cardNum,
    IFNULL( sum( CASE WHEN trade_type = 1 THEN trade_fee END ), 0 ) cardFee,
    IFNULL( count( CASE WHEN trade_type = 2 THEN trade_fee END ), 0 ) parkNum	,
    IFNULL( sum( CASE WHEN trade_type = 2 THEN trade_fee END ), 0 ) parkFee,
    IFNULL( count( CASE WHEN trade_type NOT IN ( 1, 2 ) THEN trade_fee END ), 0 ) otherNum,
    IFNULL( sum( CASE WHEN trade_type NOT IN ( 1, 2 ) THEN trade_fee END ), 0 ) other
    FROM
    td_c_business_acct_payout
    WHERE
    acct_type = 1 and  data_state=1
    <if test="userPhone != null and userPhone != ''">
      and user_phone = #{userPhone}
    </if>
    <if test="tradeType != null and tradeType != ''">
      and trade_type = #{tradeType }
    </if>
    <if test="businessName != null and businessName != ''">
      and business_name = #{businessName}
    </if>
    <if test="plNo != null and plNo != ''">
      and pl_no = #{plNo}
    </if>
    and org_id=#{orgId}
    and trade_time &gt;= #{beginDate} AND trade_time &lt;=#{endDate}
  </select>
</mapper>