Commit ae0de2d7 by shiwenbo

修改经营报表查询sql

parent 71ad0d0a
......@@ -2,6 +2,7 @@ package com.xyst.dinas.statistics.internal.dao;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import javax.persistence.Tuple;
......@@ -52,7 +53,7 @@ public class OperationsReportsDaoImpl implements OperationsReportsDao {
if (endDate != null && !(endDate.isEmpty()))
hql.append(" and salesSummary.deal_Time <= :endDate ");
if (stationList != null && !(stationList.isEmpty()))
hql.append(" AND hex(salesSummary.station_id) IN ( :stationList ) ");
hql.append(" AND salesSummary.station_id IN ( :stationList ) ");
hql.append(" GROUP BY salesSummary.station_id,\r\n" + " salesSummary.dinas_type_id ");
hql.append(" UNION ALL ");
hql.append(
......@@ -79,7 +80,7 @@ public class OperationsReportsDaoImpl implements OperationsReportsDao {
if (endDate != null && !(endDate.isEmpty()))
hql.append(" and salesSummary.deal_Time <= :endDate ");
if (stationList != null && !(stationList.isEmpty()))
hql.append(" AND hex(salesSummary.station_id) IN ( :stationList ) ");
hql.append(" AND salesSummary.station_id IN ( :stationList ) ");
hql.append(" GROUP BY salesSummary.station_id ");
hql.append(" UNION ALL ");
hql.append(" SELECT '总计' AS stationName, \r\n" + " '———' AS dinasTypeName, ");
......@@ -105,7 +106,7 @@ public class OperationsReportsDaoImpl implements OperationsReportsDao {
if (endDate != null && !(endDate.isEmpty()))
hql.append(" and salesSummary.deal_Time <= :endDate ");
if (stationList != null && !(stationList.isEmpty()))
hql.append(" AND hex(salesSummary.station_id) IN ( :stationList ) ");
hql.append(" AND salesSummary.station_id IN ( :stationList ) ");
hql.append(" ) AS result ");
hql.append(
" ORDER BY (result.stationName = '总计') DESC,result.stationName, (result.dinasTypeName = '小计') ASC ");
......@@ -118,8 +119,14 @@ public class OperationsReportsDaoImpl implements OperationsReportsDao {
query.setParameter("startDate", startDate);
if (endDate != null && !(endDate.isEmpty()))
query.setParameter("endDate", endDate);
if (stationList != null && !(stationList.isEmpty()))
query.setParameter("stationList", stationList);
if (stationList != null && !(stationList.isEmpty())) {
String[] strList = stationList.split(",");
List<UUID> uuidList = new ArrayList<UUID>();
for(String str : strList) {
uuidList.add(UUID.fromString(str));
}
query.setParameter("stationList", uuidList);
}
List<Tuple> resultList = query.getResultList();
if (resultList.isEmpty())
return null;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment