<?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.read.seller.StoreCertificateReadMapper">
  <resultMap id="resultMap" type="com.slodon.b2b2c.seller.pojo.StoreCertificate">
    <id column="certificate_id" property="certificateId" />
    <result column="vendor_id" property="vendorId" />
    <result column="vendor_name" property="vendorName" />
    <result column="enter_type" property="enterType" />
    <result column="company_name" property="companyName" />
    <result column="company_province_code" property="companyProvinceCode" />
    <result column="company_city_code" property="companyCityCode" />
    <result column="company_area_code" property="companyAreaCode" />
    <result column="area_info" property="areaInfo" />
    <result column="company_address" property="companyAddress" />
    <result column="business_license_image" property="businessLicenseImage" />
    <result column="person_card_up" property="personCardUp" />
    <result column="person_card_down" property="personCardDown" />
    <result column="contact_phone" property="contactPhone" />
    <result column="contact_name" property="contactName" />
    <result column="more_qualification1" property="moreQualification1" />
    <result column="more_qualification2" property="moreQualification2" />
    <result column="more_qualification3" property="moreQualification3" />
  </resultMap>
  <!--按照主键值进行操作-->
  <sql id="pkWhere">
    WHERE `certificate_id` = #{primaryKey}
  </sql>
  <!--操作条件-->
  <sql id="whereCondition">
    <if test="example != null">
      <trim prefix="WHERE" prefixOverrides="AND|OR">
        <if test="example.certificateIdNotEquals != null">
          AND `certificate_id` != #{example.certificateIdNotEquals}
        </if>
        <if test="example.certificateIdIn != null">
          AND `certificate_id` in (${example.certificateIdIn})
        </if>
        <if test="example.vendorId != null">
          AND `vendor_id` = #{example.vendorId}
        </if>
        <if test="example.vendorName != null">
          AND `vendor_name` = #{example.vendorName}
        </if>
        <if test="example.vendorNameLike != null">
          AND `vendor_name` like concat('%',#{example.vendorNameLike},'%')
        </if>
        <if test="example.enterType != null">
          AND `enter_type` = #{example.enterType}
        </if>
        <if test="example.companyName != null">
          AND `company_name` = #{example.companyName}
        </if>
        <if test="example.companyNameLike != null">
          AND `company_name` like concat('%',#{example.companyNameLike},'%')
        </if>
        <if test="example.companyProvinceCode != null">
          AND `company_province_code` = #{example.companyProvinceCode}
        </if>
        <if test="example.companyCityCode != null">
          AND `company_city_code` = #{example.companyCityCode}
        </if>
        <if test="example.companyAreaCode != null">
          AND `company_area_code` = #{example.companyAreaCode}
        </if>
        <if test="example.areaInfo != null">
          AND `area_info` = #{example.areaInfo}
        </if>
        <if test="example.companyAddress != null">
          AND `company_address` = #{example.companyAddress}
        </if>
        <if test="example.businessLicenseImage != null">
          AND `business_license_image` = #{example.businessLicenseImage}
        </if>
        <if test="example.personCardUp != null">
          AND `person_card_up` = #{example.personCardUp}
        </if>
        <if test="example.personCardDown != null">
          AND `person_card_down` = #{example.personCardDown}
        </if>
        <if test="example.contactPhone != null">
          AND `contact_phone` = #{example.contactPhone}
        </if>
        <if test="example.contactName != null">
          AND `contact_name` = #{example.contactName}
        </if>
        <if test="example.contactNameLike != null">
          AND `contact_name` like concat('%',#{example.contactNameLike},'%')
        </if>
        <if test="example.moreQualification1 != null">
          AND `more_qualification1` = #{example.moreQualification1}
        </if>
        <if test="example.moreQualification2 != null">
          AND `more_qualification2` = #{example.moreQualification2}
        </if>
        <if test="example.moreQualification3 != null">
          AND `more_qualification3` = #{example.moreQualification3}
        </if>
      </trim>
    </if>
  </sql>
  <!--排序条件-->
  <sql id="orderBy">
    ORDER BY `certificate_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.StoreCertificateExample" resultType="java.lang.Integer">
    SELECT
      COUNT(*)
    FROM `store_certificate`
    <include refid="whereCondition" />
  </select>
  <!--根据主键查询记录-->
  <select id="getByPrimaryKey" resultMap="resultMap">
    SELECT
      *
    FROM `store_certificate`
    <include refid="pkWhere" />
  </select>
  <!--查询符合条件的记录(所有字段)-->
  <select id="listByExample" resultMap="resultMap">
    SELECT
      *
    FROM `store_certificate`
    <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_certificate`
    <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_certificate`
    <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_certificate`
    <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>
</mapper>