<?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.seller.StoreInnerLabelWriteMapper">
  <resultMap id="resultMap" type="com.slodon.b2b2c.seller.pojo.StoreInnerLabel">
    <id column="inner_label_id" property="innerLabelId" />
    <result column="web_site" property="webSite" />
    <result column="inner_label_name" property="innerLabelName" />
    <result column="inner_label_sort" property="innerLabelSort" />
    <result column="is_show" property="isShow" />
    <result column="parent_inner_label_id" property="parentInnerLabelId" />
    <result column="store_id" property="storeId" />
    <result column="create_time" property="createTime" />
    <result column="create_vendor_id" property="createVendorId" />
    <result column="create_vendor_name" property="createVendorName" />
    <result column="update_time" property="updateTime" />
    <result column="update_vendor_id" property="updateVendorId" />
    <result column="update_vendor_name" property="updateVendorName" />
  </resultMap>
  <!--除主键外的所有字段，用于插入操作-->
  <sql id="columns">
    <trim suffixOverrides=",">
      <if test="webSite != null">
          `web_site`,
      </if>
      <if test="innerLabelName != null">
        `inner_label_name`,
      </if>
      <if test="innerLabelSort != null">
        `inner_label_sort`,
      </if>
      <if test="isShow != null">
        `is_show`,
      </if>
      <if test="parentInnerLabelId != null">
        `parent_inner_label_id`,
      </if>
      <if test="storeId != null">
        `store_id`,
      </if>
      <if test="createTime != null">
        `create_time`,
      </if>
      <if test="createVendorId != null">
        `create_vendor_id`,
      </if>
      <if test="createVendorName != null">
        `create_vendor_name`,
      </if>
      <if test="updateTime != null">
        `update_time`,
      </if>
      <if test="updateVendorId != null">
        `update_vendor_id`,
      </if>
      <if test="updateVendorName != null">
        `update_vendor_name`,
      </if>
    </trim>
  </sql>
  <!--按照主键值进行操作-->
  <sql id="pkWhere">
    WHERE `inner_label_id` = #{primaryKey}
  </sql>
  <!--操作条件-->
  <sql id="whereCondition">
    <if test="example != null">
      <trim prefix="WHERE" prefixOverrides="AND|OR">
        <if test="example.innerLabelIdNotEquals != null">
          AND `inner_label_id` != #{example.innerLabelIdNotEquals}
        </if>
        <if test="example.innerLabelIdIn != null">
          AND `inner_label_id` in (${example.innerLabelIdIn})
        </if>
        <if test="example.webSite != null">
          AND `web_site` = #{example.webSite}
        </if>
        <if test="example.innerLabelName != null">
          AND `inner_label_name` = #{example.innerLabelName}
        </if>
        <if test="example.innerLabelNameLike != null">
          AND `inner_label_name` like concat('%',#{example.innerLabelNameLike},'%')
        </if>
        <if test="example.innerLabelSort != null">
          AND `inner_label_sort` = #{example.innerLabelSort}
        </if>
        <if test="example.isShow != null">
          AND `is_show` = #{example.isShow}
        </if>
        <if test="example.parentInnerLabelId != null">
          AND `parent_inner_label_id` = #{example.parentInnerLabelId}
        </if>
        <if test="example.storeId != null">
          AND `store_id` = #{example.storeId}
        </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.createVendorName != null">
          AND `create_vendor_name` = #{example.createVendorName}
        </if>
        <if test="example.createVendorNameLike != null">
          AND `create_vendor_name` like concat('%',#{example.createVendorNameLike},'%')
        </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.updateVendorName != null">
          AND `update_vendor_name` = #{example.updateVendorName}
        </if>
        <if test="example.updateVendorNameLike != null">
          AND `update_vendor_name` like concat('%',#{example.updateVendorNameLike},'%')
        </if>
      </trim>
    </if>
  </sql>
  <!--排序条件-->
  <sql id="orderBy">
    ORDER BY `inner_label_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.seller.example.StoreInnerLabelExample" resultType="java.lang.Integer">
    SELECT
      COUNT(*)
    FROM `store_inner_label`
    <include refid="whereCondition" />
  </select>
  <!--根据主键查询记录-->
  <select id="getByPrimaryKey" resultMap="resultMap">
    SELECT
      *
    FROM `store_inner_label`
    <include refid="pkWhere" />
  </select>
  <!--查询符合条件的记录(所有字段)-->
  <select id="listByExample" resultMap="resultMap">
    SELECT
      *
    FROM `store_inner_label`
    <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 `store_inner_label`
    <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 `store_inner_label`
    <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 `store_inner_label`
    <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 `store_inner_label`
    <include refid="whereCondition" />
  </delete>
  <!--根据主键删除记录-->
  <delete id="deleteByPrimaryKey">
    DELETE FROM `store_inner_label`
    <include refid="pkWhere" />
  </delete>
  <!--插入一条记录-->
  <insert id="insert" keyColumn="inner_label_id" keyProperty="innerLabelId" parameterType="com.slodon.b2b2c.seller.pojo.StoreInnerLabel" useGeneratedKeys="true">
    INSERT INTO `store_inner_label`(
    <include refid="columns" />
    )
    VALUES(
    <trim suffixOverrides=",">
      <if test="webSite != null">
        #{webSite},
      </if>
      <if test="innerLabelName != null">
        #{innerLabelName},
      </if>
      <if test="innerLabelSort != null">
        #{innerLabelSort},
      </if>
      <if test="isShow != null">
        #{isShow},
      </if>
      <if test="parentInnerLabelId != null">
        #{parentInnerLabelId},
      </if>
      <if test="storeId != null">
        #{storeId},
      </if>
      <if test="createTime != null">
        #{createTime},
      </if>
      <if test="createVendorId != null">
        #{createVendorId},
      </if>
      <if test="createVendorName != null">
        #{createVendorName},
      </if>
      <if test="updateTime != null">
        #{updateTime},
      </if>
      <if test="updateVendorId != null">
        #{updateVendorId},
      </if>
      <if test="updateVendorName != null">
        #{updateVendorName},
      </if>
    </trim>
    )
  </insert>
  <!--按条件更新记录中不为空的字段-->
  <update id="updateByExampleSelective">
    UPDATE `store_inner_label`
    <trim prefix="SET" suffixOverrides=",">
      <if test="webSite != null">
        `web_site` = #{webSite},
      </if>
      <if test="record.innerLabelName != null">
        `inner_label_name` = #{record.innerLabelName},
      </if>
      <if test="record.innerLabelSort != null">
        `inner_label_sort` = #{record.innerLabelSort},
      </if>
      <if test="record.isShow != null">
        `is_show` = #{record.isShow},
      </if>
      <if test="record.parentInnerLabelId != null">
        `parent_inner_label_id` = #{record.parentInnerLabelId},
      </if>
      <if test="record.storeId != null">
        `store_id` = #{record.storeId},
      </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.createVendorName != null">
        `create_vendor_name` = #{record.createVendorName},
      </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.updateVendorName != null">
        `update_vendor_name` = #{record.updateVendorName},
      </if>
    </trim>
    <include refid="whereCondition" />
  </update>
  <!--按照主键更新记录中不为空的字段-->
  <update id="updateByPrimaryKeySelective">
    UPDATE `store_inner_label`
    <trim prefix="SET" suffixOverrides=",">
      <if test="webSite != null">
        `web_site` = #{webSite},
      </if>
      <if test="innerLabelName != null">
        `inner_label_name` = #{innerLabelName},
      </if>
      <if test="innerLabelSort != null">
        `inner_label_sort` = #{innerLabelSort},
      </if>
      <if test="isShow != null">
        `is_show` = #{isShow},
      </if>
      <if test="parentInnerLabelId != null">
        `parent_inner_label_id` = #{parentInnerLabelId},
      </if>
      <if test="storeId != null">
        `store_id` = #{storeId},
      </if>
      <if test="createTime != null">
        `create_time` = #{createTime},
      </if>
      <if test="createVendorId != null">
        `create_vendor_id` = #{createVendorId},
      </if>
      <if test="createVendorName != null">
        `create_vendor_name` = #{createVendorName},
      </if>
      <if test="updateTime != null">
        `update_time` = #{updateTime},
      </if>
      <if test="updateVendorId != null">
        `update_vendor_id` = #{updateVendorId},
      </if>
      <if test="updateVendorName != null">
        `update_vendor_name` = #{updateVendorName},
      </if>
    </trim>
    WHERE `inner_label_id` = #{innerLabelId}
  </update>
</mapper>