SellerWalletDetailMapper.xml 2.67 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.yoho.order.dal.SellerWalletDetailMapper" >
  <resultMap id="BaseResultMap" type="com.yoho.order.model.SellerWalletDetail" >
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="wallet_id" property="walletId" jdbcType="INTEGER" />
    <result column="uid" property="uid" jdbcType="INTEGER" />
    <result column="order_code" property="orderCode" jdbcType="BIGINT" />
    <result column="amount" property="amount" jdbcType="DECIMAL" />
    <result column="type" property="type" jdbcType="TINYINT" />
    <result column="create_time" property="createTime" jdbcType="INTEGER" />
    <result column="update_time" property="updateTime" jdbcType="INTEGER" />
    <result column="is_batch" property="isBatch" jdbcType="INTEGER" />
    <result column="attach_value" property="attachValue" jdbcType="VARCHAR" />
    <result column="avail_amount" property="availAmount" jdbcType="DECIMAL" />
    <result column="lock_amount" property="lockAmount" jdbcType="DECIMAL" />
    <result column="is_set" property="isSet" jdbcType="INTEGER" />
  </resultMap>
  <sql id="Base_Column_List" >
    id, wallet_id, uid, order_code, amount, type, create_time, update_time,is_batch,attach_value,avail_amount,lock_amount,is_set
  </sql>

  
  <select id="selectUserBreakRulesCount" resultType="java.lang.Integer"  >
    select 
    count(id)
    from seller_wallet_detail
    where uid = #{uid,jdbcType=INTEGER} and is_batch = 0 and type in (32,33)
  </select>

 
  <select id="selectMerchantInfoCount" resultType="java.lang.Integer"  >
    select count(*) from seller_wallet_detail
    where is_batch = 0 <include refid="condi" />
  </select>
  
  <select id="selectMerchantInfo" resultMap="BaseResultMap">
    select * from seller_wallet_detail
    where is_batch = 0 <include refid="condi" /> order by id desc limit #{start},#{rows}
  </select>
  <select id="selectById" resultMap="BaseResultMap">
    select * from seller_wallet_detail
    where id = #{id,jdbcType=INTEGER}
  </select>
  <sql id="condi">
  	<if test="uid != null and uid > 0">
       and uid = #{uid,jdbcType=INTEGER}
    </if>
    <if test="startTime != null and startTime > 0">
       and create_time &gt;= #{startTime,jdbcType=INTEGER}
    </if>
    <if test="endTime != null and endTime > 0">
       and create_time &lt;= #{endTime,jdbcType=INTEGER}
    </if>
    <if test="stateList != null and stateList.size()>0">
       and type in 
       <foreach collection="stateList" item="item" open="(" close=")" separator=",">
           #{item}
       </foreach>
    </if>
  </sql>
</mapper>