Commit 84313b29 authored by Anthony.Suerte's avatar Anthony.Suerte

User Transaction Query Replacement

parent b18dcacc
...@@ -4655,12 +4655,8 @@ WHERE ...@@ -4655,12 +4655,8 @@ WHERE
</LIST_USER_TRANSACTION_ADMIN_COUNT> </LIST_USER_TRANSACTION_ADMIN_COUNT>
<SELECT_USER_TRANSACTION_ADMIN_COUNT> <SELECT_USER_TRANSACTION_ADMIN_COUNT>
SELECT SELECT COUNT(*) as 'overall_total' FROM (
(remitter + receiver + deposit + withdrawal + benef_exchange SELECT /* 通常入金 */
+ debit_exchange + from_request + to_request + with1 + with2 + with3 ) AS 'overall_total'
FROM (
SELECT
(SELECT COUNT(*) FROM (SELECT /* 通常入金 */
create_time AS transaction_time create_time AS transaction_time
, deposit_date AS process_time , deposit_date AS process_time
, DATE_FORMAT(create_time, '%Y/%m/%d') AS transaction_time_string , DATE_FORMAT(create_time, '%Y/%m/%d') AS transaction_time_string
...@@ -4689,15 +4685,39 @@ WHERE ...@@ -4689,15 +4685,39 @@ WHERE
WHERE WHERE
user_account = '__ELEMENT01__' user_account = '__ELEMENT01__'
AND NOW() + INTERVAL 17 HOUR > deposit_date AND NOW() + INTERVAL 17 HOUR > deposit_date
AND currency = '__ELEMENT02__') deposit_sub AND currency = '__ELEMENT02__'
LEFT OUTER JOIN UNION
v_users_all AS withdraw_user ON(withdraw_account_number = withdraw_user.user_account) SELECT /* 両替(入金) */
LEFT OUTER JOIN create_time AS transaction_time
v_users_all AS deposit_user ON(deposit_account_number = deposit_user.user_account) , create_time AS process_time
WHERE 1 __ELEMENT03__ , DATE_FORMAT(create_time, '%Y/%m/%d') AS transaction_time_string
) deposit, , DATE_FORMAT(create_time, '%Y/%m/%d') AS process_time_string
, transaction_number AS transaction_number
(SELECT COUNT(*) FROM (SELECT /* 通常出金 */ , '3' AS transaction_type
, '' AS withdraw_account_number
, user_account AS deposit_account_number
, 0 AS withdraw_amount
, '' AS withdraw_fee
, amount AS deposit_amount
, 0 AS deposit_fee
, '' AS rate
, currency AS deposit_currency
, '' AS withdraw_currency
, '' AS transfer_currency
, '' AS transfer_amount
, 0 AS TYPE
, 0 AS STATUS
, '' AS message
, '' AS method
, msecond AS msecond
, 0 AS process_status
FROM
t_exchange
WHERE
user_account = '__ELEMENT01__'
AND currency = '__ELEMENT02__'
UNION
SELECT /* 通常出金 */
create_time AS transaction_time create_time AS transaction_time
, process_time AS process_time , process_time AS process_time
, DATE_FORMAT(create_time, '%Y/%m/%d') AS transaction_time_string , DATE_FORMAT(create_time, '%Y/%m/%d') AS transaction_time_string
...@@ -4729,51 +4749,9 @@ WHERE ...@@ -4729,51 +4749,9 @@ WHERE
AND debit_currency = '__ELEMENT02__' AND debit_currency = '__ELEMENT02__'
AND (TYPE = '0' AND (TYPE = '0'
OR TYPE = '3' OR TYPE = '3'
OR TYPE = '1')) withdraw_sub OR TYPE = '1')
LEFT OUTER JOIN UNION
v_users_all AS withdraw_user ON(withdraw_account_number = withdraw_user.user_account) SELECT /* 両替(出金) */
LEFT OUTER JOIN
v_users_all AS deposit_user ON(deposit_account_number = deposit_user.user_account)
WHERE 1 __ELEMENT03__
) withdrawal,
(SELECT COUNT(*) FROM (SELECT /* 両替(入金) */
create_time AS transaction_time
, create_time AS process_time
, DATE_FORMAT(create_time, '%Y/%m/%d') AS transaction_time_string
, DATE_FORMAT(create_time, '%Y/%m/%d') AS process_time_string
, transaction_number AS transaction_number
, '3' AS transaction_type
, '' AS withdraw_account_number
, user_account AS deposit_account_number
, 0 AS withdraw_amount
, '' AS withdraw_fee
, amount AS deposit_amount
, 0 AS deposit_fee
, '' AS rate
, currency AS deposit_currency
, '' AS withdraw_currency
, '' AS transfer_currency
, '' AS transfer_amount
, 0 AS TYPE
, 0 AS STATUS
, '' AS message
, '' AS method
, msecond AS msecond
, 0 AS process_status
FROM
t_exchange
WHERE
user_account = '__ELEMENT01__'
AND currency = '__ELEMENT02__') exchange_sub
LEFT OUTER JOIN
v_users_all AS withdraw_user ON(withdraw_account_number = withdraw_user.user_account)
LEFT OUTER JOIN
v_users_all AS deposit_user ON(deposit_account_number = deposit_user.user_account)
WHERE 1 __ELEMENT03__
) benef_exchange,
(SELECT COUNT(*) FROM (SELECT /* 両替(出金) */
create_time AS transaction_time create_time AS transaction_time
, create_time AS process_time , create_time AS process_time
, DATE_FORMAT(create_time, '%Y/%m/%d') AS transaction_time_string , DATE_FORMAT(create_time, '%Y/%m/%d') AS transaction_time_string
...@@ -4801,15 +4779,9 @@ WHERE ...@@ -4801,15 +4779,9 @@ WHERE
t_exchange t_exchange
WHERE WHERE
user_account = '__ELEMENT01__' user_account = '__ELEMENT01__'
AND debit_currency = '__ELEMENT02__') exchange_sub AND debit_currency = '__ELEMENT02__'
LEFT OUTER JOIN UNION
v_users_all AS withdraw_user ON(withdraw_account_number = withdraw_user.user_account) SELECT /* 口座振替(出金) */
LEFT OUTER JOIN
v_users_all AS deposit_user ON(deposit_account_number = deposit_user.user_account)
WHERE 1 __ELEMENT03__
) debit_exchange,
(SELECT COUNT(*) FROM (SELECT /* 口座振替(出金) */
create_time AS transaction_time create_time AS transaction_time
, create_time AS process_time , create_time AS process_time
, DATE_FORMAT(create_time, '%Y/%m/%d') AS transaction_time_string , DATE_FORMAT(create_time, '%Y/%m/%d') AS transaction_time_string
...@@ -4837,15 +4809,9 @@ WHERE ...@@ -4837,15 +4809,9 @@ WHERE
t_transfer t_transfer
WHERE WHERE
user_account = '__ELEMENT01__' user_account = '__ELEMENT01__'
AND debit_currency = '__ELEMENT02__') transfer_sub AND debit_currency = '__ELEMENT02__'
LEFT OUTER JOIN UNION
v_users_all AS withdraw_user ON(withdraw_account_number = withdraw_user.user_account) SELECT /* 口座振替(入金) */
LEFT OUTER JOIN
v_users_all AS deposit_user ON(deposit_account_number = deposit_user.user_account)
WHERE 1 __ELEMENT03__
) remitter,
(SELECT COUNT(*) FROM (SELECT /* 口座振替(入金) */
create_time AS transaction_time create_time AS transaction_time
, create_time AS process_time , create_time AS process_time
, DATE_FORMAT(create_time, '%Y/%m/%d') AS transaction_time_string , DATE_FORMAT(create_time, '%Y/%m/%d') AS transaction_time_string
...@@ -4873,15 +4839,9 @@ WHERE ...@@ -4873,15 +4839,9 @@ WHERE
t_transfer t_transfer
WHERE WHERE
to_account = '__ELEMENT01__' to_account = '__ELEMENT01__'
AND transfer_currency = '__ELEMENT02__') transfer_sub AND transfer_currency = '__ELEMENT02__'
LEFT OUTER JOIN UNION
v_users_all AS withdraw_user ON(withdraw_account_number = withdraw_user.user_account) SELECT /* 引き落し(出金) */
LEFT OUTER JOIN
v_users_all AS deposit_user ON(deposit_account_number = deposit_user.user_account)
WHERE 1 __ELEMENT03__
) receiver,
(SELECT COUNT(*) FROM (SELECT /* 引き落し(出金) */
update_time AS transaction_time update_time AS transaction_time
, update_time AS process_time , update_time AS process_time
, DATE_FORMAT(create_time, '%Y/%m/%d') AS transaction_time_string , DATE_FORMAT(create_time, '%Y/%m/%d') AS transaction_time_string
...@@ -4910,15 +4870,9 @@ WHERE ...@@ -4910,15 +4870,9 @@ WHERE
WHERE WHERE
from_account = '__ELEMENT01__' from_account = '__ELEMENT01__'
AND debit_currency = '__ELEMENT02__' AND debit_currency = '__ELEMENT02__'
AND STATUS = 1) request_sub AND STATUS = 1
LEFT OUTER JOIN UNION
v_users_all AS withdraw_user ON(withdraw_account_number = withdraw_user.user_account) SELECT /* 引き落し(入金) */
LEFT OUTER JOIN
v_users_all AS deposit_user ON(deposit_account_number = deposit_user.user_account)
WHERE 1 __ELEMENT03__
) from_request,
(SELECT COUNT(*) FROM (SELECT /* 引き落し(入金) */
update_time AS transaction_time update_time AS transaction_time
, update_time AS process_time , update_time AS process_time
, DATE_FORMAT(create_time, '%Y/%m/%d') AS transaction_time_string , DATE_FORMAT(create_time, '%Y/%m/%d') AS transaction_time_string
...@@ -4947,15 +4901,9 @@ WHERE ...@@ -4947,15 +4901,9 @@ WHERE
WHERE WHERE
to_account = '__ELEMENT01__' to_account = '__ELEMENT01__'
AND currency = '__ELEMENT02__' AND currency = '__ELEMENT02__'
AND STATUS = 1) request_sub AND STATUS = 1
LEFT OUTER JOIN UNION
v_users_all AS withdraw_user ON(withdraw_account_number = withdraw_user.user_account) SELECT /* 出金(組戻し) */
LEFT OUTER JOIN
v_users_all AS deposit_user ON(deposit_account_number = deposit_user.user_account)
WHERE 1 __ELEMENT03__
) to_request,
(SELECT COUNT(*) FROM (SELECT /* 出金(組戻し) */
create_time AS transaction_time create_time AS transaction_time
, process_time AS process_time , process_time AS process_time
, DATE_FORMAT(create_time, '%Y/%m/%d') AS transaction_time_string , DATE_FORMAT(create_time, '%Y/%m/%d') AS transaction_time_string
...@@ -4984,15 +4932,9 @@ WHERE ...@@ -4984,15 +4932,9 @@ WHERE
WHERE WHERE
STATUS = '4' STATUS = '4'
AND user_account = '__ELEMENT01__' AND user_account = '__ELEMENT01__'
AND debit_currency = '__ELEMENT02__') withdraw_sub AND debit_currency = '__ELEMENT02__'
LEFT OUTER JOIN UNION
v_users_all AS withdraw_user ON(withdraw_account_number = withdraw_user.user_account) SELECT /* 出金(キャンセル) */
LEFT OUTER JOIN
v_users_all AS deposit_user ON(deposit_account_number = deposit_user.user_account)
WHERE 1 __ELEMENT03__
) with1,
(SELECT COUNT(*) FROM (SELECT /* 出金(キャンセル) */
create_time AS transaction_time create_time AS transaction_time
, process_time AS process_time , process_time AS process_time
, DATE_FORMAT(create_time, '%Y/%m/%d') AS transaction_time_string , DATE_FORMAT(create_time, '%Y/%m/%d') AS transaction_time_string
...@@ -5021,15 +4963,9 @@ WHERE ...@@ -5021,15 +4963,9 @@ WHERE
WHERE WHERE
STATUS = '6' STATUS = '6'
AND user_account = '__ELEMENT01__' AND user_account = '__ELEMENT01__'
AND debit_currency = '__ELEMENT02__') withdraw_sub AND debit_currency = '__ELEMENT02__'
LEFT OUTER JOIN UNION
v_users_all AS withdraw_user ON(withdraw_account_number = withdraw_user.user_account) SELECT /* 账户休止金 */
LEFT OUTER JOIN
v_users_all AS deposit_user ON(deposit_account_number = deposit_user.user_account)
WHERE 1 __ELEMENT03__
) with2,
(SELECT COUNT(*) FROM (SELECT /* 账户休止金 */
create_time AS transaction_time create_time AS transaction_time
, process_time AS process_time , process_time AS process_time
, DATE_FORMAT(create_time, '%Y/%m/%d') AS transaction_time_string , DATE_FORMAT(create_time, '%Y/%m/%d') AS transaction_time_string
...@@ -5059,14 +4995,14 @@ WHERE ...@@ -5059,14 +4995,14 @@ WHERE
STATUS = '2' STATUS = '2'
AND user_account = '__ELEMENT01__' AND user_account = '__ELEMENT01__'
AND debit_currency = '__ELEMENT02__' AND debit_currency = '__ELEMENT02__'
AND TYPE = '11') withdraw_sub AND TYPE = '11'
LEFT OUTER JOIN ) AS trans_in
v_users_all AS withdraw_user ON(withdraw_account_number = withdraw_user.user_account) LEFT OUTER JOIN v_users_all AS withdraw_user
LEFT OUTER JOIN ON (trans_in.withdraw_account_number = withdraw_user.user_account)
v_users_all AS deposit_user ON(deposit_account_number = deposit_user.user_account) LEFT OUTER JOIN v_users_all AS deposit_user
WHERE 1 __ELEMENT03__ ON (trans_in.deposit_account_number = deposit_user.user_account)
) with3 WHERE 1
) counts __ELEMENT03__
</SELECT_USER_TRANSACTION_ADMIN_COUNT> </SELECT_USER_TRANSACTION_ADMIN_COUNT>
<LIST_USER_TRANSACTION_ADMIN_COUNT_REVISED> <LIST_USER_TRANSACTION_ADMIN_COUNT_REVISED>
......
...@@ -24,11 +24,11 @@ class LogicAccountTransactions extends ModelAccountTransactions { ...@@ -24,11 +24,11 @@ class LogicAccountTransactions extends ModelAccountTransactions {
"overall_total"); "overall_total");
$this -> setTotal($rowCount); $this -> setTotal($rowCount);
$start = ($this -> getTargetPage() - VAL_INT_1) * VAR_DEFAULT_PAGE_COUNT; $start = ($this -> getTargetPage() - VAL_INT_1) * $this -> getDefaultPageCount();
$this -> setStart($start); $this -> setStart($start);
$where[] = " LIMIT {$start}, ".VAR_DEFAULT_PAGE_COUNT; $where[] = " LIMIT {$start}, {$this -> getDefaultPageCount()}";
$this -> setResult($this -> accessSelect('LIST_USER_TRANSACTION_ADMIN', $where)); $this -> setResult($this -> accessSelect('LIST_USER_TRANSACTION_ADMIN', $where));
} }
......
...@@ -366,7 +366,7 @@ class ModelAccountTransactions extends ModelClassEx { ...@@ -366,7 +366,7 @@ class ModelAccountTransactions extends ModelClassEx {
public function dispPager() { public function dispPager() {
echo $this -> getPagerCommon($this -> getTargetPage() echo $this -> getPagerCommon($this -> getTargetPage()
, $this -> getTotalPageCommon(VAR_DEFAULT_PAGE_COUNT, $this -> total) , $this -> getTotalPageCommon($this -> getDefaultPageCount(), $this -> total)
, $this -> total , $this -> total
, NO_STRING , NO_STRING
, false); , false);
...@@ -376,6 +376,10 @@ class ModelAccountTransactions extends ModelClassEx { ...@@ -376,6 +376,10 @@ class ModelAccountTransactions extends ModelClassEx {
$this -> rs = $rs; $this -> rs = $rs;
} }
public function getDefaultPageCount(){
return VAL_INT_20;
}
public function getCurrency(){ public function getCurrency(){
return $this -> currency; return $this -> currency;
} }
......
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