Revision 42469
Added by Antonis Lempesis over 8 years ago
modules/uoa-goldoa-service/trunk/src/main/java/eu/dnetlib/goldoa/service/dao/BudgetDAO.java | ||
---|---|---|
34 | 34 |
@Autowired |
35 | 35 |
private DataSource dataSource; |
36 | 36 |
|
37 |
private static final String GET_BUDGET = "select id, date, startdate, \"enddate\", amount_requested, amount_granted, remaining, currency, status, bank_name, bank_address, bank_code, bank_holder, bank_iban, \"user\", transfer_cost, other_cost, date_paid, organization, publisher from budget b where id=?"; |
|
38 |
private static final String GET_BUDGETS = "select id, date, startdate, \"enddate\", amount_requested, amount_granted, remaining, currency, status, bank_name, bank_address, bank_code, bank_holder, bank_iban, \"user\", transfer_cost, other_cost, date_paid, organization, publisher from budget b order by date"; |
|
39 |
private static final String UPDATE_BUDGET = "update budget set date=?, startdate=?, \"enddate\"=?, amount_requested=?, amount_granted=?, remaining=?, currency=?, status=?, \"user\"=?, bank_name=?, bank_address=?, bank_code=?, bank_holder=?, bank_iban=?, transfer_cost=?, other_cost=?, date_paid=?, organization=?, publisher=? where id=?"; |
|
40 |
private static final String INSERT_BUDGET = "insert into budget (date, startdate, \"enddate\", amount_requested, amount_granted, remaining, currency, status, \"user\", bank_name, bank_address, bank_code, bank_holder, bank_iban, transfer_cost, other_cost, date_paid, organization, publisher, id) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
|
|
37 |
private static final String GET_BUDGET = "select id, date, startdate, \"enddate\", amount_requested, amount_granted, remaining, currency, status, bank_name, bank_address, bank_code, bank_holder, bank_iban, \"user\", transfer_cost, other_cost, date_paid, organization, publisher, invoice from budget b where id=?";
|
|
38 |
private static final String GET_BUDGETS = "select id, date, startdate, \"enddate\", amount_requested, amount_granted, remaining, currency, status, bank_name, bank_address, bank_code, bank_holder, bank_iban, \"user\", transfer_cost, other_cost, date_paid, organization, publisher, invoice from budget b order by date";
|
|
39 |
private static final String UPDATE_BUDGET = "update budget set date=?, startdate=?, \"enddate\"=?, amount_requested=?, amount_granted=?, remaining=?, currency=?, status=?, \"user\"=?, bank_name=?, bank_address=?, bank_code=?, bank_holder=?, bank_iban=?, transfer_cost=?, other_cost=?, date_paid=?, organization=?, publisher=?, invoice=? where id=?";
|
|
40 |
private static final String INSERT_BUDGET = "insert into budget (date, startdate, \"enddate\", amount_requested, amount_granted, remaining, currency, status, \"user\", bank_name, bank_address, bank_code, bank_holder, bank_iban, transfer_cost, other_cost, date_paid, organization, publisher, invoice, id) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
|
|
41 | 41 |
|
42 |
|
|
43 |
private static final String GET_USER_BUDGETS = "select id, date, startdate, \"enddate\", amount_requested, amount_granted, remaining, currency, status, bank_name, bank_address, bank_code, bank_holder, bank_iban, \"user\", transfer_cost, other_cost, date_paid, organization, publisher from budget b where \"user\"=? order by date"; |
|
44 |
private static final String GET_ORGANIZATION_BUDGETS = "select id, date, startdate, \"enddate\", amount_requested, amount_granted, remaining, currency, status, bank_name, bank_address, bank_code, bank_holder, bank_iban, \"user\", transfer_cost, other_cost, date_paid, organization, publisher from budget b where array[organization]::text[] <@ ?::text[] order by date"; |
|
45 |
private static final String GET_PUBLISHER_BUDGETS = "select id, date, startdate, \"enddate\", amount_requested, amount_granted, remaining, currency, status, bank_name, bank_address, bank_code, bank_holder, bank_iban, \"user\", transfer_cost, other_cost, date_paid, organization, publisher from budget b where publisher=? order by date"; |
|
46 |
private static final String GET_ACCOUNTING_BUDGETS = "select id, date, startdate, \"enddate\", amount_requested, amount_granted, remaining, currency, status, bank_name, bank_address, bank_code, bank_holder, bank_iban, \"user\", transfer_cost, other_cost, date_paid, organization, publisher from budget b order by date"; |
|
42 |
private static final String GET_USER_BUDGETS = "select id, date, startdate, \"enddate\", amount_requested, amount_granted, remaining, currency, status, bank_name, bank_address, bank_code, bank_holder, bank_iban, \"user\", transfer_cost, other_cost, date_paid, organization, publisher, invoice from budget b where \"user\"=? order by date"; |
|
43 |
private static final String GET_ORGANIZATION_BUDGETS = "select id, date, startdate, \"enddate\", amount_requested, amount_granted, remaining, currency, status, bank_name, bank_address, bank_code, bank_holder, bank_iban, \"user\", transfer_cost, other_cost, date_paid, organization, publisher, invoice from budget b where array[organization]::text[] <@ ?::text[] order by date"; |
|
44 |
private static final String GET_PUBLISHER_BUDGETS = "select id, date, startdate, \"enddate\", amount_requested, amount_granted, remaining, currency, status, bank_name, bank_address, bank_code, bank_holder, bank_iban, \"user\", transfer_cost, other_cost, date_paid, organization, publisher, invoice from budget b where publisher=? order by date"; |
|
45 |
private static final String GET_ACCOUNTING_BUDGETS = "select id, date, startdate, \"enddate\", amount_requested, amount_granted, remaining, currency, status, bank_name, bank_address, bank_code, bank_holder, bank_iban, \"user\", transfer_cost, other_cost, date_paid, organization, publisher, invoice from budget b order by date"; |
|
47 | 46 |
private static final String APPROVE_BUDGET = "update budget set status = ?, amount_granted=?, remaining=? where id=?"; |
48 | 47 |
private static final String UPDATE_BUDGET_STATUS = "update budget set status = ? where id=?"; |
49 | 48 |
|
... | ... | |
92 | 91 |
budget.getAmountRequested(), budget.getAmountGranted(), budget.getRemaining(), budget.getCurrency().name(), |
93 | 92 |
budget.getStatusCode(), budget.getUser(), bankAccount.getBankName(), bankAccount.getBankAddress(), |
94 | 93 |
bankAccount.getBankCode(), bankAccount.getAccountHolder(), bankAccount.getIban(), budget.getTransfer_cost(), |
95 |
budget.getOther_cost(), budget.getDatePaid(), budget.getOrganisation(), budget.getPublisher(), budget.getId()}; |
|
94 |
budget.getOther_cost(), budget.getDatePaid(), budget.getOrganisation(), budget.getPublisher(), budget.getInvoice(), budget.getId()};
|
|
96 | 95 |
int[] types = new int[]{Types.TIMESTAMP, Types.TIMESTAMP, Types.TIMESTAMP, Types.REAL, Types.REAL, Types.REAL, |
97 | 96 |
Types.VARCHAR, Types.INTEGER, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, |
98 |
Types.VARCHAR, Types.REAL, Types.REAL, Types.TIMESTAMP, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR}; |
|
97 |
Types.VARCHAR, Types.REAL, Types.REAL, Types.TIMESTAMP, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR};
|
|
99 | 98 |
|
100 | 99 |
if (jdbcTemplate.update(UPDATE_BUDGET, args, types) == 0) { |
101 | 100 |
jdbcTemplate.update(INSERT_BUDGET, args, types); |
Also available in: Unified diff
fixed sql queries