Administrator
2023-04-15 4c64dca2491f0ae298ee160c1e8df22448a588ae
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
package com.mandi.fendan.mapper;
 
import java.util.List;
import java.util.Map;
 
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
 
import com.mandi.fendan.persist.Fd_XSTDMX;
import com.mandi.fendan.util.persist.WaitXSTDMX;
 
public interface Fd_XSTDMXMapper {
 
    @Insert("insert into fd_xstdmx "
    + "(tdmx_tdfl,tdmx_tdls,tdmx_pch,tdmx_hj,tdmx_zt,tdmx_mz,tdmx_jz,"
    + "tdmx_ggxh,tdmx_zpbz,tdmx_fdbz,tdmx_zcbz,tdmx_gbbz,tdmx_ck,tdmx_hth,tdmx_ywy,tdmx_ddh,tdmx_hwbh,tdmx_wlbh,tdmx_fhzz,tdmx_wbzcc,tdmx_cc) "
    //tdmx_ttlx
    + "values "
    + "(#{tdmx_tdfl},#{tdmx_tdls},#{tdmx_pch},"
    + "#{tdmx_hj},#{tdmx_zt},#{tdmx_mz},#{tdmx_jz},#{tdmx_ggxh},#{tdmx_zpbz},"
    + "0,0,0,#{tdmx_ck},#{tdmx_hth},#{tdmx_ywy},#{tdmx_ddh},#{tdmx_hwbh},#{tdmx_wlbh},#{tdmx_fhzz},#{tdmx_wbzcc},#{tdmx_cc})")
    //,#{tdmx_ttlx}
    public int insert(Fd_XSTDMX xstdmx);
 
    @Select("select * from fd_xstdmx where tdmx_tdfl=#{tdmx_tdfl} ")
    public Fd_XSTDMX get(String tdmx_tdfl);
 
    /**
     * 批量获取
     * @param tdmx_tdfls
     * @return
     */
    @Select("select * from fd_xstdmx where tdmx_tdfl in (${tdmx_tdfls}) ")
    public List<Fd_XSTDMX> gets(@Param("tdmx_tdfls") String tdmx_tdfls);
 
    @Select("select * from fd_xstdmx where tdmx_tdls=#{tdmx_tdls} and tdmx_gbbz=0 ")
    public List<Fd_XSTDMX> getListbytdls(String tdmx_tdls);
 
    /**
     * 根据提单分录和车牌号获取提单明细
     * @param tdmx_tdls
     * @param tdmx_fdcph
     * @return
     */
    @Select("select * from fd_xstdmx where tdmx_tdls=#{tdmx_tdls} and tdmx_fdcph=#{tdmx_fdcph} and tdmx_gbbz=0 ")
    public List<Fd_XSTDMX> getListByTdlsAndCph(@Param("tdmx_tdls") String tdmx_tdls,@Param("tdmx_fdcph")String tdmx_fdcph);
 
    /**不要用了可能是两条记录,没有关闭标志**/
    @Deprecated
    @Select("select * from fd_xstdmx where tdmx_pch=#{tdmx_pch} ")
    public Fd_XSTDMX getbyPCH(String tdmx_pch);
    /**改为 按照批次号和车牌号查找未关闭的明细**/
    @Select("select top 1  a.* "
            + "from fd_xstdmx a LEFT JOIN fd_xstd b on a.tdmx_tdls=b.td_tdls "
            + "LEFT JOIN fd_vehicle_xstd c on b.td_tdbh=c.xstdNo "
            + "where a.tdmx_pch=#{tdmx_pch} and c.vehicleId=#{vehicleId} and tdmx_gbbz=0")
    public Fd_XSTDMX getbyPCHONE(@Param("tdmx_pch") String tdmx_pch,@Param("vehicleId") String vehicleId);
    /**改为 按照批次号和提单编号查找未关闭的明细**/
    @Select("select top 1  a.* from fd_xstdmx a LEFT JOIN fd_xstd b on a.tdmx_tdls=b.td_tdls "
            + "where a.tdmx_pch=#{tdmx_pch} and b.td_tdbh=#{tdNo} and tdmx_gbbz=0 ")
    public Fd_XSTDMX getbyPCHandTDNOONE(@Param("tdmx_pch") String tdmx_pch,@Param("tdNo") String tdNo);
 
    @Delete("delete from fd_xstdmx where tdmx_tdls=#{tdmx_tdls} and tdmx_zcbz=0 ")
    public int delbyTDLS(String tdmx_tdls);
    @Delete("delete from fd_xstdmx where tdmx_tdfl=#{tdmx_tdfl}")
    public int del(String tdmx_tdfl);
 
    @Update("update fd_xstdmx set tdmx_fdcph=#{tdmx_fdcph},"
            + "tdmx_fdbz=#{tdmx_fdbz},tdmx_fdywbh=#{tdmx_fdywbh},tdmx_fdwlgsbh=#{tdmx_fdwlgsbh} where tdmx_tdfl=#{tdmx_tdfl}")
    public int updateFD(Fd_XSTDMX tdmx);
 
    @Update("update fd_xstdmx set tdmx_fdcph=#{tdmx_fdcph},tdmx_fdbz=#{tdmx_fdbz},tdmx_fdywbh=#{tdmx_fdywbh},tdmx_fdwlgsbh=#{tdmx_fdwlgsbh} where tdmx_tdls=#{tdmx_tdls} and tdmx_gbbz=0 and tdmx_fdbz=0 and tdmx_zcbz=0 ")
    public int updateFDBatch(Fd_XSTDMX tdmx);
 
    @Update("update fd_xstdmx set tdmx_fdcph=null,tdmx_fdbz=0,tdmx_fdywbh=null,tdmx_fdwlgsbh=null where tdmx_tdls=#{tdmx_tdls} and tdmx_fdywbh=#{tdmx_fdywbh} and tdmx_gbbz=0 and tdmx_fdbz!=0 and tdmx_zcbz=0")
    public int cancelFDBatch(@Param("tdmx_tdls") String tdmx_tdls,@Param("tdmx_fdywbh") String tdmx_fdywbh);
 
 
    @Update("update fd_xstdmx set tdmx_zccph=#{tdmx_zccph},tdmx_zcbz=#{tdmx_zcbz},"
            + "tdmx_zcwlgsName=#{tdmx_zcwlgsName},tdmx_zcdriver=#{tdmx_zcdriver},tdmx_zcphone=#{tdmx_zcphone} "
            + "where tdmx_tdfl=#{tdmx_tdfl}")
    public int updateZC(Fd_XSTDMX tdmx);
 
    @Update("update fd_xstdmx set tdmx_zccph=#{tdmx_zccph},tdmx_zcbz=#{tdmx_zcbz},"
            + "tdmx_zcwlgsName=#{tdmx_zcwlgsName},tdmx_zcdriver=#{tdmx_zcdriver},tdmx_zcphone=#{tdmx_zcphone},tdmx_fdbz=0,tdmx_fdcph=null,tdmx_fdwlgsbh=null,tdmx_fdywbh=null "
            + "where tdmx_tdfl=#{tdmx_tdfl}")
    public int updateZCANDFD(Fd_XSTDMX tdmx);
 
    @Update({
            "<script>",
            "update fd_xstdmx set tdmx_zccph=#{tdmx_zccph},tdmx_zcbz=#{tdmx_zcbz},"
            + "tdmx_fdcph=#{tdmx_fdcph},tdmx_fdbz=#{tdmx_fdbz},tdmx_fdywbh=#{tdmx_fdywbh},"
            + "tdmx_zcwlgsName=#{tdmx_zcwlgsName},tdmx_zcdriver=#{tdmx_zcdriver},tdmx_zcphone=#{tdmx_zcphone},",
            "<if test=\"tdmx_fdwlgsbh !=null and tdmx_fdwlgsbh!='' \"> ",
            "tdmx_fdwlgsbh=#{tdmx_fdwlgsbh} ",
            "</if>",
             "where tdmx_tdfl=#{tdmx_tdfl}",
            "</script>"
    })
    public int updateZCnoFD(Fd_XSTDMX tdmx);
 
    @Update("update fd_xstdmx set tdmx_gbbz=#{tdmx_gbbz} where tdmx_tdfl=#{tdmx_tdfl}")
    public int updateGB(Fd_XSTDMX tdmx);
 
    @Select("select * from fd_xstdmx where tdmx_tdls=#{tdmx_tdls} and tdmx_gbbz=0 ")
    public List<Fd_XSTDMX> getbytdls(String tdmx_tdls);
    @Select("select * from fd_xstdmx where tdmx_tdfl=#{tdmx_tdfl} and tdmx_tdls=#{tdmx_tdls}")
    public Fd_XSTDMX getbytdflAndtdls(@Param("tdmx_tdfl") String tdmx_tdfl,@Param("tdmx_tdls") String tdmx_tdls);
 
//    @Select("select count(1) from fd_xstdmx where tdmx_tdls=#{tdmx_tdls} and tdmx_gbbz=0 and (tdmx_fdbz!=0 or tdmx_zcbz!=0)")
    @Select("select count(1) from fd_xstdmx a LEFT JOIN fd_bsheet b on a.tdmx_fdywbh=b.bsNo  where a.tdmx_tdls=#{tdmx_tdls}  and a.tdmx_gbbz=0 and (a.tdmx_fdbz!=0 or a.tdmx_zcbz!=0) and b.status='在办' ")
    public int getbytdlswithZCorFD(String tdmx_tdls);
    @Select("select * from fd_xstdmx where tdmx_tdls=#{tdmx_tdls} and tdmx_gbbz=0 and tdmx_fdbz=0 and tdmx_zcbz=0 ")
    public List<Fd_XSTDMX> getNOZCandFD(String tdmx_tdls);
 
    @Select("select * from fd_xstdmx where tdmx_tdls=#{tdmx_tdls} and tdmx_fdwlgsbh=#{tdmx_fdwlgsbh} and tdmx_fdywbh=#{tdmx_fdywbh}  and tdmx_gbbz=0 and tdmx_fdbz=1 and tdmx_zcbz=0 ")
    public List<Fd_XSTDMX> getbyBsNoandcmNo(@Param("tdmx_tdls") String tdmx_tdls,
            @Param("tdmx_fdywbh") String tdmx_fdywbh,@Param("tdmx_fdwlgsbh") String tdmx_fdwlgsbh);
 
    @Update("update fd_xstdmx set tdmx_fdcph=null,tdmx_fdbz=0,tdmx_fdywbh=null,tdmx_fdwlgsbh=null  where tdmx_tdls=#{tdmx_tdls} and tdmx_fdwlgsbh=#{tdmx_fdwlgsbh} and tdmx_fdywbh=#{tdmx_fdywbh}  and tdmx_gbbz=0 and tdmx_fdbz=1 and tdmx_zcbz=0 ")
    public int updatebyBsNoandcmNo(@Param("tdmx_tdls") String tdmx_tdls,
            @Param("tdmx_fdywbh") String tdmx_fdywbh,@Param("tdmx_fdwlgsbh") String tdmx_fdwlgsbh);
 
    @Select("select * from fd_xstdmx where tdmx_fdywbh=#{bsNo} and tdmx_gbbz=0 and tdmx_fdbz=1 and tdmx_zcbz=0 ")
    public List<Fd_XSTDMX> getbybsNoandNOZCandFD(String bsNo);
    @Update("update fd_xstdmx set tdmx_fdcph=null,tdmx_fdbz=0,tdmx_fdywbh=null,tdmx_fdwlgsbh=null  where tdmx_fdywbh=#{bsNo} and tdmx_gbbz=0 and tdmx_fdbz=1 and tdmx_zcbz=0 ")
    public int updatebybsNoandNOZCandFD(String bsNo);
    @Select("select * from fd_xstdmx where tdmx_tdls=#{tdmx_tdls} and tdmx_zcbz=0 ")
    public List<Fd_XSTDMX> getforClose(String tdmx_tdls);
 
 
    public List<Map<String, Object>> getList(Map<String, Object> mp);
    public int countPage(Map<String, Object> mp);
 
 
    @Select("select * from fd_xstdmx where tdmx_tdls=#{tdls}  and tdmx_fdwlgsbh=#{tdmx_fdwlgsbh} and tdmx_gbbz=0 and tdmx_fdbz!=0 and tdmx_zcbz=0   ")
    public List<Fd_XSTDMX> getbytdlsandcmNo(@Param("tdls")String tdls,@Param("tdmx_fdwlgsbh")String tdmx_fdwlgsbh);
    @Update("update fd_xstdmx set tdmx_fdcph=null,tdmx_fdbz=0,tdmx_fdywbh=null,tdmx_fdwlgsbh=null  where tdmx_tdls=#{tdls} and tdmx_fdwlgsbh=#{tdmx_fdwlgsbh} and tdmx_gbbz=0 and tdmx_fdbz !=0 and tdmx_zcbz=0   ")
    public int updatebytdlsandcmNo(@Param("tdls")String tdls,@Param("tdmx_fdwlgsbh")String tdmx_fdwlgsbh);
 
    @Select("select count(1) from fd_xstdmx where tdmx_fdywbh=#{bsNo} and tdmx_tdls=#{tdls} and tdmx_zcbz=1 and tdmx_gbbz=0 and tdmx_zccph=#{vehicleId} ")
    public int getbyBsNowithZC(@Param("bsNo") String bsNo ,@Param("tdls") String tdls ,@Param("vehicleId") String vehicleId);
 
    @Select("select count(1) from fd_xstdmx where tdmx_fdywbh=#{bsNo}  and tdmx_zcbz=1 and tdmx_gbbz=0 and tdmx_zccph=#{vehicleId}")
    public int getbyBsNowith(@Param("bsNo") String bsNo,@Param("vehicleId") String vehicleId);
 
    @Select("select * from xstdmx_view where tdmx_fdywbh=#{bsNo} and tdmx_fdwlgsbh=#{tdmx_fdwlgsbh} and tdmx_sfzc=0 ")
    public List<WaitXSTDMX> getwaitMXbyBsNoandcmNo(@Param("bsNo")String bsNo,@Param("tdmx_fdwlgsbh")String tdmx_fdwlgsbh);
    @Select("select * from xstdmx_view where tdmx_fdywbh=#{bsNo} and tdmx_sfzc=0 ")
    public List<WaitXSTDMX> getwaitMXbyBsNo(@Param("bsNo")String bsNo);
 
    @Select("select * from fd_xstdmx")
    public List<Fd_XSTDMX> getlistA();
    @Update("update fd_xstdmx set tdmx_ggxh=#{tdmx_ggxh} where tdmx_tdfl=#{tdmx_tdfl}")
    public int updateMXGG(Fd_XSTDMX mx);
 
    @Select({"select  hw.name tdmx_hwmc,mx.* from fd_xstdmx mx " ,
            " left join nc_hw hw on mx.tdmx_hwbh=hw.pkid and hw.state=1 " ,
            " join fd_bsheet on bsNo=tdmx_fdywbh and status='在办' where SdepartNo=#{sdepartNo} "
    })
    public List<Map> getHwList(String sdepartNo);
 
 
}