hjg
2024-03-18 8d48c59d5d3bcc4148ef97dc6f98e3a8cf9ca436
提交 | 用户 | 时间
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
8d48c5 28         ,min(0) fdCnum,min(0) fdCweight, ('false') hasCard,max(vq.xspdindx) xspdindx
H 29          from fd_bsheet a left join fd_company_vehicle v on a.vehicleId=v.vehicleId and a.sdepartNo=v.sdepartNo
30         left join vehicle_queuing vq on vq.numberplates=a.vehicleId and (a.sdepartNo=vq.sdepartNo or vq.sdepartNO is null)
58d006 31         <where>
A 32              a.status='在办' 
33              <if test="cqV !=null and cqV !='' ">
34                      and a.sdepartNo=#{cqV}
35                  </if>
36             <if test="companyNo !=null and companyNo !='' ">
37                 and v.companyNo=#{companyNo} and v.vehicleId !='' and v.vehicleId is not null 
38             </if>
39             <if test="vehicleId !=null and vehicleId !='' ">
40                 and v.vehicleId like '%'+#{vehicleId}+'%'
41             </if>
42         </where>
43          GROUP BY a.bsNo  
44         ) as a where rownumber > #{pagesize}*#{page}
45     </select>
46     
47     <select id="getbspages" parameterType="java.util.Map" resultType="int" >
48         select count(DISTINCT(a.bsNo)) 
49         from fd_bsheet a left join  fd_company_vehicle v on a.vehicleId=v.vehicleId  and a.sdepartNo=v.sdepartNo 
50         <!-- <choose>
51              <when test=" companyNo !=null and companyNo !='' ">
52                  left join fd_company_vehicle v on a.vehicleId=v.vehicleId 
53                  <if test="cqV !=null and cqV !='' " >    
54                     <choose>
55                         <when test="cqV=='03' || cqV=='05' ">
56                             and v.sdepartNo=#{cqV}
57                         </when>
58                         <otherwise>
59                             and v.sdepartNo !='03' and v.sdepartNo !='05'
60                         </otherwise>
61                     </choose>
62                 </if>
63              </when>
64              <otherwise>
65                  left join  fd_company_vehicle v on a.vehicleId=v.vehicleId  and a.sdepartNo=v.sdepartNo 
66                      <if test="cqV !=null and cqV !='' " >    
67                     <choose>
68                         <when test="cqV=='03' || cqV=='05' ">
69                             and v.sdepartNo=#{cqV}
70                         </when>
71                         <otherwise>
72                             and v.sdepartNo !='03' and v.sdepartNo !='05'
73                         </otherwise>
74                     </choose>
75                 </if>
76              </otherwise>
77          </choose> -->
78         <where>
79             a.status='在办' 
80             <if test="cqV !=null and cqV !='' ">
81                      and a.sdepartNo=#{cqV}
82              </if>
83             <!-- <if test='cqV &gt;= 0'>    
84                 <choose>
85                     <when test="cqV==0">
86                         and a.sdepartNo!='03'
87                     </when>
88                     <otherwise>
89                         and a.sdepartNo='03'
90                     </otherwise>
91                 </choose>
92             </if> -->
93             <if test="companyNo !=null and companyNo !='' ">
94                 and v.companyNo=#{companyNo} and v.vehicleId !='' and v.vehicleId is not null 
95             </if>
96             <if test="vehicleId !=null and vehicleId !='' ">
97                 and v.vehicleId= #{vehicleId}
98             </if>
99         </where>
100     </select>
101 </mapper>