<?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.plan.entity.mapper.TbTablePlanMapper" >
  <resultMap id="BaseResultMap" type="com.xmomen.module.plan.entity.TbTablePlan" >
    <id column="ID" property="id" jdbcType="INTEGER" />
    <result column="CD_PLAN_ID" property="cdPlanId" jdbcType="INTEGER" />
    <result column="AUDIT_STATUS" property="auditStatus" jdbcType="INTEGER" />
    <result column="IS_STOP" property="isStop" jdbcType="INTEGER" />
    <result column="CD_MEMBER_ID" property="cdMemberId" jdbcType="INTEGER" />
    <result column="COUPON_NUMBER" property="couponNumber" jdbcType="VARCHAR" />
    <result column="MEMBER_CODE" property="memberCode" jdbcType="VARCHAR" />
    <result column="CONSIGNEE_PHONE" property="consigneePhone" jdbcType="VARCHAR" />
    <result column="CONSIGNEE_NAME" property="consigneeName" jdbcType="VARCHAR" />
    <result column="CONSIGNEE_ADDRESS" property="consigneeAddress" jdbcType="VARCHAR" />
    <result column="POSTCODE" property="postcode" jdbcType="VARCHAR" />
    <result column="SEND_WEEK_DAY" property="sendWeekDay" jdbcType="VARCHAR" />
    <result column="TOTAL_SEND_VALUE" property="totalSendValue" jdbcType="INTEGER" />
    <result column="SEND_VALUE" property="sendValue" jdbcType="INTEGER" />
    <result column="LAST_SEND_DATE" property="lastSendDate" jdbcType="DATE" />
    <result column="NEXT_SEND_DATE" property="nextSendDate" jdbcType="DATE" />
    <result column="BEGIN_TIME" property="beginTime" jdbcType="DATE" />
  </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, CD_PLAN_ID, AUDIT_STATUS, IS_STOP, CD_MEMBER_ID, COUPON_NUMBER, MEMBER_CODE, 
    CONSIGNEE_PHONE, CONSIGNEE_NAME, CONSIGNEE_ADDRESS, POSTCODE, SEND_WEEK_DAY, TOTAL_SEND_VALUE, 
    SEND_VALUE, LAST_SEND_DATE, NEXT_SEND_DATE, BEGIN_TIME
  </sql>
  <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.xmomen.module.plan.entity.TbTablePlanExample" >
    select
    <if test="distinct" >
      distinct
    </if>
    <include refid="Base_Column_List" />
    from tb_table_plan
    <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.plan.entity.TbTablePlanExample" >
    delete from tb_table_plan
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insertSelective" parameterType="com.xmomen.module.plan.entity.TbTablePlan" useGeneratedKeys="true" keyProperty="id" keyColumn="ID" >
    insert into tb_table_plan
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        ID,
      </if>
      <if test="cdPlanId != null" >
        CD_PLAN_ID,
      </if>
      <if test="auditStatus != null" >
        AUDIT_STATUS,
      </if>
      <if test="isStop != null" >
        IS_STOP,
      </if>
      <if test="cdMemberId != null" >
        CD_MEMBER_ID,
      </if>
      <if test="couponNumber != null" >
        COUPON_NUMBER,
      </if>
      <if test="memberCode != null" >
        MEMBER_CODE,
      </if>
      <if test="consigneePhone != null" >
        CONSIGNEE_PHONE,
      </if>
      <if test="consigneeName != null" >
        CONSIGNEE_NAME,
      </if>
      <if test="consigneeAddress != null" >
        CONSIGNEE_ADDRESS,
      </if>
      <if test="postcode != null" >
        POSTCODE,
      </if>
      <if test="sendWeekDay != null" >
        SEND_WEEK_DAY,
      </if>
      <if test="totalSendValue != null" >
        TOTAL_SEND_VALUE,
      </if>
      <if test="sendValue != null" >
        SEND_VALUE,
      </if>
      <if test="lastSendDate != null" >
        LAST_SEND_DATE,
      </if>
      <if test="nextSendDate != null" >
        NEXT_SEND_DATE,
      </if>
      <if test="beginTime != null" >
        BEGIN_TIME,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=INTEGER},
      </if>
      <if test="cdPlanId != null" >
        #{cdPlanId,jdbcType=INTEGER},
      </if>
      <if test="auditStatus != null" >
        #{auditStatus,jdbcType=INTEGER},
      </if>
      <if test="isStop != null" >
        #{isStop,jdbcType=INTEGER},
      </if>
      <if test="cdMemberId != null" >
        #{cdMemberId,jdbcType=INTEGER},
      </if>
      <if test="couponNumber != null" >
        #{couponNumber,jdbcType=VARCHAR},
      </if>
      <if test="memberCode != null" >
        #{memberCode,jdbcType=VARCHAR},
      </if>
      <if test="consigneePhone != null" >
        #{consigneePhone,jdbcType=VARCHAR},
      </if>
      <if test="consigneeName != null" >
        #{consigneeName,jdbcType=VARCHAR},
      </if>
      <if test="consigneeAddress != null" >
        #{consigneeAddress,jdbcType=VARCHAR},
      </if>
      <if test="postcode != null" >
        #{postcode,jdbcType=VARCHAR},
      </if>
      <if test="sendWeekDay != null" >
        #{sendWeekDay,jdbcType=VARCHAR},
      </if>
      <if test="totalSendValue != null" >
        #{totalSendValue,jdbcType=INTEGER},
      </if>
      <if test="sendValue != null" >
        #{sendValue,jdbcType=INTEGER},
      </if>
      <if test="lastSendDate != null" >
        #{lastSendDate,jdbcType=DATE},
      </if>
      <if test="nextSendDate != null" >
        #{nextSendDate,jdbcType=DATE},
      </if>
      <if test="beginTime != null" >
        #{beginTime,jdbcType=DATE},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.xmomen.module.plan.entity.TbTablePlanExample" resultType="java.lang.Integer" >
    select count(*) from tb_table_plan
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map" >
    update tb_table_plan
    <set >
      <if test="record.id != null" >
        ID = #{record.id,jdbcType=INTEGER},
      </if>
      <if test="record.cdPlanId != null" >
        CD_PLAN_ID = #{record.cdPlanId,jdbcType=INTEGER},
      </if>
      <if test="record.auditStatus != null" >
        AUDIT_STATUS = #{record.auditStatus,jdbcType=INTEGER},
      </if>
      <if test="record.isStop != null" >
        IS_STOP = #{record.isStop,jdbcType=INTEGER},
      </if>
      <if test="record.cdMemberId != null" >
        CD_MEMBER_ID = #{record.cdMemberId,jdbcType=INTEGER},
      </if>
      <if test="record.couponNumber != null" >
        COUPON_NUMBER = #{record.couponNumber,jdbcType=VARCHAR},
      </if>
      <if test="record.memberCode != null" >
        MEMBER_CODE = #{record.memberCode,jdbcType=VARCHAR},
      </if>
      <if test="record.consigneePhone != null" >
        CONSIGNEE_PHONE = #{record.consigneePhone,jdbcType=VARCHAR},
      </if>
      <if test="record.consigneeName != null" >
        CONSIGNEE_NAME = #{record.consigneeName,jdbcType=VARCHAR},
      </if>
      <if test="record.consigneeAddress != null" >
        CONSIGNEE_ADDRESS = #{record.consigneeAddress,jdbcType=VARCHAR},
      </if>
      <if test="record.postcode != null" >
        POSTCODE = #{record.postcode,jdbcType=VARCHAR},
      </if>
      <if test="record.sendWeekDay != null" >
        SEND_WEEK_DAY = #{record.sendWeekDay,jdbcType=VARCHAR},
      </if>
      <if test="record.totalSendValue != null" >
        TOTAL_SEND_VALUE = #{record.totalSendValue,jdbcType=INTEGER},
      </if>
      <if test="record.sendValue != null" >
        SEND_VALUE = #{record.sendValue,jdbcType=INTEGER},
      </if>
      <if test="record.lastSendDate != null" >
        LAST_SEND_DATE = #{record.lastSendDate,jdbcType=DATE},
      </if>
      <if test="record.nextSendDate != null" >
        NEXT_SEND_DATE = #{record.nextSendDate,jdbcType=DATE},
      </if>
      <if test="record.beginTime != null" >
        BEGIN_TIME = #{record.beginTime,jdbcType=DATE},
      </if>
    </set>
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
</mapper>