Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cloud-fb
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王衍超
cloud-fb
Commits
d3aec35c
Commit
d3aec35c
authored
May 31, 2021
by
wukaiqiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复销售汇总报表Sql
parent
221c6ac8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
5 deletions
+13
-5
SalesSummaryDaoImpl.java
...st/dinas/statistics/internal/dao/SalesSummaryDaoImpl.java
+13
-5
No files found.
backend/xyst.dinas.statistics/src/main/java/com/xyst/dinas/statistics/internal/dao/SalesSummaryDaoImpl.java
View file @
d3aec35c
...
...
@@ -2,6 +2,8 @@ package com.xyst.dinas.statistics.internal.dao;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.UUID
;
import
javax.persistence.Tuple
;
import
org.hibernate.HibernateException
;
...
...
@@ -157,7 +159,7 @@ public class SalesSummaryDaoImpl implements SalesSummaryDao {
+
" GROUP BY salesSummary1.station_id\r\n"
+
" ) AS decAmount ON decAmount.dealYear1 = salesSummary.deal_Year "
);
if
(
stationList
!=
null
&&
!(
stationList
.
isEmpty
()))
hql
.
append
(
" WHERE 1=1 AND
station.id
IN ( :stationList ) "
);
hql
.
append
(
" WHERE 1=1 AND
salesSummary.station_id
IN ( :stationList ) "
);
hql
.
append
(
" GROUP BY salesSummary.deal_Year\r\n"
+
" UNION ALL\r\n"
+
" SELECT\r\n"
+
" station.station_Name as station,\r\n"
+
" '小计' as dinas_Type,\r\n"
+
" SUM(salesSummary.sale_Deal_Amount) as saleDealAmount,\r\n"
...
...
@@ -276,7 +278,7 @@ public class SalesSummaryDaoImpl implements SalesSummaryDao {
+
" ) AS decAmount ON decAmount.station1 = salesSummary.station_id\r\n"
+
" AND decAmount.dealYear1 = salesSummary.deal_Year "
);
if
(
stationList
!=
null
&&
!(
stationList
.
isEmpty
()))
hql
.
append
(
" WHERE 1=1 AND
station.id
IN ( :stationList ) "
);
hql
.
append
(
" WHERE 1=1 AND
salesSummary.station_id
IN ( :stationList ) "
);
hql
.
append
(
" GROUP BY salesSummary.station_id\r\n"
+
" UNION ALL\r\n"
+
" SELECT\r\n"
+
" station.station_Name as station,\r\n"
+
" dinasType.dinas_Type_Name as dinasType,\r\n"
...
...
@@ -409,7 +411,7 @@ public class SalesSummaryDaoImpl implements SalesSummaryDao {
+
" ) AS decAmount ON decAmount.station1 = salesSummary.station_id AND decAmount.dinasType1 = salesSummary.dinas_Type_id\r\n"
+
" AND decAmount.dealYear1 = salesSummary.deal_Year"
);
if
(
stationList
!=
null
&&
!(
stationList
.
isEmpty
()))
hql
.
append
(
" WHERE 1=1 AND
station.id
IN ( :stationList ) "
);
hql
.
append
(
" WHERE 1=1 AND
salesSummary.station_id
IN ( :stationList ) "
);
hql
.
append
(
" GROUP BY salesSummary.dinas_Type_id "
+
" ) AS result "
);
hql
.
append
(
" WHERE 1=1 "
);
if
(
dealYear
!=
null
&&
!(
dealYear
.
isEmpty
()))
...
...
@@ -421,8 +423,14 @@ public class SalesSummaryDaoImpl implements SalesSummaryDao {
Query
<
Tuple
>
query
=
session
.
createNativeQuery
(
hql
.
toString
(),
Tuple
.
class
);
if
(
dealYear
!=
null
&&
!(
dealYear
.
isEmpty
()))
query
.
setParameter
(
"dealYear"
,
dealYear
);
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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment