Administrator
2022-09-14 58d006e05dcf2a20d0ec5367dd03d66a61db6849
提交 | 用户 | 时间
58d006 1 <?xml version="1.0" encoding="UTF-8"?>
A 2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3 <mapper namespace="com.mandi.fendan.mapper.BusinessMapper">
4     <select id="getbslist" parameterType="java.util.Map" resultType="java.util.Map"  >
5         <choose>
6             <when test="pagesize &gt; 0 ">
7                 select top ${pagesize} *
8             </when>
9             <otherwise>
10                 select * 
11             </otherwise>
12         </choose>
13         from ( select row_number()
14         <choose>
15             <when test="sort!=null and sort!='' ">
16                 over (order by min(${sort}) )
17             </when>
18             <otherwise>
19                 over (order by min(a.ctime) desc )
20             </otherwise> 
21         </choose>
22         as rownumber,MIN(a.id) id,min(a.bsNo) bsNo,min(a.companyName) companyName,min(a.companyNo) companyNo
23         ,min(a.createid) createid,min(a.createName) createName,min(a.ctime) ctime,min(a.driver) driver
24         ,min(a.fdsheetNo) fdsheetNo,min(a.invitecode) invitecode,min(a.phone) phone,min(a.sdepartNo) sdepartNo
25         ,min('') sendmsg,min(a.shdw) shdw,min(a.status) status,min(a.vehicleId) vehicleId,min(a.bsNo) bussinessNo
26         ,min(a.status) sstatus,min('产品销售') name,min('') dcompany,min(a.shdw) rcompany
27         ,min('businesstype00002') businesstypeNo,min('') instanceID,min('') canedit,min(0) fdnum,min(0) fdweight
28         ,min(0) fdCnum,min(0) fdCweight, ('false') hasCard 
29          from fd_bsheet a left join fd_company_vehicle v on a.vehicleId=v.vehicleId and a.sdepartNo=v.sdepartNo 
30     <!--      <choose>
31              <when test=" companyNo !=null and companyNo !='' ">
32                  left join fd_company_vehicle v on a.vehicleId=v.vehicleId and a.sdepartNo=v.sdepartNo 
33                  <if test="cqV !=null and cqV !='' " >    
34                     <choose>
35                         <when test="cqV=='03' || cqV=='05' ">
36                             and v.sdepartNo=#{cqV}
37                         </when>
38                         <otherwise>
39                             and v.sdepartNo !='03' and v.sdepartNo !='05'
40                         </otherwise>
41                     </choose>
42                 </if>
43              </when>
44              <otherwise>
45                  left join  fd_company_vehicle v on a.vehicleId=v.vehicleId and a.sdepartNo=v.sdepartNo 
46                  <if test="cqV !=null and cqV !='' " >    
47                     <choose>
48                         <when test="cqV=='03' || cqV=='05' ">
49                             and v.sdepartNo=#{cqV}
50                         </when>
51                         <otherwise>
52                             and v.sdepartNo !='03' and v.sdepartNo !='05'
53                         </otherwise>
54                     </choose>
55                 </if>
56              </otherwise>
57          </choose> -->
58         <where>
59              a.status='在办' 
60              <if test="cqV !=null and cqV !='' ">
61                      and a.sdepartNo=#{cqV}
62                  </if>
63             <!-- <if test='cqV &gt;= 0'>    
64                 <choose>
65                     <when test="cqV==0">
66                         and a.sdepartNo!='03'
67                     </when>
68                     <otherwise>
69                         and a.sdepartNo='03'
70                     </otherwise>
71                 </choose>
72             </if> -->
73             <if test="companyNo !=null and companyNo !='' ">
74                 and v.companyNo=#{companyNo} and v.vehicleId !='' and v.vehicleId is not null 
75             </if>
76             <if test="vehicleId !=null and vehicleId !='' ">
77                 and v.vehicleId like '%'+#{vehicleId}+'%'
78             </if>
79         </where>
80          GROUP BY a.bsNo  
81         ) as a where rownumber > #{pagesize}*#{page}
82     </select>
83     
84     <select id="getbspages" parameterType="java.util.Map" resultType="int" >
85         select count(DISTINCT(a.bsNo)) 
86         from fd_bsheet a left join  fd_company_vehicle v on a.vehicleId=v.vehicleId  and a.sdepartNo=v.sdepartNo 
87         <!-- <choose>
88              <when test=" companyNo !=null and companyNo !='' ">
89                  left join fd_company_vehicle v on a.vehicleId=v.vehicleId 
90                  <if test="cqV !=null and cqV !='' " >    
91                     <choose>
92                         <when test="cqV=='03' || cqV=='05' ">
93                             and v.sdepartNo=#{cqV}
94                         </when>
95                         <otherwise>
96                             and v.sdepartNo !='03' and v.sdepartNo !='05'
97                         </otherwise>
98                     </choose>
99                 </if>
100              </when>
101              <otherwise>
102                  left join  fd_company_vehicle v on a.vehicleId=v.vehicleId  and a.sdepartNo=v.sdepartNo 
103                      <if test="cqV !=null and cqV !='' " >    
104                     <choose>
105                         <when test="cqV=='03' || cqV=='05' ">
106                             and v.sdepartNo=#{cqV}
107                         </when>
108                         <otherwise>
109                             and v.sdepartNo !='03' and v.sdepartNo !='05'
110                         </otherwise>
111                     </choose>
112                 </if>
113              </otherwise>
114          </choose> -->
115         <where>
116             a.status='在办' 
117             <if test="cqV !=null and cqV !='' ">
118                      and a.sdepartNo=#{cqV}
119              </if>
120             <!-- <if test='cqV &gt;= 0'>    
121                 <choose>
122                     <when test="cqV==0">
123                         and a.sdepartNo!='03'
124                     </when>
125                     <otherwise>
126                         and a.sdepartNo='03'
127                     </otherwise>
128                 </choose>
129             </if> -->
130             <if test="companyNo !=null and companyNo !='' ">
131                 and v.companyNo=#{companyNo} and v.vehicleId !='' and v.vehicleId is not null 
132             </if>
133             <if test="vehicleId !=null and vehicleId !='' ">
134                 and v.vehicleId= #{vehicleId}
135             </if>
136         </where>
137     </select>
138 </mapper>