123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640 |
- <?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.TVoyageMapper">
- <resultMap type="TVoyage" id="TVoyageResult">
- <result property="fId" column="f_id"/>
- <result property="fPid" column="f_pid"/>
- <result property="fNo" column="f_no"/>
- <result property="fPortofloadid" column="f_portofloadid"/>
- <result property="fPortofdischargeid" column="f_portofdischargeid"/>
- <result property="fDistinationid" column="f_distinationid"/>
- <result property="fPortoftransshipment" column="f_portoftransshipment"/>
- <result property="fEtd" column="f_ETD"/>
- <result property="fAtd" column="f_ATD"/>
- <result property="fEta" column="f_ETA"/>
- <result property="fAta" column="f_ATA"/>
- <result property="fDays" column="f_days"/>
- <result property="fDucomentrayoffdate" column="f_ducomentrayoffdate"/>
- <result property="fCutoffdate" column="f_cutoffdate"/>
- <result property="fTeu" column="f_teu"/>
- <result property="fManageid" column="f_manageid"/>
- <result property="fTel" column="f_tel"/>
- <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"/>
- <result property="fLaneid" column="f_laneid"/>
- </resultMap>
- <sql id="selectTVoyageVo">
- select f_id, f_pid, f_no, f_portofloadid, f_portofdischargeid, f_distinationid, f_portoftransshipment, f_ETD, f_ATD, f_ETA, f_ATA, f_days, f_ducomentrayoffdate, f_cutoffdate, f_teu, f_manageid, f_tel, case when f_status = 'T' then '正常' else '停用' end as f_status, create_by, create_time, update_by, update_time, remark,f_laneid from t_voyage
- </sql>
- <select id="selectTVoyageList" parameterType="TVoyage" resultMap="TVoyageResult">
- SELECT
- DISTINCT
- tv.f_id,
- tv.f_pid,
- te.f_name pidName,
- tv.f_no,
- tv.f_portofloadid,
- ta.f_name portofloadidName,
- tv.f_portofdischargeid,
- td.f_name portofdischargeidName,
- tv.f_distinationid,
- tr.f_name distinationidName,
- tv.f_portoftransshipment,
- ts.f_name portoftransshipmentName,
- tv.f_ETD,
- tv.f_ATD,
- tv.f_ETA,
- tv.f_ATA,
- tv.f_days,
- tv.f_ducomentrayoffdate,
- tv.f_cutoffdate,
- tv.f_teu,
- tv.f_manageid,
- su.user_name manageidName,
- tv.f_tel,
- CASE
- WHEN tv.f_status = 'T' THEN
- '正常' ELSE '停用'
- END AS f_status,
- TIMESTAMPDIFF(DAY,tv.f_ETD,DATE_FORMAT(tv.f_ducomentrayoffdate, '%Y-%m-%d %H:%i:%S')) closing,
- tv.create_by,
- tv.create_time,
- tv.update_by,
- tv.update_time,
- tv.remark,
- tv.f_laneid,
- tes.f_name as fLaneName
- FROM
- t_voyage tv
- LEFT JOIN t_vessel te ON tv.f_pid = te.f_id
- LEFT JOIN t_address ta ON tv.f_portofloadid = ta.f_id
- LEFT JOIN t_address td ON tv.f_portofdischargeid = td.f_id
- LEFT JOIN t_address tr ON tv.f_distinationid = tr.f_id
- LEFT JOIN t_address ts ON tv.f_portoftransshipment = ts.f_id
- LEFT JOIN sys_user su ON tv.f_manageid = su.user_id
- LEFT JOIN t_address tes ON tv.f_laneid = tes.f_id
- <where>
- <if test="fPid != null ">and tv.f_pid = #{fPid}</if>
- <if test="fNo != null and fNo != ''">and tv.f_no = #{fNo}</if>
- <if test="fPortofloadid != null ">and tv.f_portofloadid = #{fPortofloadid}</if>
- <if test="fPortofdischargeid != null ">and tv.f_portofdischargeid = #{fPortofdischargeid}</if>
- <if test="fDistinationid != null ">and tv.f_distinationid = #{fDistinationid}</if>
- <if test="fPortoftransshipment != null ">and tv.f_portoftransshipment = #{fPortoftransshipment}</if>
- <if test="fPortoftransshipment == null and empty != null">and tv.f_portoftransshipment IS NULL</if>
- <if test="fEtd != null ">and tv.f_ETD = #{fEtd}</if>
- <if test="fAtd != null ">and tv.f_ATD = #{fAtd}</if>
- <if test="fEta != null ">and tv.f_ETA = #{fEta}</if>
- <if test="fAta != null ">and tv.f_ATA = #{fAta}</if>
- <if test="fDays != null ">and tv.f_days = #{fDays}</if>
- <if test="fDucomentrayoffdate != null ">and tv.f_ducomentrayoffdate = #{fDucomentrayoffdate}</if>
- <if test="fCutoffdate != null ">and tv.f_cutoffdate = #{fCutoffdate}</if>
- <if test="fTeu != null and fTeu != ''">and tv.f_teu = #{fTeu}</if>
- <if test="fManageid != null ">and tv.f_manageid = #{fManageid}</if>
- <if test="fTel != null and fTel != ''">and tv.f_tel = #{fTel}</if>
- <if test="fStatus != null and fStatus != ''">and tv.f_status = #{fStatus}</if>
- <if test="createBy != null and createBy != ''">and tv.create_by like concat('%', #{createBy}, '%')</if>
- <if test="remark != null and remark != ''">and tv.remark like concat('%', #{remark}, '%')</if>
- <if test="pidName != null and pidName != ''">and te.f_name = #{pidName}</if>
- <if test="portofloadidName != null and portofloadidName != ''">and ta.f_name = #{portofloadidName}</if>
- <if test="portofdischargeidName != null and portofdischargeidName != ''">and td.f_name =
- #{portofdischargeidName}
- </if>
- <if test="distinationidName != null and distinationidName != ''">and tr.f_name = #{distinationidName}</if>
- <if test="portoftransshipmentName != null and portoftransshipmentName != ''">and ts.f_name =
- #{portoftransshipmentName}
- </if>
- <if test='cLoadDate != null and cLoadDate[0] != null and cLoadDate[0]!= ""'>
- and tv.create_time >= #{cLoadDate[0]}
- </if>
- <if test='cLoadDate != null and cLoadDate[1] != null and cLoadDate[1]!= ""'>
- and tv.create_time <= #{cLoadDate[1]}
- </if>
- <if test="fLaneid != null ">and f_laneid = #{fLaneid}</if>
- </where>
- </select>
- <select id="selectMessage" parameterType="TVoyage" resultMap="TVoyageResult">
- SELECT
- tv.f_id,
- tv.f_pid,
- te.f_name pidName,
- tv.f_no,
- tv.f_portofloadid,
- ta.f_name portofloadidName,
- tv.f_portofdischargeid,
- td.f_name portofdischargeidName,
- tv.f_distinationid,
- tr.f_name distinationidName,
- tv.f_portoftransshipment,
- ts.f_name portoftransshipmentName,
- tv.f_ETD,
- tv.f_ATD,
- tv.f_ETA,
- tv.f_ATA,
- tv.f_days,
- tv.f_ducomentrayoffdate,
- tv.f_cutoffdate,
- tv.f_teu,
- tv.f_manageid,
- su.user_name manageidName,
- tv.f_tel,
- CASE
- WHEN tv.f_status = 'T' THEN
- '正常' ELSE '停用'
- END AS f_status,
- TIMESTAMPDIFF(DAY,tv.f_ETD,DATE_FORMAT(tv.f_ducomentrayoffdate, '%Y-%m-%d %H:%i:%S')) closing,
- tv.create_by,
- tv.create_time,
- tv.update_by,
- tv.update_time,
- tv.remark,
- tv.f_laneid
- FROM
- t_voyage tv
- LEFT JOIN t_vessel te ON tv.f_pid = te.f_id
- LEFT JOIN t_address ta ON tv.f_portofloadid = ta.f_id
- LEFT JOIN t_address td ON tv.f_portofdischargeid = td.f_id
- LEFT JOIN t_address tr ON tv.f_distinationid = tr.f_id
- LEFT JOIN t_address ts ON tv.f_portoftransshipment = ts.f_id
- LEFT JOIN sys_user su ON tv.f_manageid = su.user_id
- <where>
- tv.f_status = 'T'
- AND (date(tv.f_ATD) >= DATE_SUB(CURDATE(), INTERVAL 2 DAY)
- OR tv.f_ATD IS NULL)
- <if test="fId != null ">and tv.f_id = #{fId}</if>
- <if test="fPid != null ">and tv.f_pid = #{fPid}</if>
- <if test="fNo != null and fNo != ''">and tv.f_no = #{fNo}</if>
- <if test="fPortofloadid != null ">and tv.f_portofloadid = #{fPortofloadid}</if>
- <if test="fPortofdischargeid != null ">and tv.f_portofdischargeid = #{fPortofdischargeid}</if>
- <if test="fDistinationid != null ">and tv.f_distinationid = #{fDistinationid}</if>
- <if test="fPortoftransshipment != null ">and tv.f_portoftransshipment = #{fPortoftransshipment}</if>
- <if test="fPortoftransshipment == null and empty != null">and tv.f_portoftransshipment IS NULL</if>
- <if test="fEtd != null ">and tv.f_ETD = #{fEtd}</if>
- <if test="fAtd != null ">and tv.f_ATD = #{fAtd}</if>
- <if test="fEta != null ">and tv.f_ETA = #{fEta}</if>
- <if test="fAta != null ">and tv.f_ATA = #{fAta}</if>
- <if test="fDays != null ">and tv.f_days = #{fDays}</if>
- <if test="fDucomentrayoffdate != null ">and tv.f_ducomentrayoffdate = #{fDucomentrayoffdate}</if>
- <if test="fCutoffdate != null ">and tv.f_cutoffdate = #{fCutoffdate}</if>
- <if test="fTeu != null and fTeu != ''">and tv.f_teu = #{fTeu}</if>
- <if test="fManageid != null ">and tv.f_manageid = #{fManageid}</if>
- <if test="fTel != null and fTel != ''">and tv.f_tel = #{fTel}</if>
- <if test="fStatus != null and fStatus != ''">and tv.f_status = #{fStatus}</if>
- <if test="createBy != null and createBy != ''">and tv.create_by like concat('%', #{createBy}, '%')</if>
- <if test="remark != null and remark != ''">and tv.remark like concat('%', #{remark}, '%')</if>
- <if test="pidName != null and pidName != ''">and te.f_name = #{pidName}</if>
- <if test="portofloadidName != null and portofloadidName != ''">and ta.f_name = #{portofloadidName}</if>
- <if test="portofdischargeidName != null and portofdischargeidName != ''">and td.f_name =
- #{portofdischargeidName}
- </if>
- <if test="distinationidName != null and distinationidName != ''">and tr.f_name = #{distinationidName}</if>
- <if test="portoftransshipmentName != null and portoftransshipmentName != ''">and ts.f_name =
- #{portoftransshipmentName}
- </if>
- <if test='cLoadDate != null and cLoadDate[0] != null and cLoadDate[0]!= ""'>
- and tv.create_time >= #{cLoadDate[0]}
- </if>
- <if test='cLoadDate != null and cLoadDate[1] != null and cLoadDate[1]!= ""'>
- and tv.create_time <= #{cLoadDate[1]}
- </if>
- <if test="fLaneid != null ">and f_laneid = #{fLaneid}</if>
- </where>
- </select>
- <select id="selectTVoyageListNew" parameterType="TVoyage" resultMap="TVoyageResult">
- SELECT
- tv.f_id,
- tv.f_pid,
- te.f_name pidName,
- tv.f_no,
- tv.f_portofloadid,
- ta.f_name portofloadidName,
- tv.f_portofdischargeid,
- td.f_name portofdischargeidName,
- tv.f_distinationid,
- tr.f_name distinationidName,
- tv.f_portoftransshipment,
- ts.f_name portoftransshipmentName,
- tv.f_ETD,
- tv.f_ATD,
- tv.f_ETA,
- tv.f_ATA,
- tv.f_days,
- tv.f_ducomentrayoffdate,
- tv.f_cutoffdate,
- tv.f_teu,
- tv.f_manageid,
- su.user_name manageidName,
- tv.f_tel,
- CASE
- WHEN tv.f_status = 'T' THEN
- '正常' ELSE '停用'
- END AS f_status,
- TIMESTAMPDIFF(DAY,tv.f_ETD,DATE_FORMAT(tv.f_ducomentrayoffdate, '%Y-%m-%d %H:%i:%S')) closing,
- tv.create_by,
- tv.create_time,
- tv.update_by,
- tv.update_time,
- tv.remark,
- tv.f_laneid
- FROM
- t_voyage tv
- LEFT JOIN t_vessel te ON tv.f_pid = te.f_id
- LEFT JOIN t_address ta ON tv.f_portofloadid = ta.f_id
- LEFT JOIN t_address td ON tv.f_portofdischargeid = td.f_id
- LEFT JOIN t_address tr ON tv.f_distinationid = tr.f_id
- LEFT JOIN t_address ts ON tv.f_portoftransshipment = ts.f_id
- LEFT JOIN sys_user su ON tv.f_manageid = su.user_id
- <where>
- tv.f_status = 'T'
- AND (date(tv.f_ATD) >= DATE_SUB(CURDATE(), INTERVAL 2 DAY)
- OR tv.f_ATD IS NULL)
- <if test="fPid != null ">and tv.f_pid = #{fPid}</if>
- <if test="fNo != null and fNo != ''">and tv.f_no = #{fNo}</if>
- <if test="fPortofloadid != null ">and tv.f_portofloadid = #{fPortofloadid}</if>
- <if test="fPortofdischargeid != null ">and tv.f_portofdischargeid = #{fPortofdischargeid}</if>
- <if test="fDistinationid != null ">and tv.f_distinationid = #{fDistinationid}</if>
- <if test="fPortoftransshipment != null ">and tv.f_portoftransshipment = #{fPortoftransshipment}</if>
- <if test="fPortoftransshipment == null and empty != null">and tv.f_portoftransshipment IS NULL</if>
- <if test="fEtd != null ">and tv.f_ETD = #{fEtd}</if>
- <if test="fAtd != null ">and tv.f_ATD = #{fAtd}</if>
- <if test="fEta != null ">and tv.f_ETA = #{fEta}</if>
- <if test="fAta != null ">and tv.f_ATA = #{fAta}</if>
- <if test="fDays != null ">and tv.f_days = #{fDays}</if>
- <if test="fDucomentrayoffdate != null ">and tv.f_ducomentrayoffdate = #{fDucomentrayoffdate}</if>
- <if test="fCutoffdate != null ">and tv.f_cutoffdate = #{fCutoffdate}</if>
- <if test="fTeu != null and fTeu != ''">and tv.f_teu = #{fTeu}</if>
- <if test="fManageid != null ">and tv.f_manageid = #{fManageid}</if>
- <if test="fTel != null and fTel != ''">and tv.f_tel = #{fTel}</if>
- <if test="fStatus != null and fStatus != ''">and tv.f_status = #{fStatus}</if>
- <if test="createBy != null and createBy != ''">and tv.create_by like concat('%', #{createBy}, '%')</if>
- <if test="remark != null and remark != ''">and tv.remark like concat('%', #{remark}, '%')</if>
- <if test="pidName != null and pidName != ''">and te.f_name = #{pidName}</if>
- <if test="portofloadidName != null and portofloadidName != ''">and ta.f_name = #{portofloadidName}</if>
- <if test="portofdischargeidName != null and portofdischargeidName != ''">and td.f_name =
- #{portofdischargeidName}
- </if>
- <if test="distinationidName != null and distinationidName != ''">and tr.f_name = #{distinationidName}</if>
- <if test="portoftransshipmentName != null and portoftransshipmentName != ''">and ts.f_name =
- #{portoftransshipmentName}
- </if>
- <if test='cLoadDate != null and cLoadDate[0] != null and cLoadDate[0]!= ""'>
- and tv.create_time >= #{cLoadDate[0]}
- </if>
- <if test='cLoadDate != null and cLoadDate[1] != null and cLoadDate[1]!= ""'>
- and tv.create_time <= #{cLoadDate[1]}
- </if>
- <if test="fLaneid != null ">and f_laneid = #{fLaneid}</if>
- </where>
- </select>
- <select id="selectTVoyageById" parameterType="Long" resultMap="TVoyageResult">
- SELECT
- tv.f_id,
- tv.f_pid,
- te.f_name pidName,
- tv.f_no,
- tv.f_portofloadid,
- ta.f_name portofloadidName,
- tv.f_portofdischargeid,
- td.f_name portofdischargeidName,
- tv.f_distinationid,
- tr.f_name distinationidName,
- tv.f_portoftransshipment,
- ts.f_name portoftransshipmentName,
- tv.f_ETD,
- tv.f_ATD,
- tv.f_ETA,
- tv.f_ATA,
- tv.f_days,
- tv.f_ducomentrayoffdate,
- tv.f_cutoffdate,
- tv.f_teu,
- tv.f_manageid,
- su.user_name manageidName,
- tv.f_tel,
- tv.f_status,
- TIMESTAMPDIFF(
- DAY,
- tv.f_ETD,
- DATE_FORMAT( tv.f_cutoffdate, '%Y-%m-%d %H:%i:%S' )) closing,
- tv.create_by,
- tv.create_time,
- tv.update_by,
- tv.update_time,
- tv.remark,
- tv.f_laneid
- FROM
- t_voyage tv
- LEFT JOIN t_vessel te ON tv.f_pid = te.f_id
- LEFT JOIN t_address ta ON tv.f_portofloadid = ta.f_id
- LEFT JOIN t_address td ON tv.f_portofdischargeid = td.f_id
- LEFT JOIN t_address tr ON tv.f_distinationid = tr.f_id
- LEFT JOIN t_address ts ON tv.f_portoftransshipment = ts.f_id
- LEFT JOIN sys_user su ON tv.f_manageid = su.user_id
- WHERE
- tv.f_id = #{fId}
- </select>
- <insert id="insertTVoyage" parameterType="TVoyage" useGeneratedKeys="true" keyProperty="fId">
- insert into t_voyage
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="fPid != null">f_pid,</if>
- <if test="fNo != null and fNo != ''">f_no,</if>
- <if test="fPortofloadid != null">f_portofloadid,</if>
- <if test="fPortofdischargeid != null">f_portofdischargeid,</if>
- <if test="fDistinationid != null">f_distinationid,</if>
- <if test="fPortoftransshipment != null">f_portoftransshipment,</if>
- <if test="fEtd != null">f_ETD,</if>
- <if test="fAtd != null">f_ATD,</if>
- <if test="fEta != null">f_ETA,</if>
- <if test="fAta != null">f_ATA,</if>
- <if test="fDays != null">f_days,</if>
- <if test="fDucomentrayoffdate != null">f_ducomentrayoffdate,</if>
- <if test="fCutoffdate != null">f_cutoffdate,</if>
- <if test="fTeu != null">f_teu,</if>
- <if test="fManageid != null">f_manageid,</if>
- <if test="fTel != null and fTel != ''">f_tel,</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>
- <if test="fLaneid != null">f_laneid,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="fPid != null">#{fPid},</if>
- <if test="fNo != null and fNo != ''">#{fNo},</if>
- <if test="fPortofloadid != null">#{fPortofloadid},</if>
- <if test="fPortofdischargeid != null">#{fPortofdischargeid},</if>
- <if test="fDistinationid != null">#{fDistinationid},</if>
- <if test="fPortoftransshipment != null">#{fPortoftransshipment},</if>
- <if test="fEtd != null">#{fEtd},</if>
- <if test="fAtd != null">#{fAtd},</if>
- <if test="fEta != null">#{fEta},</if>
- <if test="fAta != null">#{fAta},</if>
- <if test="fDays != null">#{fDays},</if>
- <if test="fDucomentrayoffdate != null">#{fDucomentrayoffdate},</if>
- <if test="fCutoffdate != null">#{fCutoffdate},</if>
- <if test="fTeu != null">#{fTeu},</if>
- <if test="fManageid != null">#{fManageid},</if>
- <if test="fTel != null and fTel != ''">#{fTel},</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>
- <if test="fLaneid != null">#{fLaneid},</if>
- </trim>
- </insert>
- <update id="updateTVoyage" parameterType="TVoyage">
- update t_voyage
- <trim prefix="SET" suffixOverrides=",">
- <if test="fPid != null">f_pid = #{fPid},</if>
- <if test="fNo != null and fNo != ''">f_no = #{fNo},</if>
- <if test="fPortofloadid != null">f_portofloadid = #{fPortofloadid},</if>
- <if test="fPortofdischargeid != null">f_portofdischargeid = #{fPortofdischargeid},</if>
- <if test="fPortofdischargeid == null">f_portofdischargeid = null,</if>
- <if test="fDistinationid != null">f_distinationid = #{fDistinationid},</if>
- <if test="fPortoftransshipment != null">f_portoftransshipment = #{fPortoftransshipment},</if>
- <if test="fPortoftransshipment == null">f_portoftransshipment = null,</if>
- <if test="fEtd != null">f_ETD = #{fEtd},</if>
- <if test="fAtd != null">f_ATD = #{fAtd},</if>
- <if test="fEta != null">f_ETA = #{fEta},</if>
- <if test="fAta != null">f_ATA = #{fAta},</if>
- <if test="fDays != null">f_days = #{fDays},</if>
- <if test="fDucomentrayoffdate != null">f_ducomentrayoffdate = #{fDucomentrayoffdate},</if>
- <if test="fCutoffdate != null">f_cutoffdate = #{fCutoffdate},</if>
- <if test="fTeu != null">f_teu = #{fTeu},</if>
- <if test="fManageid != null">f_manageid = #{fManageid},</if>
- <if test="fTel != null and fTel != ''">f_tel = #{fTel},</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>
- <if test="fLaneid != null">f_laneid = #{fLaneid},</if>
- </trim>
- where f_id = #{fId}
- </update>
- <delete id="deleteTVoyageById" parameterType="Long">
- delete from t_voyage where f_id = #{fId}
- </delete>
- <delete id="deleteTVoyageByIds" parameterType="String">
- delete from t_voyage where f_id in
- <foreach item="fId" collection="array" open="(" separator="," close=")">
- #{fId}
- </foreach>
- </delete>
- <select id="selectTVoyagefNo" parameterType="TVoyage" resultMap="TVoyageResult">
- SELECT
- f_id,
- f_no
- FROM
- t_voyage
- WHERE
- f_no = #{fNo}
- </select>
- <select id="selectTVoyagefNumber" resultType="map">
- SELECT
- f_id fId,
- f_no fNo
- FROM
- t_voyage
- WHERE
- f_status = 'T'
- <if test="fPid != null ">and f_pid = #{fPid}</if>
- <if test="fNo != null and fNo != ''">and f_no = #{fNo}</if>
- <if test="fPortofloadid != null ">and f_portofloadid = #{fPortofloadid}</if>
- <if test="fPortofdischargeid != null ">and f_portofdischargeid = #{fPortofdischargeid}</if>
- <if test="fDistinationid != null ">and f_distinationid = #{fDistinationid}</if>
- <if test="fPortoftransshipment != null ">and f_portoftransshipment = #{fPortoftransshipment}</if>
- <if test="fEtd != null ">and f_ETD = #{fEtd}</if>
- <if test="fAtd != null ">and f_ATD = #{fAtd}</if>
- <if test="fEta != null ">and f_ETA = #{fEta}</if>
- <if test="fAta != null ">and f_ATA = #{fAta}</if>
- <if test="fDays != null ">and f_days = #{fDays}</if>
- <if test="fDucomentrayoffdate != null ">and f_ducomentrayoffdate = #{fDucomentrayoffdate}</if>
- <if test="fCutoffdate != null ">and f_cutoffdate = #{fCutoffdate}</if>
- <if test="fTeu != null and fTeu != ''">and f_teu = #{fTeu}</if>
- <if test="fManageid != null ">and f_manageid = #{fManageid}</if>
- <if test="fTel != null and fTel != ''">and f_tel = #{fTel}</if>
- <if test="fStatus != null and fStatus != ''">and f_status = #{fStatus}</if>
- <if test="fLaneid != null ">and f_laneid = #{fLaneid}</if>
- </select>
- <!--查询航次信息是否重复-->
- <select id="selectTVoyageMessage" parameterType="Long" resultMap="TVoyageResult">
- <include refid="selectTVoyageVo"/>
- where f_no = #{fNo}
- and f_portofloadid = #{fPortofloadid}
- and f_distinationid = #{fDistinationid}
- and f_ETD = #{fEtd}
- <if test="fPortoftransshipment != null ">and f_portoftransshipment = #{fPortoftransshipment}</if>
- <if test="fPortoftransshipment == null ">and f_portoftransshipment IS NULL</if>
- </select>
- <select id="selectTVoyageIds" parameterType="TVoyage" resultType="long">
- SELECT
- tv.f_id
- FROM
- t_voyage tv
- <where>
- tv.f_status = 'T'
- AND (date(tv.f_ATD) >= DATE_SUB(CURDATE(), INTERVAL 2 DAY)
- OR tv.f_ATD IS NULL)
- <if test="fPortofloadid != null ">and tv.f_portofloadid = #{fPortofloadid}</if>
- <if test="fDistinationid != null ">and tv.f_distinationid = #{fDistinationid}</if>
- <if test="fPortoftransshipment != null ">and tv.f_portoftransshipment = #{fPortoftransshipment}</if>
- <if test="fPortoftransshipment == null">and tv.f_portoftransshipment IS NULL</if>
- </where>
- </select>
- <select id="selectTVoyageByFid" parameterType="TVoyage" resultMap="TVoyageResult">
- SELECT
- tv.f_id,
- tv.f_pid,
- te.f_name pidName,
- tv.f_no,
- tv.f_portofloadid,
- ta.f_name portofloadidName,
- tv.f_portofdischargeid,
- td.f_name portofdischargeidName,
- tv.f_distinationid,
- tr.f_name distinationidName,
- tv.f_portoftransshipment,
- ts.f_name portoftransshipmentName,
- tv.f_ETD,
- tv.f_ATD,
- tv.f_ETA,
- tv.f_ATA,
- tv.f_days,
- tv.f_ducomentrayoffdate,
- tv.f_cutoffdate,
- tv.f_teu,
- tv.f_manageid,
- su.user_name manageidName,
- tv.f_tel,
- CASE
- WHEN tv.f_status = 'T' THEN
- '正常' ELSE '停用'
- END AS f_status,
- TIMESTAMPDIFF(
- DAY,
- tv.f_ETD,
- DATE_FORMAT( tv.f_ducomentrayoffdate, '%Y-%m-%d %H:%i:%S' )) closing,
- tv.create_by,
- tv.create_time,
- tv.update_by,
- tv.update_time,
- tv.remark,
- tv.f_laneid,
- SUM( CASE WHEN tc.fNo = '20GP' THEN tc.price ELSE 0 END ) AS twenty,
- SUM( CASE WHEN tc.fNo = '40HC' THEN tc.price ELSE 0 END ) AS fortyHc,
- SUM( CASE WHEN tc.fNo = '40RH' THEN tc.price ELSE 0 END ) AS fortyRh
- FROM
- t_voyage tv
- LEFT JOIN t_vessel te ON tv.f_pid = te.f_id
- LEFT JOIN t_address ta ON tv.f_portofloadid = ta.f_id
- LEFT JOIN t_address td ON tv.f_portofdischargeid = td.f_id
- LEFT JOIN t_address tr ON tv.f_distinationid = tr.f_id
- LEFT JOIN t_address ts ON tv.f_portoftransshipment = ts.f_id
- LEFT JOIN sys_user su ON tv.f_manageid = su.user_id
- LEFT JOIN (
- SELECT
- ti.f_pid pId,
- ti.f_price price,
- tc.f_no fNo
- FROM
- t_ctnprice_items ti
- LEFT JOIN t_cntr tc ON ti.f_cntrid = tc.f_id
- ) tc
- ON tv.f_id = tc.pId
- <where>
- tv.f_status = 'T'
- AND (date(tv.f_ATD) >= DATE_SUB(CURDATE(), INTERVAL 2 DAY)
- OR tv.f_ATD IS NULL)
- AND tv.f_id = #{fId}
- </where>
- </select>
- <select id="shipDynamic" resultType="map">
- SELECT
- ta.fName fName, /*船名*/
- ta.fNo fNo,/*航次*/
- ta.portofloadName portofloadName,/*起运港*/
- ta.distinationName distinationName,/*目的港*/
- IFNULL(ta.fWeight,0) fWeight,/*容量*/
- IFNULL(tb.boxNumber,0) boxNumber,/*实际容量*/
- ta.fETD fETD,/*预计开船*/
- ta.fETA fETA,/*预计到港*/
- ta.fATD fATD,/*实际开船*/
- ta.fATA fATA,/*实际到港*/
- ta.fDays fDays/*航程*/
- FROM
- (
- SELECT
- tv.f_name fName, /*船名*/
- ty.f_no fNo,/*航次*/
- ta.f_name portofloadName,/*起运港*/
- tr.f_name distinationName,/*目的港*/
- tv.f_weight fWeight,/*容量*/
- ty.f_ETD fETD,/*预计开船*/
- ty.f_ETA fETA,/*预计到港*/
- ty.f_ATD fATD,/*实际开船*/
- ty.f_ATA fATA,/*实际到港*/
- ty.f_days fDays,/*航程*/
- ty.f_id voyid,/*航线ID*/
- tv.f_id vslid/*航ID*/
- FROM
- t_voyage ty
- LEFT JOIN t_vessel tv ON ty.f_pid = tv.f_id
- LEFT JOIN t_address ta ON ty.f_portofloadid = ta.f_id
- LEFT JOIN t_address tr ON ty.f_distinationid = tr.f_id
- )ta
- LEFT JOIN
- (
- SELECT
- tc.vesselName,
- tc.voyageName,
- SUM(tc.boxNumber)boxNumber
- FROM
- (
- SELECT
- tc.f_cntrno fCntrno,
- tr.f_no fNo,
- tw.f_vslid vesselName,
- tw.f_voyid voyageName,
- CASE
- WHEN SUBSTR(tr.f_no,1,2) = '20' THEN 1
- WHEN SUBSTR(tr.f_no,1,2) ='40' THEN 2
- ELSE 0
- END AS boxNumber
- FROM
- t_warehousebills_cntritems tc
- LEFT JOIN t_cntrno tn ON tn.f_no = tc.f_cntrno
- LEFT JOIN t_cntr tr ON tn.f_typeid = tr.f_id
- LEFT JOIN t_warehousebills tw ON tw.f_id = tc.f_pid
- WHERE tr.f_no IS NOT NULL
- )tc
- GROUP BY tc.vesselName,tc.voyageName
- )tb
- ON ta.voyid = tb.voyageName AND ta.vslid = tb.vesselName
- ORDER BY ta.fETA DESC
- LIMIT 10
- </select>
- </mapper>
|