"WHERE a.PROJ_ID = b.ID AND b.DELETE_FLAG = 0 order by b.ID desc limit ?, ?";
List<Project> projects = jdbcTemplate.query(sql, new RowMapper<Project>() {
public Project mapRow(ResultSet rs, int rowNum) throws SQLException,
DataAccessException {
Project project = new Project();
project.setId(rs.getLong(1));
project.setCode(rs.getString(2));
project.setName(rs.getString(3));
return project;
}
}, offset, limit);
return projects;
} else {
String sql = "SELECT distinct b.ID, b.PROJ_CODE, b.PROJ_NAME FROM CONF_PROJECT_USER a, CONF_PROJECT b " +
"WHERE a.PROJ_ID = b.ID and a.USER_ID=? AND b.DELETE_FLAG = 0 order by b.ID desc limit ?, ?";
List<Project> projects = jdbcTemplate.query(sql, new RowMapper<Project>() {
public Project mapRow(ResultSet rs, int rowNum) throws SQLException,
DataAccessException {
Project project = new Project();
project.setId(rs.getLong(1));
project.setCode(rs.getString(2));
project.setName(rs.getString(3));
return project;
}
}, user.getId(), offset, limit);
return projects;
}