InviteSettlementMapper.xml 3.85 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.yohoufo.dal.order.InviteSettlementMapper" >
  <resultMap id="BaseResultMap" type="com.yohoufo.dal.order.model.InviteSettlement" >
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="uid" property="uid" jdbcType="INTEGER" />
    <result column="settle_code" property="settleCode" jdbcType="INTEGER" />
    <result column="settle_type" property="settleType" jdbcType="INTEGER" />
    <result column="settle_amount" property="settleAmount" jdbcType="DECIMAL" />
    <result column="settle_time" property="settleTime" jdbcType="INTEGER" />
    <result column="name" property="name" jdbcType="VARCHAR" />
    <result column="id_card_no" property="idCardNo" jdbcType="VARCHAR" />
    <result column="bank_name" property="bankName" jdbcType="VARCHAR" />
    <result column="bank_branch" property="bankBranch" jdbcType="VARCHAR" />
    <result column="bank_card_no" property="bankCardNo" jdbcType="VARCHAR" />
    <result column="paid_time" property="paidTime" jdbcType="INTEGER" />
    <result column="status" property="status" jdbcType="INTEGER" />
    <result column="create_time" property="createTime" jdbcType="INTEGER" />
  </resultMap>
  <sql id="Base_Column_List" >
    id, uid, settle_code, settle_type, settle_amount, settle_time,name, id_card_no, bank_name, bank_branch, bank_card_no,paid_time, status, create_time
  </sql>

  <insert id="insert" parameterType="com.yohoufo.dal.order.model.InviteSettlement" useGeneratedKeys="true" keyProperty="id">
    insert into invite_settlement (
      id,
      uid,
      settle_code,
      settle_type,
      settle_amount,
      settle_time,
      name,
      id_card_no,
      bank_name,
      bank_branch,
      bank_card_no,
      status,
      create_time)
    values (
      #{id,jdbcType=INTEGER},
      #{uid,jdbcType=INTEGER},
      #{settleCode,jdbcType=INTEGER},
      #{settleType,jdbcType=INTEGER},
      #{settleAmount,jdbcType=DECIMAL},
      #{settleTime,jdbcType=INTEGER},
      #{name,jdbcType=VARCHAR},
      #{idCardNo,jdbcType=VARCHAR},
      #{bankName,jdbcType=VARCHAR},
      #{bankBranch,jdbcType=VARCHAR},
      #{bankCardNo,jdbcType=VARCHAR},
      #{status,jdbcType=INTEGER},
      #{createTime,jdbcType=INTEGER})
  </insert>

  <update id="updateByUidAndId" parameterType="com.yohoufo.dal.order.model.InviteSettlement" >
    update invite_settlement
    <set >
      <if test="settleCode != null" >
        settle_code = #{settleCode,jdbcType=INTEGER},
      </if>
      <if test="settleAmount != null" >
        settle_amount = #{settleAmount,jdbcType=DECIMAL},
      </if>
      <if test="settleTime != null" >
        settle_time = #{settleTime,jdbcType=INTEGER},
      </if>
      <if test="status != null" >
        status = #{status,jdbcType=INTEGER},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER} and uid = #{uid,jdbcType=INTEGER}
  </update>

  <select id="selectByUidAndStatusWithLimit" resultMap="BaseResultMap" >
    select
    <include refid="Base_Column_List" />
    from invite_settlement
    where uid = #{uid,jdbcType=INTEGER} and status = #{status,jdbcType=INTEGER}
    order by id desc
    limit #{start,jdbcType=INTEGER}, #{limit,jdbcType=INTEGER}
  </select>

  <select id="selectByUidAndIds" resultMap="BaseResultMap" >
    select
    <include refid="Base_Column_List" />
    from invite_settlement
    where uid = #{uid,jdbcType=INTEGER}
    and id in
    <foreach collection="ids" item="id" open="(" separator="," close=")">
      #{id}
    </foreach>
  </select>

  <select id="selectByIds" resultMap="BaseResultMap" >
    select
    <include refid="Base_Column_List" />
    from invite_settlement
    where id in
    <foreach collection="ids" item="id" open="(" separator="," close=")">
      #{id}
    </foreach>
  </select>

</mapper>