<?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.StoreRenewReadMapper">
  <resultMap id="resultMap" type="com.slodon.b2b2c.seller.pojo.StoreRenew">
    <id column="renew_id" property="renewId" />
    <result column="store_id" property="storeId" />
    <result column="store_name" property="storeName" />
    <result column="vendor_name" property="vendorName" />
    <result column="contact_name" property="contactName" />
    <result column="contact_phone" property="contactPhone" />
    <result column="apply_time" property="applyTime" />
    <result column="duration" property="duration" />
    <result column="grade_id" property="gradeId" />
    <result column="payment_evidence" property="paymentEvidence" />
    <result column="payment_evidence_desc" property="paymentEvidenceDesc" />
    <result column="pay_time" property="payTime" />
    <result column="state" property="state" />
    <result column="start_time" property="startTime" />
    <result column="end_time" property="endTime" />
    <result column="pay_sn" property="paySn" />
    <result column="pay_amount" property="payAmount" />
    <result column="trade_sn" property="tradeSn" />
    <result column="payment_name" property="paymentName" />
    <result column="payment_code" property="paymentCode" />
  </resultMap>
  <!--按照主键值进行操作-->
  <sql id="pkWhere">
    WHERE `renew_id` = #{primaryKey}
  </sql>
  <!--操作条件-->
  <sql id="whereCondition">
    <if test="example != null">
      <trim prefix="WHERE" prefixOverrides="AND|OR">
        <if test="example.renewIdNotEquals != null">
          AND `renew_id` != #{example.renewIdNotEquals}
        </if>
        <if test="example.renewIdIn != null">
          AND `renew_id` in (${example.renewIdIn})
        </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.vendorName != null">
          AND `vendor_name` = #{example.vendorName}
        </if>
        <if test="example.vendorNameLike != null">
          AND `vendor_name` like concat('%',#{example.vendorNameLike},'%')
        </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.contactPhone != null">
          AND `contact_phone` = #{example.contactPhone}
        </if>
        <if test="example.contactPhoneLike != null">
          AND `contact_phone` like concat('%',#{example.contactPhoneLike},'%')
        </if>
        <if test="example.applyTimeAfter != null">
          AND `apply_time` <![CDATA[ >= ]]> #{example.applyTimeAfter}
        </if>
        <if test="example.applyTimeBefore != null">
          AND `apply_time` <![CDATA[ <= ]]> #{example.applyTimeBefore}
        </if>
        <if test="example.duration != null">
          AND `duration` = #{example.duration}
        </if>
        <if test="example.gradeId != null">
          AND `grade_id` = #{example.gradeId}
        </if>
        <if test="example.paymentEvidence != null">
          AND `payment_evidence` = #{example.paymentEvidence}
        </if>
        <if test="example.paymentEvidenceDesc != null">
          AND `payment_evidence_desc` = #{example.paymentEvidenceDesc}
        </if>
        <if test="example.payTimeAfter != null">
          AND `pay_time` <![CDATA[ >= ]]> #{example.payTimeAfter}
        </if>
        <if test="example.payTimeBefore != null">
          AND `pay_time` <![CDATA[ <= ]]> #{example.payTimeBefore}
        </if>
        <if test="example.state != null">
          AND `state` = #{example.state}
        </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.paySn != null">
          AND `pay_sn` = #{example.paySn}
        </if>
        <if test="example.payAmount != null">
          AND `pay_amount` = #{example.payAmount}
        </if>
        <if test="example.tradeSn != null">
          AND `trade_sn` = #{example.tradeSn}
        </if>
        <if test="example.paymentName != null">
          AND `payment_name` = #{example.paymentName}
        </if>
        <if test="example.paymentCode != null">
          AND `payment_code` = #{example.paymentCode}
        </if>
      </trim>
    </if>
  </sql>
  <!--排序条件-->
  <sql id="orderBy">
    ORDER BY `renew_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.StoreRenewExample" resultType="java.lang.Integer">
    SELECT
      COUNT(*)
    FROM `store_renew`
    <include refid="whereCondition" />
  </select>
  <!--根据主键查询记录-->
  <select id="getByPrimaryKey" resultMap="resultMap">
    SELECT
      *
    FROM `store_renew`
    <include refid="pkWhere" />
  </select>
  <!--查询符合条件的记录(所有字段)-->
  <select id="listByExample" resultMap="resultMap">
    SELECT
      *
    FROM `store_renew`
    <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_renew`
    <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_renew`
    <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_renew`
    <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>