<?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.StoreBindExpressReadMapper">
  <resultMap id="resultMap" type="com.slodon.b2b2c.seller.pojo.StoreBindExpress">
    <id column="bind_id" property="bindId" />
    <result column="store_id" property="storeId" />
    <result column="express_id" property="expressId" />
    <result column="express_name" property="expressName" />
    <result column="express_state" property="expressState" />
    <result column="express_code" property="expressCode" />
    <result column="express_website" property="expressWebsite" />
    <result column="create_time" property="createTime" />
    <result column="pay_type" property="payType" />
    <result column="customer_name" property="customerName" />
    <result column="customer_pwd" property="customerPwd" />
    <result column="send_site" property="sendSite" />
    <result column="send_staff" property="sendStaff" />
    <result column="month_code" property="monthCode" />
    <result column="template_size" property="templateSize" />
    <result column="template_id" property="templateId" />
    <result column="partner_name" property="partnerName" />
    <result column="code" property="code" />
    <result column="exp_type" property="expType" />
  </resultMap>
  <!--按照主键值进行操作-->
  <sql id="pkWhere">
    WHERE `bind_id` = #{primaryKey}
  </sql>
  <!--操作条件-->
  <sql id="whereCondition">
    <if test="example != null">
      <trim prefix="WHERE" prefixOverrides="AND|OR">
        <if test="example.bindIdNotEquals != null">
          AND `bind_id` != #{example.bindIdNotEquals}
        </if>
        <if test="example.bindIdIn != null">
          AND `bind_id` in (${example.bindIdIn})
        </if>
        <if test="example.storeId != null">
          AND `store_id` = #{example.storeId}
        </if>
        <if test="example.expressId != null">
          AND `express_id` = #{example.expressId}
        </if>
        <if test="example.expressName != null">
          AND `express_name` = #{example.expressName}
        </if>
        <if test="example.expressNameLike != null">
          AND `express_name` like concat('%',#{example.expressNameLike},'%')
        </if>
        <if test="example.expressState != null">
          AND `express_state` = #{example.expressState}
        </if>
        <if test="example.expressStateIn != null">
          AND `express_state` in (${example.expressStateIn})
        </if>
        <if test="example.expressStateNotIn != null">
          AND `express_state` not in (${example.expressStateNotIn})
        </if>
        <if test="example.expressStateNotEquals != null">
          AND `express_state` != #{example.expressStateNotEquals}
        </if>
        <if test="example.expressCode != null">
          AND `express_code` = #{example.expressCode}
        </if>
        <if test="example.expressWebsite != null">
          AND `express_website` = #{example.expressWebsite}
        </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.payType != null">
          AND `pay_type` = #{example.payType}
        </if>
        <if test="example.customerName != null">
          AND `customer_name` = #{example.customerName}
        </if>
        <if test="example.customerNameLike != null">
          AND `customer_name` like concat('%',#{example.customerNameLike},'%')
        </if>
        <if test="example.customerPwd != null">
          AND `customer_pwd` = #{example.customerPwd}
        </if>
        <if test="example.sendSite != null">
          AND `send_site` = #{example.sendSite}
        </if>
        <if test="example.sendStaff != null">
          AND `send_staff` = #{example.sendStaff}
        </if>
        <if test="example.monthCode != null">
          AND `month_code` = #{example.monthCode}
        </if>
        <if test="example.templateSize != null">
          AND `template_size` = #{example.templateSize}
        </if>
        <if test="example.templateId != null">
          AND `template_id` = #{example.templateId}
        </if>
        <if test="example.partnerName != null">
          AND `partner_name` = #{example.partnerName}
        </if>
        <if test="example.partnerNameLike != null">
          AND `partner_name` like concat('%',#{example.partnerNameLike},'%')
        </if>
        <if test="example.code != null">
          AND `code` = #{example.code}
        </if>
        <if test="example.expType != null">
          AND `exp_type` = #{example.expType}
        </if>
      </trim>
    </if>
  </sql>
  <!--排序条件-->
  <sql id="orderBy">
    ORDER BY `bind_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.StoreBindExpressExample" resultType="java.lang.Integer">
    SELECT
      COUNT(*)
    FROM `store_bind_express`
    <include refid="whereCondition" />
  </select>
  <!--根据主键查询记录-->
  <select id="getByPrimaryKey" resultMap="resultMap">
    SELECT
      *
    FROM `store_bind_express`
    <include refid="pkWhere" />
  </select>
  <!--查询符合条件的记录(所有字段)-->
  <select id="listByExample" resultMap="resultMap">
    SELECT
      *
    FROM `store_bind_express`
    <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_bind_express`
    <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_bind_express`
    <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_bind_express`
    <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>