<?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.xmomen.module.pick.entity.mapper.TbPickMapper" >
  <resultMap id="BaseResultMap" type="com.xmomen.module.pick.entity.TbPick" >
    <id column="ID" property="id" jdbcType="INTEGER" />
    <result column="COUPON_NO" property="couponNo" jdbcType="VARCHAR" />
    <result column="PICK_WEIGHT" property="pickWeight" jdbcType="DECIMAL" />
    <result column="PICK_PAY_TYPE" property="pickPayType" jdbcType="INTEGER" />
    <result column="PICK_TOTAL_PRICE" property="pickTotalPrice" jdbcType="DECIMAL" />
    <result column="PICK_CRAD_PRICE" property="pickCradPrice" jdbcType="DECIMAL" />
    <result column="PICK_CASE_PRICE" property="pickCasePrice" jdbcType="DECIMAL" />
    <result column="PICK_DATE" property="pickDate" jdbcType="TIMESTAMP" />
    <result column="PICK_PLACE" property="pickPlace" jdbcType="INTEGER" />
    <result column="PICK_PLACE_USER" property="pickPlaceUser" jdbcType="INTEGER" />
  </resultMap>
  <sql id="Example_Where_Clause" >
    <where >
      <foreach collection="oredCriteria" item="criteria" separator="or" >
        <if test="criteria.valid" >
          <trim prefix="(" suffix=")" prefixOverrides="and" >
            <foreach collection="criteria.criteria" item="criterion" >
              <choose >
                <when test="criterion.noValue" >
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue" >
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue" >
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue" >
                  and ${criterion.condition}
                  <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Update_By_Example_Where_Clause" >
    <where >
      <foreach collection="example.oredCriteria" item="criteria" separator="or" >
        <if test="criteria.valid" >
          <trim prefix="(" suffix=")" prefixOverrides="and" >
            <foreach collection="criteria.criteria" item="criterion" >
              <choose >
                <when test="criterion.noValue" >
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue" >
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue" >
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue" >
                  and ${criterion.condition}
                  <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List" >
    ID, COUPON_NO, PICK_WEIGHT, PICK_PAY_TYPE, PICK_TOTAL_PRICE, PICK_CRAD_PRICE, PICK_CASE_PRICE, 
    PICK_DATE, PICK_PLACE, PICK_PLACE_USER
  </sql>
  <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.xmomen.module.pick.entity.TbPickExample" >
    select
    <if test="distinct" >
      distinct
    </if>
    <include refid="Base_Column_List" />
    from tb_pick
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null" >
      order by ${orderByClause}
    </if>
  </select>
  <delete id="deleteByExample" parameterType="com.xmomen.module.pick.entity.TbPickExample" >
    delete from tb_pick
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insertSelective" parameterType="com.xmomen.module.pick.entity.TbPick" useGeneratedKeys="true" keyProperty="id" keyColumn="ID" >
    insert into tb_pick
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        ID,
      </if>
      <if test="couponNo != null" >
        COUPON_NO,
      </if>
      <if test="pickWeight != null" >
        PICK_WEIGHT,
      </if>
      <if test="pickPayType != null" >
        PICK_PAY_TYPE,
      </if>
      <if test="pickTotalPrice != null" >
        PICK_TOTAL_PRICE,
      </if>
      <if test="pickCradPrice != null" >
        PICK_CRAD_PRICE,
      </if>
      <if test="pickCasePrice != null" >
        PICK_CASE_PRICE,
      </if>
      <if test="pickDate != null" >
        PICK_DATE,
      </if>
      <if test="pickPlace != null" >
        PICK_PLACE,
      </if>
      <if test="pickPlaceUser != null" >
        PICK_PLACE_USER,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=INTEGER},
      </if>
      <if test="couponNo != null" >
        #{couponNo,jdbcType=VARCHAR},
      </if>
      <if test="pickWeight != null" >
        #{pickWeight,jdbcType=DECIMAL},
      </if>
      <if test="pickPayType != null" >
        #{pickPayType,jdbcType=INTEGER},
      </if>
      <if test="pickTotalPrice != null" >
        #{pickTotalPrice,jdbcType=DECIMAL},
      </if>
      <if test="pickCradPrice != null" >
        #{pickCradPrice,jdbcType=DECIMAL},
      </if>
      <if test="pickCasePrice != null" >
        #{pickCasePrice,jdbcType=DECIMAL},
      </if>
      <if test="pickDate != null" >
        #{pickDate,jdbcType=TIMESTAMP},
      </if>
      <if test="pickPlace != null" >
        #{pickPlace,jdbcType=INTEGER},
      </if>
      <if test="pickPlaceUser != null" >
        #{pickPlaceUser,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.xmomen.module.pick.entity.TbPickExample" resultType="java.lang.Integer" >
    select count(*) from tb_pick
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map" >
    update tb_pick
    <set >
      <if test="record.id != null" >
        ID = #{record.id,jdbcType=INTEGER},
      </if>
      <if test="record.couponNo != null" >
        COUPON_NO = #{record.couponNo,jdbcType=VARCHAR},
      </if>
      <if test="record.pickWeight != null" >
        PICK_WEIGHT = #{record.pickWeight,jdbcType=DECIMAL},
      </if>
      <if test="record.pickPayType != null" >
        PICK_PAY_TYPE = #{record.pickPayType,jdbcType=INTEGER},
      </if>
      <if test="record.pickTotalPrice != null" >
        PICK_TOTAL_PRICE = #{record.pickTotalPrice,jdbcType=DECIMAL},
      </if>
      <if test="record.pickCradPrice != null" >
        PICK_CRAD_PRICE = #{record.pickCradPrice,jdbcType=DECIMAL},
      </if>
      <if test="record.pickCasePrice != null" >
        PICK_CASE_PRICE = #{record.pickCasePrice,jdbcType=DECIMAL},
      </if>
      <if test="record.pickDate != null" >
        PICK_DATE = #{record.pickDate,jdbcType=TIMESTAMP},
      </if>
      <if test="record.pickPlace != null" >
        PICK_PLACE = #{record.pickPlace,jdbcType=INTEGER},
      </if>
      <if test="record.pickPlaceUser != null" >
        PICK_PLACE_USER = #{record.pickPlaceUser,jdbcType=INTEGER},
      </if>
    </set>
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
</mapper>