<?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.write.promotion.FullAmountCycleMinusWriteMapper">
  <resultMap id="resultMap" type="com.slodon.b2b2c.promotion.pojo.FullAmountCycleMinus">
    <id column="full_id" property="fullId" />
    <result column="full_name" property="fullName" />
    <result column="start_time" property="startTime" />
    <result column="end_time" property="endTime" />
    <result column="full_value" property="fullValue" />
    <result column="minus_value" property="minusValue" />
    <result column="state" property="state" />
    <result column="store_id" property="storeId" />
    <result column="store_name" property="storeName" />
    <result column="create_time" property="createTime" />
    <result column="create_vendor_id" property="createVendorId" />
    <result column="update_time" property="updateTime" />
    <result column="update_vendor_id" property="updateVendorId" />
    <result column="send_integral" property="sendIntegral" />
    <result column="send_coupon_ids" property="sendCouponIds" />
    <result column="send_goods_ids" property="sendGoodsIds" />
  </resultMap>
  <!--除主键外的所有字段，用于插入操作-->
  <sql id="columns">
    <trim suffixOverrides=",">
      <if test="fullName != null">
        `full_name`,
      </if>
      <if test="startTime != null">
        `start_time`,
      </if>
      <if test="endTime != null">
        `end_time`,
      </if>
      <if test="fullValue != null">
        `full_value`,
      </if>
      <if test="minusValue != null">
        `minus_value`,
      </if>
      <if test="state != null">
        `state`,
      </if>
      <if test="storeId != null">
        `store_id`,
      </if>
      <if test="storeName != null">
        `store_name`,
      </if>
      <if test="createTime != null">
        `create_time`,
      </if>
      <if test="createVendorId != null">
        `create_vendor_id`,
      </if>
      <if test="updateTime != null">
        `update_time`,
      </if>
      <if test="updateVendorId != null">
        `update_vendor_id`,
      </if>
      <if test="sendIntegral != null">
        `send_integral`,
      </if>
      <if test="sendCouponIds != null">
        `send_coupon_ids`,
      </if>
      <if test="sendGoodsIds != null">
        `send_goods_ids`,
      </if>
    </trim>
  </sql>
  <!--按照主键值进行操作-->
  <sql id="pkWhere">
    WHERE `full_id` = #{primaryKey}
  </sql>
  <!--操作条件-->
  <sql id="whereCondition">
    <if test="example != null">
      <trim prefix="WHERE" prefixOverrides="AND|OR">
        <if test="example.fullIdNotEquals != null">
          AND `full_id` != #{example.fullIdNotEquals}
        </if>
        <if test="example.fullIdIn != null">
          AND `full_id` in (${example.fullIdIn})
        </if>
        <if test="example.fullName != null">
          AND `full_name` = #{example.fullName}
        </if>
        <if test="example.fullNameLike != null">
          AND `full_name` like concat('%',#{example.fullNameLike},'%')
        </if>
        <if test="example.startTimeAfter != null">
          AND `start_time` <![CDATA[ >= ]]> #{example.startTimeAfter}
        </if>
        <if test="example.startTimeBefore != null">
          AND `start_time` <![CDATA[ <= ]]> #{example.startTimeBefore}
        </if>
        <if test="example.endTimeAfter != null">
          AND `end_time` <![CDATA[ >= ]]> #{example.endTimeAfter}
        </if>
        <if test="example.endTimeBefore != null">
          AND `end_time` <![CDATA[ <= ]]> #{example.endTimeBefore}
        </if>
        <if test="example.fullValue != null">
          AND `full_value` = #{example.fullValue}
        </if>
        <if test="example.minusValue != null">
          AND `minus_value` = #{example.minusValue}
        </if>
        <if test="example.state != null">
          AND `state` = #{example.state}
        </if>
        <if test="example.storeId != null">
          AND `store_id` = #{example.storeId}
        </if>
        <if test="example.storeName != null">
          AND `store_name` = #{example.storeName}
        </if>
        <if test="example.storeNameLike != null">
          AND `store_name` like concat('%',#{example.storeNameLike},'%')
        </if>
        <if test="example.createTimeAfter != null">
          AND `create_time` <![CDATA[ >= ]]> #{example.createTimeAfter}
        </if>
        <if test="example.createTimeBefore != null">
          AND `create_time` <![CDATA[ <= ]]> #{example.createTimeBefore}
        </if>
        <if test="example.createVendorId != null">
          AND `create_vendor_id` = #{example.createVendorId}
        </if>
        <if test="example.updateTimeAfter != null">
          AND `update_time` <![CDATA[ >= ]]> #{example.updateTimeAfter}
        </if>
        <if test="example.updateTimeBefore != null">
          AND `update_time` <![CDATA[ <= ]]> #{example.updateTimeBefore}
        </if>
        <if test="example.updateVendorId != null">
          AND `update_vendor_id` = #{example.updateVendorId}
        </if>
        <if test="example.sendIntegral != null">
          AND `send_integral` = #{example.sendIntegral}
        </if>
        <if test="example.sendCouponIds != null">
          AND `send_coupon_ids` = #{example.sendCouponIds}
        </if>
        <if test="example.sendGoodsIds != null">
          AND `send_goods_ids` = #{example.sendGoodsIds}
        </if>
      </trim>
    </if>
  </sql>
  <!--排序条件-->
  <sql id="orderBy">
    ORDER BY `full_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.promotion.example.FullAmountCycleMinusExample" resultType="java.lang.Integer">
    SELECT
      COUNT(*)
    FROM `promotion_full_amount_cycle_minus`
    <include refid="whereCondition" />
  </select>
  <!--根据主键查询记录-->
  <select id="getByPrimaryKey" resultMap="resultMap">
    SELECT
      *
    FROM `promotion_full_amount_cycle_minus`
    <include refid="pkWhere" />
  </select>
  <!--查询符合条件的记录(所有字段)-->
  <select id="listByExample" resultMap="resultMap">
    SELECT
      *
    FROM `promotion_full_amount_cycle_minus`
    <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 `promotion_full_amount_cycle_minus`
    <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 `promotion_full_amount_cycle_minus`
    <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 `promotion_full_amount_cycle_minus`
    <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>
  <!--根据条件删除记录，可多条删除-->
  <delete id="deleteByExample">
    DELETE FROM `promotion_full_amount_cycle_minus`
    <include refid="whereCondition" />
  </delete>
  <!--根据主键删除记录-->
  <delete id="deleteByPrimaryKey">
    DELETE FROM `promotion_full_amount_cycle_minus`
    <include refid="pkWhere" />
  </delete>
  <!--插入一条记录-->
  <insert id="insert" keyColumn="full_id" keyProperty="fullId" parameterType="com.slodon.b2b2c.promotion.pojo.FullAmountCycleMinus" useGeneratedKeys="true">
    INSERT INTO `promotion_full_amount_cycle_minus`(
    <include refid="columns" />
    )
    VALUES(
    <trim suffixOverrides=",">
      <if test="fullName != null">
        #{fullName},
      </if>
      <if test="startTime != null">
        #{startTime},
      </if>
      <if test="endTime != null">
        #{endTime},
      </if>
      <if test="fullValue != null">
        #{fullValue},
      </if>
      <if test="minusValue != null">
        #{minusValue},
      </if>
      <if test="state != null">
        #{state},
      </if>
      <if test="storeId != null">
        #{storeId},
      </if>
      <if test="storeName != null">
        #{storeName},
      </if>
      <if test="createTime != null">
        #{createTime},
      </if>
      <if test="createVendorId != null">
        #{createVendorId},
      </if>
      <if test="updateTime != null">
        #{updateTime},
      </if>
      <if test="updateVendorId != null">
        #{updateVendorId},
      </if>
      <if test="sendIntegral != null">
        #{sendIntegral},
      </if>
      <if test="sendCouponIds != null">
        #{sendCouponIds},
      </if>
      <if test="sendGoodsIds != null">
        #{sendGoodsIds},
      </if>
    </trim>
    )
  </insert>
  <!--按条件更新记录中不为空的字段-->
  <update id="updateByExampleSelective">
    UPDATE `promotion_full_amount_cycle_minus`
    <trim prefix="SET" suffixOverrides=",">
      <if test="record.fullName != null">
        `full_name` = #{record.fullName},
      </if>
      <if test="record.startTime != null">
        `start_time` = #{record.startTime},
      </if>
      <if test="record.endTime != null">
        `end_time` = #{record.endTime},
      </if>
      <if test="record.fullValue != null">
        `full_value` = #{record.fullValue},
      </if>
      <if test="record.minusValue != null">
        `minus_value` = #{record.minusValue},
      </if>
      <if test="record.state != null">
        `state` = #{record.state},
      </if>
      <if test="record.storeId != null">
        `store_id` = #{record.storeId},
      </if>
      <if test="record.storeName != null">
        `store_name` = #{record.storeName},
      </if>
      <if test="record.createTime != null">
        `create_time` = #{record.createTime},
      </if>
      <if test="record.createVendorId != null">
        `create_vendor_id` = #{record.createVendorId},
      </if>
      <if test="record.updateTime != null">
        `update_time` = #{record.updateTime},
      </if>
      <if test="record.updateVendorId != null">
        `update_vendor_id` = #{record.updateVendorId},
      </if>
      <if test="record.sendIntegral != null">
        `send_integral` = #{record.sendIntegral},
      </if>
      <if test="record.sendCouponIds != null">
        `send_coupon_ids` = #{record.sendCouponIds},
      </if>
      <if test="record.sendGoodsIds != null">
        `send_goods_ids` = #{record.sendGoodsIds},
      </if>
    </trim>
    <include refid="whereCondition" />
  </update>
  <!--按照主键更新记录中不为空的字段-->
  <update id="updateByPrimaryKeySelective">
    UPDATE `promotion_full_amount_cycle_minus`
    <trim prefix="SET" suffixOverrides=",">
      <if test="fullName != null">
        `full_name` = #{fullName},
      </if>
      <if test="startTime != null">
        `start_time` = #{startTime},
      </if>
      <if test="endTime != null">
        `end_time` = #{endTime},
      </if>
      <if test="fullValue != null">
        `full_value` = #{fullValue},
      </if>
      <if test="minusValue != null">
        `minus_value` = #{minusValue},
      </if>
      <if test="state != null">
        `state` = #{state},
      </if>
      <if test="storeId != null">
        `store_id` = #{storeId},
      </if>
      <if test="storeName != null">
        `store_name` = #{storeName},
      </if>
      <if test="createTime != null">
        `create_time` = #{createTime},
      </if>
      <if test="createVendorId != null">
        `create_vendor_id` = #{createVendorId},
      </if>
      <if test="updateTime != null">
        `update_time` = #{updateTime},
      </if>
      <if test="updateVendorId != null">
        `update_vendor_id` = #{updateVendorId},
      </if>
      <if test="sendIntegral != null">
        `send_integral` = #{sendIntegral},
      </if>
      <if test="sendCouponIds != null">
        `send_coupon_ids` = #{sendCouponIds},
      </if>
      <if test="sendGoodsIds != null">
        `send_goods_ids` = #{sendGoodsIds},
      </if>
    </trim>
    WHERE `full_id` = #{fullId}
  </update>
</mapper>