Commit c479476ee829669cbb00812549c5bd19cb89e0cd

Authored by 陈威
1 parent 4c2fd0af
Exists in master

导出功能优化

backend/chkpower/src/main/resources/mapper/WCurrentMapper.xml
... ... @@ -75,20 +75,20 @@
75 75 FROM uc_org org
76 76 JOIN w_bank_account acc ON acc.F_org_id= org.ID_
77 77 LEFT JOIN (
78   - SELECT c1.F_org_id, c1.F_bank_account, c1.F_date, c1.F_account_balance, c1.F_available_balance, c1.F_freeze_amount, c1.F_freezing, c1.F_notes,c1.id_
79   - FROM w_current c1
80   - JOIN (
81   - SELECT c3.F_org_id, c3.F_bank_account,max(c3.id_) as id_ FROM w_current c3
82   - JOIN (
83   - SELECT DISTINCT F_org_id, F_bank_account, MAX(F_date) as MaxDate
84   - FROM w_current
85   - GROUP BY F_org_id, F_bank_account
86   - ) c4 ON c3.F_org_id = c4.F_org_id AND c3.F_bank_account = c4.F_bank_account AND c3.F_date = c4.MaxDate
87   - GROUP BY c3.F_org_id, c3.F_bank_account
88   - ) c2
89   - ON c1.F_org_id = c2.F_org_id AND c1.F_bank_account = c2.F_bank_account AND c1.id_ = c2.id_
  78 + SELECT c1.F_org_id, c1.F_bank_account, c1.F_date, c1.F_account_balance, c1.F_available_balance, c1.F_freeze_amount, c1.F_freezing, c1.F_notes,c1.id_
  79 + FROM w_current c1
  80 + JOIN (
  81 + SELECT c3.F_org_id, c3.F_bank_account,max(c3.id_) as id_ FROM w_current c3
  82 + JOIN (
  83 + SELECT DISTINCT F_org_id, F_bank_account, MAX(F_date) as MaxDate
  84 + FROM w_current
  85 + GROUP BY F_org_id, F_bank_account
  86 + ) c4 ON c3.F_org_id = c4.F_org_id AND c3.F_bank_account = c4.F_bank_account AND c3.F_date = c4.MaxDate
  87 + GROUP BY c3.F_org_id, c3.F_bank_account
  88 + ) c2
  89 + ON c1.F_org_id = c2.F_org_id AND c1.F_bank_account = c2.F_bank_account AND c1.id_ = c2.id_
90 90 ) zh on zh.F_org_id = acc.F_org_id and zh.F_bank_account = acc.F_bank_account
91   - WHERE 1=1
  91 + WHERE 1=1 AND ACC.F_use_status !='停用'
92 92 <if test="orgIdList != null and orgIdList.size() > 0">
93 93 and org.ID_ in
94 94 <foreach collection="orgIdList" separator="," item="orgId" open="(" close=")">
... ... @@ -101,24 +101,28 @@
101 101 </select>
102 102  
103 103 <select id="getCurrentAccountBalanceList" resultType="java.util.HashMap">
104   - SELECT org.ID_ as F_org_id,org.NAME_ as F_org_name,acc.F_org_type,org.ORDER_NO_,YE.F_account_balance
  104 + SELECT org.ID_ as F_org_id,org.NAME_ as F_org_name,orgParams.VALUE_ as F_org_type,org.ORDER_NO_,YE.F_account_balance
105 105 FROM uc_org org
106   - INNER JOIN w_bank_account acc ON acc.F_org_id= org.ID_
107   - LEFT JOIN (
  106 + JOIN uc_org_params orgParams on orgParams.ORG_ID_= org.ID_
  107 + LEFT JOIN (
108 108 SELECT F_org_id, F_org_name,SUM(F_account_balance) AS F_account_balance
109 109 FROM w_current
110 110 WHERE DATE(F_date) =DATE(#{fDate})
111 111 GROUP BY F_org_id, F_org_name
112   - ) YE ON YE.F_org_id = acc.F_org_id
  112 + ) YE ON YE.F_org_id = org.ID_
113 113 WHERE 1=1
114   - AND acc.F_org_type= #{fOrgType}
115   - ORDER BY org.ORDER_NO_ ASC
  114 + AND orgParams.VALUE_ !=''
  115 + AND orgParams.VALUE_ = #{fOrgType}
  116 + ORDER BY orgParams.VALUE_,org.ORDER_NO_ ASC
116 117 </select>
117 118  
118 119 <select id="getCurrentOrgTypeList" resultType="java.lang.String">
119 120 SELECT orgParams.VALUE_ AS orgType
120 121 FROM uc_org org
121 122 JOIN uc_org_params orgParams on orgParams.ORG_ID_= org.ID_
  123 + WHERE 1=1
  124 + AND orgParams.VALUE_ !=''
  125 + AND orgParams.VALUE_ IS NOT NULL
122 126 GROUP BY orgParams.VALUE_
123 127 ORDER BY MAX(org.ORDER_NO_) ASC
124 128 </select>
... ...
backend/chkpower/src/main/resources/mapper/WFinanceMapper.xml
... ... @@ -58,19 +58,19 @@
58 58 </select>
59 59  
60 60 <select id="getTransactionDetailsList" resultType="java.util.HashMap">
61   - SELECT org.ID_ as F_org_id,org.NAME_ as F_org_name,acc.F_org_type,org.ORDER_NO_,
62   - JE.F_total_income,JE.F_total_disbursement,JE.F_total_net_cash_flow
63   - FROM uc_org org
64   - INNER JOIN w_bank_account acc ON acc.F_org_id= org.ID_
65   - LEFT JOIN (
66   - SELECT F_org_id,SUM(F_total_income) AS F_total_income,SUM(F_total_disbursement) AS F_total_disbursement,SUM(F_total_net_cash_flow) AS F_total_net_cash_flow
67   - FROM w_finance
68   - WHERE DATE(F_date) = DATE(#{fDate})
69   - GROUP BY F_org_id
70   - ) JE ON JE.F_org_id = org.ID_
71   - WHERE 1=1
72   - AND acc.F_org_type= #{fOrgType}
73   - ORDER BY org.ORDER_NO_ ASC
  61 + SELECT org.ID_ as F_org_id,org.NAME_ as F_org_name,orgParams.VALUE_ as F_org_type,org.ORDER_NO_,
  62 + JE.F_total_income,JE.F_total_disbursement,JE.F_total_net_cash_flow
  63 + FROM uc_org org
  64 + JOIN uc_org_params orgParams on orgParams.ORG_ID_= org.ID_
  65 + LEFT JOIN (
  66 + SELECT F_org_id,SUM(F_total_income) AS F_total_income,SUM(F_total_disbursement) AS F_total_disbursement,SUM(F_total_net_cash_flow) AS F_total_net_cash_flow
  67 + FROM w_finance
  68 + WHERE DATE(F_date) = DATE(#{fDate})
  69 + GROUP BY F_org_id
  70 + ) JE ON JE.F_org_id = org.ID_
  71 + WHERE 1=1 AND orgParams.VALUE_ !=''
  72 + AND orgParams.VALUE_ = #{fOrgType}
  73 + ORDER BY orgParams.VALUE_,org.ORDER_NO_ ASC
74 74 </select>
75 75  
76 76 <update id="updateInsp" parameterType="com.hotent.chkpower.model.WFinance">
... ...