我試圖讓這個儘可能簡單。我是一個新的批次,我有一個小的isuue與理解如何將春天的項目,尤其是當涉及到多步驟工作,但是這是我的邏輯沒有代碼(簡化),我不知道它impliment它在一起Spring Batch的,所以我想這可能是正確的結構如何在spring批處理中實現這個簡單的邏輯?
- reader_money
- reader_details
- 任務蕾
- reader_profit
- tasklet_calculation
- 作家
然而,請糾正我,如果我錯了,並提供一些代碼,如果可能的話。 非常感謝你
LOGIC:
sql = "select * from MONEY where id= user input"; //the user will input the condition
while (records are available) {
int currency= resultset(currency column);
sql= "select * from DETAILS where D_currency = currency";
while (records are available) {
int amount= resultset(amount column);
string money_flag= resultset(money_type column);
sql= "select * from PROFIT where Mtypes = money_type";
while (records are available) {
int revenue= resultset(revenue);
if (money_type== 1) {
int net_profit= revenue * 3.75;
sql = "update PROFIT set Nprofit = net_profit";
}
else (money_type== 2) {
int net_profit = (revenue - 5) * 3.7 ;
sql = "update PROFIT set Nprofit = net_profit";
}
}
sql="update DETAILS set detail_falg = 001 ";
}
sql = "update MONEY set currency_flag = 009";
}
感謝小費,但我不能,因爲每個arrgument返回結果這將在下一個sql語句的where子句中:S有沒有其他方法? – user1744446 2013-04-27 05:16:30
有幾種方法可以解決這個問題: a)單獨的查詢/寫入步驟 b)使用一個步驟與多個處理器 Spring批處理不允許數據在步驟之間輕鬆移動。您可以使用臨時表,或者(如果數據量較小)使用「作業/步驟」上下文跨步執行數據。 對於處理器,您可以有一個遍歷所有(3個)處理器的對象,其中包含來自早期處理器的數據,然後下一個處理器可以使用它。 – ahaaman 2013-08-01 10:04:15