<?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.sckw.path.mapper.KwBusinessPathMapper">

    <sql id="Base_Column_List">
        id,
                `name`,
                load_address_id,
                load_name,
                load_city_code,
                load_city_name,
                load_detail_address,
                load_lat,
                load_lng,
                unload_address_id,
                unload_name,
                unload_city_code,
                unload_city_name,
                unload_detail_address,
                unload_lat,
                unload_lng,
                transport_mileage,
                transport_price,
                transport_amount,
                `status`,
                billing_mode,
                remark,
                update_time,
                update_by,
                create_time,
                create_by,
                del_flag
    </sql>

    <select id="selectPageList" resultType="com.sckw.path.entity.res.PathPageListRes">
        SELECT <include refid="Base_Column_List" />
        FROM kw_business_path
        <where>
            del_flag = 0
            <if test="params.keywords != null and params.keywords != ''">
                and (
                `name` like concat('%', #{params.keywords}, '%')
                or load_name like concat('%', #{params.keywords}, '%')
                or unload_name like concat('%', #{params.keywords}, '%')
                )
            </if>
            <if test="params.startCreateTime != null ">
                and create_time &gt;= #{params.startCreateTime}
            </if>
            <if test="params.endCreateTime != null ">
                and create_time &lt;= #{params.endCreateTime}
            </if>
        </where>
    </select>

    <select id="selectFindList" resultType="com.sckw.path.entity.res.PathFindListRes">
        select id, `name`, load_name, unload_name from kw_business_path
        <where>
            del_flag = 0
            <if test="params.name != null and params.name != ''">
                and `name` like concat('%',#{params.name,jdbcType=VARCHAR},'%')
            </if>
        </where>
    </select>
</mapper>