<?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.StoreSiteInfoWriteMapper">
  <resultMap id="resultMap" type="com.slodon.b2b2c.seller.pojo.StoreSiteInfo">
    <id column="id" property="id" />
    <result column="web_site" property="webSite" />
    <result column="store_id" property="storeId" />
    <result column="business_state" property="businessState" />
    <result column="store_logo" property="storeLogo" />
    <result column="store_banner_pc" property="storeBannerPc" />
    <result column="main_business" property="mainBusiness" />
    <result column="service_phone" property="servicePhone" />
    <result column="email" property="email" />
    <result column="address" property="address" />
    <result column="store_map_info" property="storeMapInfo" />
    <result column="store_map_info_w" property="storeMapInfoW" />
    <result column="store_grade_id" property="storeGradeId" />
    <result column="store_grade_name" property="storeGradeName" />
    <result column="open_time" property="openTime" />
    <result column="store_expire_time" property="storeExpireTime" />
    <result column="create_id" property="createId" />
    <result column="create_time" property="createTime" />
    <result column="update_id" property="updateId" />
    <result column="update_time" property="updateTime" />
  </resultMap>
  <!--除主键外的所有字段，用于插入操作-->
  <sql id="columns">
    <trim suffixOverrides=",">
      <if test="webSite != null">
        `web_site`,
      </if>
      <if test="storeId != null">
        `store_id`,
      </if>
      <if test="businessState != null">
        `business_state`,
      </if>
      <if test="storeLogo != null">
        `store_logo`,
      </if>
      <if test="storeBannerPc != null">
        `store_banner_pc`,
      </if>
      <if test="mainBusiness != null">
        `main_business`,
      </if>
      <if test="servicePhone != null">
        `service_phone`,
      </if>
      <if test="email != null">
        `email`,
      </if>
      <if test="address != null">
        `address`,
      </if>
      <if test="storeMapInfo != null">
        `store_map_info`,
      </if>
      <if test="storeMapInfoW != null">
        `store_map_info_w`,
      </if>
      <if test="storeGradeId != null">
        `store_grade_id`,
      </if>
      <if test="storeGradeName != null">
        `store_grade_name`,
      </if>
      <if test="openTime != null">
        `open_time`,
      </if>
      <if test="storeExpireTime != null">
        `store_expire_time`,
      </if>
      <if test="createId != null">
        `create_id`,
      </if>
      <if test="createTime != null">
        `create_time`,
      </if>
      <if test="updateId != null">
        `update_id`,
      </if>
      <if test="updateTime != null">
        `update_time`,
      </if>
    </trim>
  </sql>
  <!--按照主键值进行操作-->
  <sql id="pkWhere">
    WHERE `id` = #{primaryKey}
  </sql>
  <!--操作条件-->
  <sql id="whereCondition">
    <if test="example != null">
      <trim prefix="WHERE" prefixOverrides="AND|OR">
        <if test="example.storeId != null">
          AND `store_id` = #{example.storeId}
        </if>
        <if test="example.webSite != null">
          AND `web_site` = #{example.webSite}
        </if>
        <if test="example.businessState != null">
          AND `business_state` = #{example.businessState}
        </if>
      </trim>
    </if>
  </sql>
  <!--排序条件-->
  <sql id="orderBy">
    ORDER BY `store_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.StoreSiteInfoExample" resultType="java.lang.Integer">
    SELECT
      COUNT(*)
    FROM `store_site_info`
    <include refid="whereCondition" />
  </select>
  <!--根据主键查询记录-->
  <select id="getByPrimaryKey" resultMap="resultMap">
    SELECT
      *
    FROM `store_site_info`
    <include refid="pkWhere" />
  </select>
  <!--查询符合条件的记录(所有字段)-->
  <select id="listByExample" resultMap="resultMap">
    SELECT
      *
    FROM `store_site_info`
    <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_site_info`
    <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_site_info`
    <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_site_info`
    <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_site_info`
    <include refid="whereCondition" />
  </delete>
  <!--根据主键删除记录-->
  <delete id="deleteByPrimaryKey">
    DELETE FROM `store_site_info`
    <include refid="pkWhere" />
  </delete>
  <!--插入一条记录-->
  <insert id="insert" keyColumn="id" keyProperty="storeId" parameterType="com.slodon.b2b2c.seller.pojo.StoreSiteInfo"
          useGeneratedKeys="true">
    INSERT INTO `store_site_info`(
    <include refid="columns"/>
    )
    VALUES(
    <trim suffixOverrides=",">
      <if test="webSite != null">
        #{webSite},
      </if>
      <if test="storeId != null">
        #{storeId},
      </if>
      <if test="businessState != null">
        #{businessState},
      </if>
      <if test="storeLogo != null">
        #{storeLogo},
      </if>
      <if test="storeBannerPc != null">
        #{storeBannerPc},
      </if>
      <if test="mainBusiness != null">
        #{mainBusiness},
      </if>
      <if test="servicePhone != null">
        #{servicePhone},
      </if>
      <if test="email != null">
        #{email},
      </if>
      <if test="address != null">
        #{address},
      </if>
      <if test="storeMapInfo != null">
        #{storeMapInfo},
      </if>
      <if test="storeMapInfoW != null">
        #{storeMapInfoW},
      </if>
      <if test="storeGradeId != null">
        #{storeGradeId},
      </if>
      <if test="storeGradeName != null">
        #{storeGradeName},
      </if>
      <if test="openTime != null">
        #{openTime},
      </if>
      <if test="storeExpireTime != null">
        #{storeExpireTime},
      </if>
      <if test="createId != null">
        #{createId},
      </if>
      <if test="createTime != null">
        #{createTime},
      </if>
      <if test="updateId != null">
        #{updateId},
      </if>
      <if test="updateTime != null">
        #{updateTime},
      </if>
    </trim>
    )
  </insert>
  <!--按条件更新记录中不为空的字段-->
  <update id="updateByExampleSelective">
    UPDATE `store_site_info`
    <trim prefix="SET" suffixOverrides=",">
      <if test="record.businessState != null">
        `business_state` = #{record.businessState},
      </if>
      <if test="record.storeLogo != null">
        `store_logo` = #{record.storeLogo},
      </if>
      <if test="record.storeBannerPc != null">
        `store_banner_pc` = #{record.storeBannerPc},
      </if>
      <if test="record.mainBusiness != null">
          `main_business` = #{record.mainBusiness},
      </if>
      <if test="record.servicePhone != null">
          `service_phone` = #{record.servicePhone},
      </if>
      <if test="record.email != null">
        `email` = #{record.email},
      </if>
      <if test="record.address != null">
        `address` = #{record.address},
      </if>
      <if test="record.storeMapInfo != null">
          `store_map_info` = #{record.storeMapInfo},
      </if>
      <if test="record.storeMapInfoW != null">
          `store_map_info_w` = #{record.storeMapInfoW},
      </if>
      <if test="record.storeGradeId != null">
        `store_grade_id` = #{record.storeGradeId},
      </if>
      <if test="record.storeGradeName != null">
        `store_grade_name` = #{record.storeGradeName},
      </if>
      <if test="record.openTime != null">
        `open_time` = #{record.openTime},
      </if>
      <if test="record.storeExpireTime != null">
        `store_expire_time` = #{record.storeExpireTime},
      </if>
        <if test="record.updateId != null">
          `update_id` = #{record.updateId},
        </if>

      <if test="record.updateTime != null">
          `update_time` = #{record.updateTime},
      </if>
    </trim>
    <include refid="whereCondition" />
  </update>
  <!--按照主键更新记录中不为空的字段-->
  <update id="updateByPrimaryKeySelective">
    UPDATE `store_site_info`
    <trim prefix="SET" suffixOverrides=",">
      <if test="businessState != null">
        `business_state` = #{businessState},
      </if>
      <if test="storeLogo != null">
        `store_logo` = #{storeLogo},
      </if>
      <if test="storeBannerPc != null">
        `store_banner_pc` = #{storeBannerPc},
      </if>
      <if test="mainBusiness != null">
        `main_business` = #{mainBusiness},
      </if>
      <if test="servicePhone != null">
        `service_phone` = #{servicePhone},
      </if>
      <if test="email != null">
        `email` = #{email},
      </if>
      <if test="address != null">
        `address` = #{address},
      </if>
      <if test="storeMapInfo != null">
        `store_map_info` = #{storeMapInfo},
      </if>
      <if test="storeMapInfoW != null">
        `store_map_info_w` = #{storeMapInfoW},
      </if>
      <if test="storeGradeId != null">
        `store_grade_id` = #{storeGradeId},
      </if>
      <if test="storeGradeName != null">
        `store_grade_name` = #{storeGradeName},
      </if>
      <if test="openTime != null">
        `open_time` = #{openTime},
      </if>
      <if test="storeExpireTime != null">
        `store_expire_time` = #{storeExpireTime},
      </if>
      <if test="updateId != null">
        `update_id` = #{updateId},
      </if>
      <if test="updateTime != null">
        `update_time` = #{updateTime},
      </if>
    </trim>
    WHERE `id` = #{id}
  </update>
</mapper>