<?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.gxwebsoft.shop.mapper.ShopExpressMapper">

    <!-- 关联查询sql -->
    <sql id="selectSql">
        SELECT a.*
        FROM shop_express a
        <where>
            <if test="param.expressId != null">
                AND a.express_id = #{param.expressId}
            </if>
            <if test="param.expressName != null">
                AND a.express_name LIKE CONCAT('%', #{param.expressName}, '%')
            </if>
            <if test="param.wxCode != null">
                AND a.wx_code LIKE CONCAT('%', #{param.wxCode}, '%')
            </if>
            <if test="param.kuaidi100Code != null">
                AND a.kuaidi100_code LIKE CONCAT('%', #{param.kuaidi100Code}, '%')
            </if>
            <if test="param.kdniaoCode != null">
                AND a.kdniao_code LIKE CONCAT('%', #{param.kdniaoCode}, '%')
            </if>
            <if test="param.sortNumber != null">
                AND a.sort_number = #{param.sortNumber}
            </if>
            <if test="param.deleted != null">
                AND a.deleted = #{param.deleted}
            </if>
            <if test="param.deleted == null">
                AND a.deleted = 0
            </if>
            <if test="param.createTimeStart != null">
                AND a.create_time &gt;= #{param.createTimeStart}
            </if>
            <if test="param.createTimeEnd != null">
                AND a.create_time &lt;= #{param.createTimeEnd}
            </if>
            <if test="param.keywords != null">
                AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%')
                )
              </if>
        </where>
    </sql>

    <!-- 分页查询 -->
    <select id="selectPageRel" resultType="com.gxwebsoft.shop.entity.ShopExpress">
        <include refid="selectSql"></include>
    </select>

    <!-- 查询全部 -->
    <select id="selectListRel" resultType="com.gxwebsoft.shop.entity.ShopExpress">
        <include refid="selectSql"></include>
    </select>

</mapper>
