<?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.slodon.b2b2c.dao.read.member.MemberApplyCashReadMapper">
  <resultMap id="resultMap" type="com.slodon.b2b2c.member.pojo.MemberApplyCash">
    <id column="cash_id" property="cashId" />
    <result column="member_id" property="memberId" />
    <result column="member_name" property="memberName" />
    <result column="cash_sn" property="cashSn" />
    <result column="cash_amount" property="cashAmount" />
    <result column="apply_time" property="applyTime" />
    <result column="auditing_time" property="auditingTime" />
    <result column="pay_time" property="payTime" />
    <result column="pay_account" property="payAccount" />
    <result column="receive_bank" property="receiveBank" />
    <result column="receive_account" property="receiveAccount" />
    <result column="receive_name" property="receiveName" />
    <result column="receive_type" property="receiveType" />
    <result column="state" property="state" />
    <result column="fail_reason" property="failReason" />
    <result column="admin_id" property="adminId" />
    <result column="admin_name" property="adminName" />
    <result column="service_fee" property="serviceFee" />
    <result column="transaction_sn" property="transactionSn" />
  </resultMap>
  <!--按照主键值进行操作-->
  <sql id="pkWhere">
    WHERE `cash_id` = #{primaryKey}
  </sql>
  <!--操作条件-->
  <sql id="whereCondition">
    <if test="example != null">
      <trim prefix="WHERE" prefixOverrides="AND|OR">
        <if test="example.cashIdNotEquals != null">
          AND `cash_id` != #{example.cashIdNotEquals}
        </if>
        <if test="example.cashIdIn != null">
          AND `cash_id` in (${example.cashIdIn})
        </if>
        <if test="example.memberId != null">
          AND `member_id` = #{example.memberId}
        </if>
        <if test="example.memberName != null">
          AND `member_name` = #{example.memberName}
        </if>
        <if test="example.memberNameLike != null">
          AND `member_name` like concat('%',#{example.memberNameLike},'%')
        </if>
        <if test="example.cashSn != null">
          AND `cash_sn` = #{example.cashSn}
        </if>
        <if test="example.cashSnLike != null">
          AND `cash_sn` like concat('%',#{example.cashSnLike},'%')
        </if>
        <if test="example.cashAmount != null">
          AND `cash_amount` = #{example.cashAmount}
        </if>
        <if test="example.applyTimeAfter != null">
          AND `apply_time` <![CDATA[ >= ]]> #{example.applyTimeAfter}
        </if>
        <if test="example.applyTimeBefore != null">
          AND `apply_time` <![CDATA[ <= ]]> #{example.applyTimeBefore}
        </if>
        <if test="example.auditingTimeAfter != null">
          AND `auditing_time` <![CDATA[ >= ]]> #{example.auditingTimeAfter}
        </if>
        <if test="example.auditingTimeBefore != null">
          AND `auditing_time` <![CDATA[ <= ]]> #{example.auditingTimeBefore}
        </if>
        <if test="example.payTimeAfter != null">
          AND `pay_time` <![CDATA[ >= ]]> #{example.payTimeAfter}
        </if>
        <if test="example.payTimeBefore != null">
          AND `pay_time` <![CDATA[ <= ]]> #{example.payTimeBefore}
        </if>
        <if test="example.payAccount != null">
          AND `pay_account` = #{example.payAccount}
        </if>
        <if test="example.receiveBank != null">
          AND `receive_bank` = #{example.receiveBank}
        </if>
        <if test="example.receiveAccount != null">
          AND `receive_account` = #{example.receiveAccount}
        </if>
        <if test="example.receiveName != null">
          AND `receive_name` = #{example.receiveName}
        </if>
        <if test="example.receiveNameLike != null">
          AND `receive_name` like concat('%',#{example.receiveNameLike},'%')
        </if>
        <if test="example.receiveType != null">
          AND `receive_type` = #{example.receiveType}
        </if>
        <if test="example.state != null">
          AND `state` = #{example.state}
        </if>
        <if test="example.failReason != null">
          AND `fail_reason` = #{example.failReason}
        </if>
        <if test="example.failReasonLike != null">
          AND `fail_reason` like concat('%',#{example.failReasonLike},'%')
        </if>
        <if test="example.adminId != null">
          AND `admin_id` = #{example.adminId}
        </if>
        <if test="example.adminName != null">
          AND `admin_name` = #{example.adminName}
        </if>
        <if test="example.adminNameLike != null">
          AND `admin_name` like concat('%',#{example.adminNameLike},'%')
        </if>
        <if test="example.serviceFee != null">
          AND `service_fee` = #{example.serviceFee}
        </if>
        <if test="example.transactionSn != null">
          AND `transaction_sn` = #{example.transactionSn}
        </if>
        <if test="example.transactionSnLike != null">
          AND `transaction_sn` like concat('%',#{example.transactionSnLike},'%')
        </if>
      </trim>
    </if>
  </sql>
  <!--排序条件-->
  <sql id="orderBy">
    ORDER BY `cash_id` DESC
  </sql>
  <sql id="orderByOther">
    order by ${example.orderBy}
  </sql>
  <!--分组条件-->
  <sql id="groupBy">
    group by ${example.groupBy}
  </sql>
  <!--分页条件-->
  <sql id="limit">
    <if test="size != null and size &gt; 0">
      limit #{startRow},#{size}
    </if>
  </sql>
  <!--查询符合条件的记录数-->
  <select id="countByExample" parameterType="com.slodon.b2b2c.member.example.MemberApplyCashExample" resultType="java.lang.Integer">
    SELECT
      COUNT(*)
    FROM `member_apply_cash`
    <include refid="whereCondition" />
  </select>
  <!--根据主键查询记录-->
  <select id="getByPrimaryKey" resultMap="resultMap">
    SELECT
      *
    FROM `member_apply_cash`
    <include refid="pkWhere" />
  </select>
  <!--查询符合条件的记录(所有字段)-->
  <select id="listByExample" resultMap="resultMap">
    SELECT
      *
    FROM `member_apply_cash`
    <include refid="whereCondition" />
    <if test="example.groupBy != null">
      <include refid="groupBy" />
    </if>
    <choose>
      <when test="example.orderBy != null">
        <include refid="orderByOther" />
      </when>
      <otherwise>
        <include refid="orderBy" />
      </otherwise>
    </choose>
  </select>
  <!--分页查询符合条件的记录(所有字段)-->
  <select id="listPageByExample" resultMap="resultMap">
    SELECT
      *
    FROM `member_apply_cash`
    <include refid="whereCondition" />
    <if test="example.groupBy != null">
      <include refid="groupBy" />
    </if>
    <choose>
      <when test="example.orderBy != null">
        <include refid="orderByOther" />
      </when>
      <otherwise>
        <include refid="orderBy" />
      </otherwise>
    </choose>
    <include refid="limit" />
  </select>
  <!--查询符合条件的记录(指定字段)-->
  <select id="listFieldsByExample" resultMap="resultMap">
    SELECT
      ${fields}
    FROM `member_apply_cash`
    <include refid="whereCondition" />
    <if test="example.groupBy != null">
      <include refid="groupBy" />
    </if>
    <choose>
      <when test="example.orderBy != null">
        <include refid="orderByOther" />
      </when>
      <otherwise>
        <include refid="orderBy" />
      </otherwise>
    </choose>
  </select>
  <!--分页查询符合条件的记录(指定字段)-->
  <select id="listFieldsPageByExample" resultMap="resultMap">
    SELECT
      ${fields}
    FROM `member_apply_cash`
    <include refid="whereCondition" />
    <if test="example.groupBy != null">
      <include refid="groupBy" />
    </if>
    <choose>
      <when test="example.orderBy != null">
        <include refid="orderByOther" />
      </when>
      <otherwise>
        <include refid="orderBy" />
      </otherwise>
    </choose>
    <include refid="limit" />
  </select>
</mapper>