<?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.ruoyi.shipping.mapper.TAddressMapper">

    <resultMap type="TAddress" id="TAddressResult">
        <result property="fId" column="f_id"/>
        <result property="fTypes" column="f_types"/>
        <result property="fNo" column="f_no"/>
        <result property="fName" column="f_name"/>
        <result property="fEname" column="f_ename"/>
        <result property="fLaneid" column="f_laneid"/>
        <result property="fPortid" column="f_portid"/>
        <result property="fCountry" column="f_country"/>
        <result property="fProvince" column="f_province"/>
        <result property="fCity" column="f_city"/>
        <result property="fTel" column="f_tel"/>
        <result property="fEmail" column="f_email"/>
        <result property="fManagerid" column="f_managerid"/>
        <result property="fUncode" column="f_uncode"/>
        <result property="fPort" column="f_port"/>
        <result property="fStatus" column="f_status"/>
        <result property="createBy" column="create_by"/>
        <result property="createTime" column="create_time"/>
        <result property="updateBy" column="update_by"/>
        <result property="updateTime" column="update_time"/>
        <result property="remark" column="remark"/>
    </resultMap>

    <sql id="selectTAddressVo">
        select f_id, f_types, f_no, f_name, f_ename, f_laneid, f_portid, f_country, f_province, f_city, f_tel, f_email, f_managerid, f_uncode, f_port, case when f_status = 'T' then '正常' else '停用' end as f_status, create_by, create_time, update_by, update_time, remark from t_address
    </sql>

    <select id="selectTAddressList" parameterType="TAddress" resultMap="TAddressResult">
        SELECT
        t.f_id,
        t.f_types,
        t.f_no,
        t.f_name,
        t.f_ename,
        t.f_laneid,
        t.f_portid,
        t.f_country,
        t.f_province,
        t.f_city,
        t.f_tel,
        t.f_email,
        t.f_managerid,
        su.user_name managerName,
        t.f_uncode,
        t.f_port,
        CASE

        WHEN t.f_status = 'T' THEN
        '正常' ELSE '停用'
        END AS f_status,
        t.create_by,
        t.create_time,
        t.update_by,
        t.update_time,
        t.remark
        FROM
        t_address t
        LEFT JOIN ( SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'f_types' ) s ON t.f_types =
        s.dict_value
        LEFT JOIN sys_user su ON su.user_id = t.f_managerid
        WHERE
        t.f_status = 'T'
        AND s.dict_label = '航线'
        <if test="fTypes != null  and fTypes != ''">and t.f_types = #{fTypes}</if>
        <if test="fNo != null  and fNo != ''">and t.f_no = #{fNo}</if>
        <if test="fName != null  and fName != ''">and t.f_name like concat('%', #{fName}, '%')</if>
        <if test="fEname != null  and fEname != ''">and t.f_ename like concat('%', #{fEname}, '%')</if>
        <if test="fLaneid != null ">and t.f_laneid = #{fLaneid}</if>
        <if test="fPortid != null ">and t.f_portid = #{fPortid}</if>
        <if test="fCountry != null  and fCountry != ''">and t.f_country = #{fCountry}</if>
        <if test="fProvince != null  and fProvince != ''">and t.f_province = #{fProvince}</if>
        <if test="fCity != null  and fCity != ''">and t.f_city = #{fCity}</if>
        <if test="fTel != null  and fTel != ''">and t.f_tel = #{fTel}</if>
        <if test="fEmail != null  and fEmail != ''">and t.f_email = #{fEmail}</if>
        <if test="fManagerid != null ">and t.f_managerid = #{fManagerid}</if>
        <if test="fUncode != null  and fUncode != ''">and t.f_uncode = #{fUncode}</if>
        <if test="fPort != null  and fPort != ''">and t.f_port = #{fPort}</if>
        <if test="fStatus != null  and fStatus != ''">and t.f_status = #{fStatus}</if>
        <if test='cLoadDate != null and cLoadDate[0] != null and cLoadDate[0]!= ""'>
            and t.create_time &gt;= #{cLoadDate[0]}
        </if>
        <if test='cLoadDate != null and cLoadDate[1] != null and cLoadDate[1]!= ""'>
            and t.create_time &lt;= #{cLoadDate[1]}
        </if>
        ORDER BY CONVERT(t.f_name USING gbk) asc
    </select>
    <select id="selectCarriageList" parameterType="TAddress" resultMap="TAddressResult">
        SELECT
        t.f_id,
        t.f_types,
        t.f_no,
        t.f_name,
        t.f_ename,
        t.f_laneid,
        t.f_portid,
        t.f_country,
        t.f_province,
        t.f_city,
        t.f_tel,
        t.f_email,
        t.f_managerid,
        su.user_name managerName,
        t.f_uncode,
        t.f_port,
        CASE

        WHEN t.f_status = 'T' THEN
        '正常' ELSE '停用'
        END AS f_status,
        t.create_by,
        t.create_time,
        t.update_by,
        t.update_time,
        t.remark
        FROM
        t_address t
        LEFT JOIN ( SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'f_types' ) s ON t.f_types =
        s.dict_value
        LEFT JOIN sys_user su ON su.user_id = t.f_managerid
        WHERE
        t.f_status = 'T'
        AND s.dict_label = '运输'
        <if test="fTypes != null  and fTypes != ''">and t.f_types = #{fTypes}</if>
        <if test="fNo != null  and fNo != ''">and t.f_no = #{fNo}</if>
        <if test="fName != null  and fName != ''">and t.f_name like concat('%', #{fName}, '%')</if>
        <if test="fEname != null  and fEname != ''">and t.f_ename like concat('%', #{fEname}, '%')</if>
        <if test="fLaneid != null ">and t.f_laneid = #{fLaneid}</if>
        <if test="fPortid != null ">and t.f_portid = #{fPortid}</if>
        <if test="fCountry != null  and fCountry != ''">and t.f_country = #{fCountry}</if>
        <if test="fProvince != null  and fProvince != ''">and t.f_province = #{fProvince}</if>
        <if test="fCity != null  and fCity != ''">and t.f_city = #{fCity}</if>
        <if test="fTel != null  and fTel != ''">and t.f_tel = #{fTel}</if>
        <if test="fEmail != null  and fEmail != ''">and t.f_email = #{fEmail}</if>
        <if test="fManagerid != null ">and t.f_managerid = #{fManagerid}</if>
        <if test="fUncode != null  and fUncode != ''">and t.f_uncode = #{fUncode}</if>
        <if test="fPort != null  and fPort != ''">and t.f_port = #{fPort}</if>
        <if test="fStatus != null  and fStatus != ''">and t.f_status = #{fStatus}</if>
        <if test='cLoadDate != null and cLoadDate[0] != null and cLoadDate[0]!= ""'>
            and t.create_time &gt;= #{cLoadDate[0]}
        </if>
        <if test='cLoadDate != null and cLoadDate[1] != null and cLoadDate[1]!= ""'>
            and t.create_time &lt;= #{cLoadDate[1]}
        </if>
        ORDER BY CONVERT(t.f_name USING gbk) asc
    </select>

    <select id="selectTAddressBasicList" parameterType="TAddress" resultMap="TAddressResult">
         select f_id, f_types, f_no, f_name from t_address
        <where>
            <if test="fTypes != null  and fTypes != ''"> and f_types = #{fTypes}</if>
            <if test="fNo != null  and fNo != ''"> and f_no = #{fNo}</if>
            <if test="fName != null  and fName != ''"> and f_name like concat('%', #{fName}, '%')</if>
            <if test="fEname != null  and fEname != ''"> and f_ename like concat('%', #{fEname}, '%')</if>
            <if test="fLaneid != null "> and f_laneid = #{fLaneid}</if>
            <if test="fPortid != null "> and f_portid = #{fPortid}</if>
            <if test="fCountry != null  and fCountry != ''"> and f_country = #{fCountry}</if>
            <if test="fProvince != null  and fProvince != ''"> and f_province = #{fProvince}</if>
            <if test="fCity != null  and fCity != ''"> and f_city = #{fCity}</if>
            <if test="fTel != null  and fTel != ''"> and f_tel = #{fTel}</if>
            <if test="fEmail != null  and fEmail != ''"> and f_email = #{fEmail}</if>
            <if test="fManagerid != null "> and f_managerid = #{fManagerid}</if>
            <if test="fUncode != null  and fUncode != ''"> and f_uncode = #{fUncode}</if>
            <if test="fPort != null  and fPort != ''"> and f_port = #{fPort}</if>
            <if test="fStatus != null  and fStatus != ''"> and f_status = #{fStatus}</if>
        </where>
    </select>

    <select id="selectTAddressById" parameterType="Long" resultMap="TAddressResult">
        <include refid="selectTAddressVo"/>
        where f_id = #{fId}
    </select>
    <select id="selectTAddressByfName" parameterType="object" resultType="long">
        SELECT
        f_id
        FROM
        t_address
        WHERE f_name = #{fNam}
    </select>

    <select id="selectTAddressListMap" resultType="java.util.Map">

        <where>
            <if test="fTypes != null  and fTypes != ''">and f_types = #{fTypes}</if>
            <if test="fNo != null  and fNo != ''">and f_no = #{fNo}</if>
            <if test="fName != null  and fName != ''">and f_name like concat('%', #{fName}, '%')</if>
            <if test="fEname != null  and fEname != ''">and f_ename like concat('%', #{fEname}, '%')</if>
            <if test="fLaneid != null ">and f_laneid = #{fLaneid}</if>
            <if test="fPortid != null ">and f_portid = #{fPortid}</if>
            <if test="fCountry != null  and fCountry != ''">and f_country = #{fCountry}</if>
            <if test="fProvince != null  and fProvince != ''">and f_province = #{fProvince}</if>
            <if test="fCity != null  and fCity != ''">and f_city = #{fCity}</if>
            <if test="fTel != null  and fTel != ''">and f_tel = #{fTel}</if>
            <if test="fEmail != null  and fEmail != ''">and f_email = #{fEmail}</if>
            <if test="fManagerid != null ">and f_managerid = #{fManagerid}</if>
            <if test="fUncode != null  and fUncode != ''">and f_uncode = #{fUncode}</if>
            <if test="fPort != null  and fPort != ''">and f_port = #{fPort}</if>
            <if test="fStatus != null  and fStatus != ''">and f_status = #{fStatus}</if>
        </where>
    </select>


    <insert id="insertTAddress" parameterType="TAddress">
        insert into t_address
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="fId != null">f_id,</if>
            <if test="fTypes != null and fTypes != ''">f_types,</if>
            <if test="fNo != null and fNo != ''">f_no,</if>
            <if test="fName != null">f_name,</if>
            <if test="fEname != null">f_ename,</if>
            <if test="fLaneid != null">f_laneid,</if>
            <if test="fPortid != null">f_portid,</if>
            <if test="fCountry != null">f_country,</if>
            <if test="fProvince != null">f_province,</if>
            <if test="fCity != null">f_city,</if>
            <if test="fTel != null">f_tel,</if>
            <if test="fEmail != null">f_email,</if>
            <if test="fManagerid != null">f_managerid,</if>
            <if test="fUncode != null">f_uncode,</if>
            <if test="fPort != null">f_port,</if>
            <if test="fStatus != null">f_status,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="remark != null">remark,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="fId != null">#{fId},</if>
            <if test="fTypes != null and fTypes != ''">#{fTypes},</if>
            <if test="fNo != null and fNo != ''">#{fNo},</if>
            <if test="fName != null">#{fName},</if>
            <if test="fEname != null">#{fEname},</if>
            <if test="fLaneid != null">#{fLaneid},</if>
            <if test="fPortid != null">#{fPortid},</if>
            <if test="fCountry != null">#{fCountry},</if>
            <if test="fProvince != null">#{fProvince},</if>
            <if test="fCity != null">#{fCity},</if>
            <if test="fTel != null">#{fTel},</if>
            <if test="fEmail != null">#{fEmail},</if>
            <if test="fManagerid != null">#{fManagerid},</if>
            <if test="fUncode != null">#{fUncode},</if>
            <if test="fPort != null">#{fPort},</if>
            <if test="fStatus != null">#{fStatus},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="remark != null">#{remark},</if>
        </trim>
    </insert>

    <update id="updateTAddress" parameterType="TAddress">
        update t_address
        <trim prefix="SET" suffixOverrides=",">
            <if test="fTypes != null and fTypes != ''">f_types = #{fTypes},</if>
            <if test="fNo != null and fNo != ''">f_no = #{fNo},</if>
            <if test="fName != null">f_name = #{fName},</if>
            <if test="fEname != null">f_ename = #{fEname},</if>
            <if test="fLaneid != null">f_laneid = #{fLaneid},</if>
            <if test="fPortid != null">f_portid = #{fPortid},</if>
            <if test="fCountry != null">f_country = #{fCountry},</if>
            <if test="fProvince != null">f_province = #{fProvince},</if>
            <if test="fCity != null">f_city = #{fCity},</if>
            <if test="fTel != null">f_tel = #{fTel},</if>
            <if test="fEmail != null">f_email = #{fEmail},</if>
            <if test="fManagerid != null">f_managerid = #{fManagerid},</if>
            <if test="fUncode != null">f_uncode = #{fUncode},</if>
            <if test="fPort != null">f_port = #{fPort},</if>
            <if test="fStatus != null">f_status = #{fStatus},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="remark != null">remark = #{remark},</if>
        </trim>
        where f_id = #{fId}
    </update>

    <delete id="deleteTAddressById" parameterType="Long">
        delete from t_address where f_id = #{fId}
    </delete>

    <delete id="deleteTAddressByIds" parameterType="String">
        delete from t_address where f_id in
        <foreach item="fId" collection="array" open="(" separator="," close=")">
            #{fId}
        </foreach>
    </delete>
    <!--批量更新数据状态-->
    <update id="updateTAddressStatus" parameterType="string">
        update t_address
        set f_status = 'F'
        where f_id in
        <foreach item="fId" collection="array" open="(" separator="," close=")">
            #{fId}
        </foreach>
    </update>
    <!--查询堆场信息-->
    <select id="selectStockDump" parameterType="TAddress" resultMap="TAddressResult">
        SELECT
        t.f_id,
        t.f_types,
        pro.dict_label a,
        t.f_no,
        t.f_name,
        t.f_ename,
        t.f_laneid,
        t.f_portid,
        t.f_country,
        t.f_province,
        t.f_city,
        t.f_tel,
        t.f_email,
        t.f_managerid,
        t.f_uncode,
        t.f_port,
        pros.dict_label b,
        CASE

        WHEN t.f_status = 'T' THEN
        '正常使用' ELSE '停用'
        END AS f_status,
        t.create_by,
        t.create_time,
        t.update_by,
        t.update_time,
        t.remark,
        d.f_name portName,
        d.f_ename portEnglish
        FROM
        t_address t
        LEFT JOIN t_address d ON t.f_portid = d.f_id
        LEFT JOIN sys_dict_data pro ON pro.dict_value = t.f_types and pro.dict_type = 'f_types'
        LEFT JOIN sys_dict_data pros ON pros.dict_value = t.f_port and pros.dict_type = 'f_port'
        <where>
            t.f_status = 'T'
            and pro.dict_label = '堆场'
            <if test="fTypes != null  and fTypes != ''">and t.f_types = #{fTypes}</if>
            <if test="portName != null  and portName != ''">and d.f_name like concat('%', #{portName}, '%')</if>
            <if test="fNo != null  and fNo != ''">and t.f_no = #{fNo}</if>
            <if test="fName != null  and fName != ''">and t.f_name like concat('%', #{fName}, '%')</if>
            <if test="fEname != null  and fEname != ''">and t.f_ename like concat('%', #{fEname}, '%')</if>
            <if test="fLaneid != null ">and t.f_laneid = #{fLaneid}</if>
            <if test="fPortid != null ">and t.f_portid = #{fPortid}</if>
            <if test="fCountry != null  and fCountry != ''">and t.f_country = #{fCountry}</if>
            <if test="fProvince != null  and fProvince != ''">and t.f_province = #{fProvince}</if>
            <if test="fCity != null  and fCity != ''">and t.f_city = #{fCity}</if>
            <if test="fTel != null  and fTel != ''">and t.f_tel = #{fTel}</if>
            <if test="fEmail != null  and fEmail != ''">and t.f_email = #{fEmail}</if>
            <if test="fManagerid != null ">and t.f_managerid = #{fManagerid}</if>
            <if test="fUncode != null  and fUncode != ''">and t.f_uncode = #{fUncode}</if>
            <if test="fPort != null  and fPort != ''">and t.f_port = #{fPort}</if>
            <if test="fStatus != null  and fStatus != ''">and t.f_status = #{fStatus}</if>
            <if test='cLoadDate != null and cLoadDate[0] != null and cLoadDate[0]!= ""'>
                and t.create_time &gt;= #{cLoadDate[0]}
            </if>
            <if test='cLoadDate != null and cLoadDate[1] != null and cLoadDate[1]!= ""'>
                and t.create_time &lt;= #{cLoadDate[1]}
            </if>
        </where>
        ORDER BY CONVERT(t.f_name USING gbk) asc
    </select>
    <!--查询码头信息-->
    <select id="selectWarfDump" parameterType="TAddress" resultMap="TAddressResult">
        SELECT
        t.f_id,
        t.f_types,
        pro.dict_label a,
        t.f_no,
        t.f_name,
        t.f_ename,
        t.f_laneid,
        t.f_portid,
        t.f_country,
        t.f_province,
        t.f_city,
        t.f_tel,
        t.f_email,
        t.f_managerid,
        t.f_uncode,
        t.f_port,
        pros.dict_label b,
        CASE

        WHEN t.f_status = 'T' THEN
        '正常使用' ELSE '停用'
        END AS f_status,
        t.create_by,
        t.create_time,
        t.update_by,
        t.update_time,
        t.remark,
        d.f_name portName,
        d.f_ename portEnglish
        FROM
        t_address t
        LEFT JOIN t_address d ON t.f_portid = d.f_id
        LEFT JOIN sys_dict_data pro ON pro.dict_value = t.f_types and pro.dict_type = 'f_types'
        LEFT JOIN sys_dict_data pros ON pros.dict_value = t.f_port and pros.dict_type = 'f_port'
        <where>
            t.f_status = 'T'
            and pro.dict_label = '码头'
            <if test="fTypes != null  and fTypes != ''">and t.f_types = #{fTypes}</if>
            <if test="portName != null  and portName != ''">and d.f_name like concat('%', #{portName}, '%')</if>
            <if test="fNo != null  and fNo != ''">and t.f_no = #{fNo}</if>
            <if test="fName != null  and fName != ''">and t.f_name like concat('%', #{fName}, '%')</if>
            <if test="fEname != null  and fEname != ''">and t.f_ename like concat('%', #{fEname}, '%')</if>
            <if test="fLaneid != null ">and t.f_laneid = #{fLaneid}</if>
            <if test="fPortid != null ">and t.f_portid = #{fPortid}</if>
            <if test="fCountry != null  and fCountry != ''">and t.f_country = #{fCountry}</if>
            <if test="fProvince != null  and fProvince != ''">and t.f_province = #{fProvince}</if>
            <if test="fCity != null  and fCity != ''">and t.f_city = #{fCity}</if>
            <if test="fTel != null  and fTel != ''">and t.f_tel = #{fTel}</if>
            <if test="fEmail != null  and fEmail != ''">and t.f_email = #{fEmail}</if>
            <if test="fManagerid != null ">and t.f_managerid = #{fManagerid}</if>
            <if test="fUncode != null  and fUncode != ''">and t.f_uncode = #{fUncode}</if>
            <if test="fPort != null  and fPort != ''">and t.f_port = #{fPort}</if>
            <if test="fStatus != null  and fStatus != ''">and t.f_status = #{fStatus}</if>
            <if test='cLoadDate != null and cLoadDate[0] != null and cLoadDate[0]!= ""'>
                and t.create_time &gt;= #{cLoadDate[0]}
            </if>
            <if test='cLoadDate != null and cLoadDate[1] != null and cLoadDate[1]!= ""'>
                and t.create_time &lt;= #{cLoadDate[1]}
            </if>
        </where>
        ORDER BY CONVERT(t.f_name USING gbk) asc
    </select>
    <!--查看港口名称-->
    <select id="selectPortName" parameterType="TAddress" resultType="map">
        SELECT
        f_id as fId,
        f_name as fName
        FROM
        t_address t
        LEFT JOIN
        (SELECT dict_label,dict_value FROM sys_dict_data WHERE dict_type = 'f_types') s
        ON t.f_types = s.dict_value
        WHERE t.f_status = 'T'
        AND s.dict_label = '港口'
        <if test="fName != null  and fName != ''">and f_name like concat('%', #{fName}, '%')</if>
        ORDER BY CONVERT(t.f_name USING gbk) asc
    </select>
    <!--查看航线名称-->
    <select id="selectAirLineName" parameterType="TAddress" resultType="map">
        SELECT
        f_id as fId,
        f_name as fName
        FROM
        t_address t
        LEFT JOIN
        (SELECT dict_label,dict_value FROM sys_dict_data WHERE dict_type = 'f_types') s
        ON t.f_types = s.dict_value
        WHERE t.f_status = 'T'
        AND s.dict_label = '航线'
        <if test="fName != null  and fName != ''">and f_name like concat('%', #{fName}, '%')</if>
        ORDER BY CONVERT(t.f_name USING gbk) asc
    </select>
    <!--查看堆场名称-->
    <select id="selectStorageName" parameterType="TAddress" resultType="map">
        SELECT
        f_id as fId,
        f_name as fName
        FROM
        t_address t
        LEFT JOIN
        (SELECT dict_label,dict_value FROM sys_dict_data WHERE dict_type = 'f_types') s
        ON t.f_types = s.dict_value
        WHERE t.f_status = 'T'
        AND s.dict_label = '堆场'
        <if test="fName != null  and fName != ''">and f_name like concat('%', #{fName}, '%')</if>
        ORDER BY CONVERT(t.f_name USING gbk) asc
    </select>
    <!--查看码头名称-->
    <select id="selectWharfName" parameterType="TAddress" resultType="map">
        SELECT
        f_id as fId,
        f_name as fName
        FROM
        t_address t
        LEFT JOIN
        (SELECT dict_label,dict_value FROM sys_dict_data WHERE dict_type = 'f_types') s
        ON t.f_types = s.dict_value
        WHERE t.f_status = 'T'
        AND s.dict_label = '码头'
        <if test="fName != null  and fName != ''">and f_name like concat('%', #{fName}, '%')</if>
        ORDER BY CONVERT(t.f_name USING gbk) asc
    </select>
    <!--查询港口信息-->
    <select id="selectPortDump" parameterType="TAddress" resultMap="TAddressResult">
        SELECT
        t.f_id,
        t.f_types,
        pro.dict_label typesName,
        t.f_no ,
        t.f_name ,
        t.f_ename ,
        t.f_laneid,
        t.f_portid ,
        t.f_country ,
        t.f_province ,
        t.f_city ,
        t.f_tel ,
        t.f_email ,
        t.f_managerid ,
        t.f_uncode ,
        t.f_port ,
        pros.dict_label havenName,
        t.create_by,
        t.create_time,
        t.update_by,
        t.update_time,
        t.remark,
        CASE
        WHEN t.f_status = 'T' THEN
        '正常使用' ELSE '停用'
        END AS f_status,
        d.f_name portName,
        d.f_ename portEnglish
        FROM
        t_address t
        LEFT JOIN t_address d ON t.f_laneid = d.f_id
        LEFT JOIN sys_dict_data pro ON pro.dict_value = t.f_types and pro.dict_type = 'f_types'
        LEFT JOIN sys_dict_data pros ON pros.dict_value = t.f_port and pros.dict_type = 'f_port'
        <where>
            t.f_status = 'T'
            and pro.dict_label = '港口'
            <if test="fTypes != null  and fTypes != ''">and t.f_types = #{fTypes}</if>
            <if test="portName != null  and portName != ''">and d.f_name like concat('%', #{portName}, '%')</if>
            <if test="fNo != null  and fNo != ''">and t.f_no = #{fNo}</if>
            <if test="fName != null  and fName != ''">and t.f_name like concat('%', #{fName}, '%')</if>
            <if test="fEname != null  and fEname != ''">and t.f_ename like concat('%', #{fEname}, '%')</if>
            <if test="fLaneid != null ">and t.f_laneid = #{fLaneid}</if>
            <if test="fPortid != null ">and t.f_portid = #{fPortid}</if>
            <if test="fCountry != null  and fCountry != ''">and t.f_country = #{fCountry}</if>
            <if test="fProvince != null  and fProvince != ''">and t.f_province = #{fProvince}</if>
            <if test="fCity != null  and fCity != ''">and t.f_city = #{fCity}</if>
            <if test="fTel != null  and fTel != ''">and t.f_tel = #{fTel}</if>
            <if test="fEmail != null  and fEmail != ''">and t.f_email = #{fEmail}</if>
            <if test="fManagerid != null ">and t.f_managerid = #{fManagerid}</if>
            <if test="fUncode != null  and fUncode != ''">and t.f_uncode = #{fUncode}</if>
            <if test="fPort != null  and fPort != ''">and t.f_port = #{fPort}</if>
            <if test='cLoadDate != null and cLoadDate[0] != null and cLoadDate[0]!= ""'>
                and t.create_time &gt;= #{cLoadDate[0]}
            </if>
            <if test='cLoadDate != null and cLoadDate[1] != null and cLoadDate[1]!= ""'>
                and t.create_time &lt;= #{cLoadDate[1]}
            </if>
        </where>
        ORDER BY CONVERT(t.f_name USING gbk) asc
    </select>
    <select id="selectAddressFno" parameterType="TAddress" resultMap="TAddressResult">
        SELECT
            f_id,
            f_no
        FROM
        t_address
        WHERE
        f_types = #{fTypes}
        and f_no = #{fNo}
        ORDER BY  CONVERT(f_name USING gbk) asc
    </select>
    <select id="selectAddressFName" parameterType="TAddress" resultMap="TAddressResult">
        SELECT
            f_id,
            f_no
        FROM
        t_address
        WHERE
        f_types = #{fTypes}
        and f_name = #{fName}
        ORDER BY  CONVERT(f_name USING gbk) asc
    </select>
    <select id="selectadress" parameterType="TAddress" resultMap="TAddressResult">
        SELECT
            t.f_id,
            t.f_name ,
            pro.dict_label typesName
        FROM
            t_address t
        LEFT JOIN
            sys_dict_data pro ON pro.dict_value = t.f_types and pro.dict_type = 'f_types'
        where t.f_status = 'T' AND pro.dict_label &lt;&gt; '航线'
        ORDER BY  CONVERT(t.f_name USING gbk) asc
    </select>


</mapper>