解決GAT專案Bug:車裝車飾費用管理中的裝飾費統計(車輛)統計資料不對
問題描述:
解決:斷點檢視sql語句,並加上引數執行
發現sql語句統計的不對,nvl2(t2.times, 1, 0),意思是有值為1沒值為0
下面的半句已經可以累積次數了,不需要再nvl2(t2.times, 1, 0) as times
所以修改SQL,直接t2.times
select t1.hostno, t2.times, nvl(t2.cost, 0) as cost
from (select p.hostid, p.hostno
from position_host_info p
left join position_host_info_extend e
on p.hostid = e.hostid
where e.verify_status = 1
and e.process_status <> 4
and e.process_status <> 5
and p.appsysid = 23551
and p.appdeptid = 3) t1
left join
(select p.hostno as hostNo,
t.host_id,
sum(nvl2(t.DECORATE_COST, 1, 0)) as times,
sum(nvl(t.DECORATE_COST, 0)) as cost
from position_host_info p
left join position_host_info_extend e
on p.hostid = e.hostid
left join COST_DECORATE t
on p.hostid = t.host_id
and t.PAYMENT_DATE >= to_date('2017-03-20', 'yyyy-mm-dd')
and t.PAYMENT_DATE <= to_date('2017-03-24', 'yyyy-mm-dd')
where p.appsysid = 23551
and p.appdeptid = 3
and e.verify_status = 1
and e.process_status <> 4
and e.process_status <> 5
and t.apply_status = 11
group by p.hostno, t.host_id) t2
on t1.hostid = t2.host_id
測試OK~~
----------------------------------------------------------------------------------------------------------------------
補充說明:參考停車管理裡面的車輛統計,
select t1.hostno,
nvl(t2.parkTimes, 0) as parkTimes,
nvl(t2.totalParkFee, 0) as totalParkFee
from (select p.hostno, p.hostid
from position_host_info p
where p.status = 1
and (exists (select appsysid, appdeptid
from table(get_subdept(8196, 23551, 3)) f
where p.APPSYSID = f.appsysid
and p.APPDEPTID = f.appdeptid))) t1
left join (select cpf.host_id,
cpf.HOST_NO,
to_char(count(*)) as parkTimes,
to_char(sum(cpf.PARK_FEE)) as totalParkFee
from COST_PARK_FEE cpf
where (exists (select appsysid, appdeptid
from table(get_subdept(8196, 23551, 3)) f
where cpf.APPSYSID = f.appsysid
and cpf.APPDEPTID = f.appdeptid))
and cpf.PAY_DATE >= to_date('2017-03-20', 'yyyy-mm-dd')
and cpf.PAY_DATE <= to_date('2017-03-31', 'yyyy-mm-dd')
and cpf.fee_verify = 1
group by cpf.host_id, cpf.HOST_NO) t2
on t1.hostid = t2.host_id
所以上面的裝飾費統計(車輛)sql改為:
select t1.hostno, nvl(t2.times,0) as times, nvl(t2.cost, 0) as cost
from (select p.hostid, p.hostno
from position_host_info p
left join position_host_info_extend e
on p.hostid = e.hostid
where e.verify_status = 1
and e.process_status <> 4
and e.process_status <> 5
and p.appsysid = 23551
and p.appdeptid = 3) t1
left join (select p.hostno as hostNo,
t.host_id,
sum(nvl2(t.DECORATE_COST, 1, 0)) as times,
sum(nvl(t.DECORATE_COST, 0)) as cost
from position_host_info p
left join position_host_info_extend e
on p.hostid = e.hostid
left join COST_DECORATE t
on p.hostid = t.host_id
and t.PAYMENT_DATE >= to_date('2017-03-20', 'yyyy-mm-dd')
and t.PAYMENT_DATE <= to_date('2017-03-24', 'yyyy-mm-dd')
where p.appsysid = 23551
and p.appdeptid = 3
and e.verify_status = 1
and e.process_status <> 4
and e.process_status <> 5
and t.apply_status = 11
group by p.hostno, t.host_id) t2
on t1.hostid = t2.host_id
程式碼中改成:
測試OK~~
相關文章
- 解決公務車Bug:停車費管理中匯入停車費用時報資料庫操作異常資料庫
- 解決GAT專案Bug:ETC費用統計問題
- 解決GAT輸入車牌號未帶出車輛品牌Bug
- GAT-解決車輛基本資訊中,刪除未返場的車輛時,錯誤提示資訊Bug
- 易泊車牌識別 停車計費系統解決方案
- GAT-解決用車審批中,如果排程車輛是通過Excel匯入的車輛,會有錯誤提示BugExcel
- Oracle-ORA-01722:invalid number-解決GAT專案中車輛維修BugOracle
- ORA-01722:invalid number-解決GAT專案中車輛維修Bug(續)
- 高階停車場停車計費解決方案
- 22.【實戰】車輛統計
- GAT專案新需求:車輛基本資訊查詢增加勾選不包含下級
- 解決公務車Bug:加油管理中匯入加油費用時,提示:操作失敗
- 車輛資訊快速查詢API:輕鬆查詢車牌號對應車輛的詳細資料API
- 工程車輛車載PLC遠端監控智慧運營系統解決方案
- 解決GAT專案Bug: 用車審批中審批人登入系統後,看不到申請人提交的單子
- 基於java的企業車輛管理系統的設計與實現Java
- 中智車聯:用 TDengine 高效處理車輛運營視覺化管理視覺化
- 解決公務車Bug:過路過橋費用管理中匯入路橋費用時,付費方式為蘇通卡時不能正常匯入
- 車牌識別相機助力智慧巡檢車路側停車移動計費
- 解決惠安惠達Bug:待命車數量明細不對
- 智慧停車場解決方案,反向尋車系統解決方案
- 食品連鎖類門店配送車輛管理系統
- 火車免費Wi-Fi來了!鄭州近百列火車安裝WiFi裝置WiFi
- 乘用車車身控制系統(BCM)
- 加州現神秘旅行車 疑似蘋果收集地圖資料車輛蘋果地圖
- GPS車輛定位系統功能概述
- 裝飾模式(裝飾設計模式)詳解——小馬同學@Tian設計模式
- 專車運營 | 變更車輛性質、專業規範化管理將使專車數量減少2/3
- 裝飾設計模式設計模式
- 生活篇:基於TRIZ原理設計自行車剎車裝置
- 車輛OTA模擬測試解決方案
- 730【畢設課設】基於STM32的RFID停車場車位車庫管理監測系統設計(全套資料)
- 解決GAT專案Bug:軌跡分析查詢不到資料
- 停車場管理系統
- Python 裝飾器裝飾類中的方法Python
- 蘋果無人車四個最新專利:手勢控制變道、車輛導流、路況感知及車輛控制蘋果
- Decorator裝飾設計模式設計模式
- 設計模式——裝飾模式設計模式