|  | @@ -80,6 +80,85 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
	
		
			
				|  |  |          LEFT JOIN sys_user  su ON tv.f_manageid = su.user_id
 | 
	
		
			
				|  |  |          <where>
 | 
	
		
			
				|  |  |              tv.f_status = 'T'
 | 
	
		
			
				|  |  | +            <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>
 | 
	
		
			
				|  |  | +        </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
 | 
	
		
			
				|  |  | +        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>
 |