TdCBusinessAcctSourceSMapper.xml 4.43 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.TdCBusinessAcctSourceSMapper">
  <resultMap id="BaseResultMap" type="com.zteits.business.domain.TdCBusinessAcctSource">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="source_bill_id" jdbcType="VARCHAR" property="sourceBillId" />
    <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="acount_name" jdbcType="VARCHAR" property="acountName" />
    <result column="legal_person_name" jdbcType="VARCHAR" property="legalPersonName" />
    <result column="acct_type" jdbcType="INTEGER" property="acctType" />
    <result column="terminal_source" jdbcType="INTEGER" property="terminalSource" />
    <result column="recharge_type" jdbcType="INTEGER" property="rechargeType" />
    <result column="recharge_remark" jdbcType="VARCHAR" property="rechargeRemark" />
    <result column="recharge_fee" jdbcType="DECIMAL" property="rechargeFee" />
    <result column="recharge_balance" jdbcType="DECIMAL" property="rechargeBalance" />
    <result column="recharge_ID" jdbcType="VARCHAR" property="rechargeId" />
    <result column="recharge_name" jdbcType="VARCHAR" property="rechargeName" />
    <result column="recharge_time" jdbcType="TIMESTAMP" property="rechargeTime" />
    <result column="rlt_order_id" jdbcType="VARCHAR" property="rltOrderId" />
    <result column="rlt_payorder_id" jdbcType="VARCHAR" property="rltPayorderId" />
    <result column="pic_path" jdbcType="VARCHAR" property="picPath" />
    <result column="qeual_type" jdbcType="INTEGER" property="qeualType" />
    <result column="examine_state" jdbcType="INTEGER" property="examineState" />
    <result column="examine_date" jdbcType="TIMESTAMP" property="examineDate" />
    <result column="examine_remark" jdbcType="VARCHAR" property="examineRemark" />
    <result column="org_id" jdbcType="BIGINT" property="orgId" />
    <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" />
    <result column="org_name" jdbcType="VARCHAR" property="orgName" />
    <result column="group_no" jdbcType="VARCHAR" property="groupNo" />
  </resultMap>
  <!-- 统计商户端充值记录 -->
  <select id="queryBusinessRechargeFeeStatic" resultType="com.zteits.clouds.api.dto.business.dto.BusinessAcctSourceRechargeStaticDTO"
          parameterType="com.zteits.clouds.api.dto.business.param.TdCBusinessAcctSourceRequest">
    SELECT
    IFNULL( count( CASE WHEN recharge_type IN ( 1, 2, 3 ) THEN recharge_fee END ), 0 ) totalNum,
    IFNULL( sum( CASE WHEN recharge_type IN ( 1, 2, 3 ) THEN recharge_fee END ), 0 ) total,
    IFNULL( count( CASE WHEN recharge_type = 1 THEN recharge_fee END ), 0 ) zfbNum,
    IFNULL( sum( CASE WHEN recharge_type = 1 THEN recharge_fee END ), 0 ) zfb,
    IFNULL( count( CASE WHEN recharge_type = 2 THEN recharge_fee END ), 0 ) wxNum,
    IFNULL( sum( CASE WHEN recharge_type = 2 THEN recharge_fee END ), 0 ) wx,
    IFNULL( count( CASE WHEN recharge_type = 3 THEN recharge_fee END ), 0 ) cashNum,
    IFNULL( sum( CASE WHEN recharge_type = 3 THEN recharge_fee END ), 0 ) cash,
    IFNULL( count( CASE WHEN recharge_type NOT IN ( 1, 2, 3 ) THEN recharge_fee END ), 0 ) otherNum,
    IFNULL( sum( CASE WHEN recharge_type NOT IN ( 1, 2, 3 ) THEN recharge_fee END ), 0 ) other
    FROM
    td_c_business_acct_source
    WHERE
    acct_type = 1 and  data_state=1
    <if test="userPhone != null and userPhone != ''">
      and user_phone = #{userPhone}
    </if>
    <if test="rechargeType != null and rechargeType != ''">
      and recharge_type = #{rechargeType}
    </if>
    <if test="businessName != null and businessName != ''">
      and business_name = #{businessName}
    </if>
    and examine_state = 2
    and org_id=#{orgId}
    and recharge_time &gt;= #{beginDate} AND recharge_time &lt;=#{endDate}
  </select>
</mapper>