Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public String getChecksForDashboard(Integer templateId, Integer shopId, JdbcTemplate jdbcPool){
- String getChecksForDashboardSql =
- " SELECT c.ID AS checklistId, c.GRADE AS checklistGrade,c.FINISH_DATE AS finishDate " +
- " FROM T_CHECKLIST c " +
- " WHERE c.TEMPLATE_ID=? AND c.SHOP_ID=? AND c.FINISH_DATE > (CURRENT_DATE - 365) " +
- " ORDER BY c.FINISH_DATE DESC ";
- List<CheckForDashboard> checkForDashboardList = jdbcPool.query(getChecksForDashboardSql,new Object[]{templateId,shopId},new RowMapper<CheckForDashboard>() {
- @Override
- public CheckForDashboard mapRow(ResultSet rs, int rowNum) throws SQLException {
- CheckForDashboard result = new CheckForDashboard();
- result.setCheklistId(rs.getInt("checklistid"));
- result.setCheklistGrade(rs.getFloat("cheklistgrade"));
- result.setFinishDate(rs.getDate("finishdate"));
- return result;
- }
- });
- StringWriter stringWriter = new StringWriter();
- ObjectMapper mapper = new ObjectMapper();
- try {
- mapper.writeValue(stringWriter,checkForDashboardList);
- } catch (IOException e) {
- e.printStackTrace();
- }
- return stringWriter.toString();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement