@Override public AcademicKPIWrapper getAllByAcademicYear(String getByAcademicYear) { String sqlpbp_work_type = " select * from pbp_work_type where academic_year ='" + getByAcademicYear + "'"; logger.info(" getAllByAcademicYear sqlpbp_work_type:" + sqlpbp_work_type); AcademicKPIWrapper academicKPIWrapper = new AcademicKPIWrapper(); List<PBPWorkType> pBPWorkTypeList = this.jdbcTemplate.query(sqlpbp_work_type, new PBPWorkTypeMapper()); for (PBPWorkType tmp : pBPWorkTypeList) { String sqlkpi = " select * from academic_kpi where academic_year ='" + getByAcademicYear + "' and work_type_code ='" + tmp.getCode() + "' order by order_no"; logger.info(" sqlkpi:" + sqlkpi); List<AcademicKPI> academicKPIList = null; try { academicKPIList = this.jdbcTemplate.query(sqlkpi, new AcademicKPIMapper()); } catch (org.springframework.dao.EmptyResultDataAccessException ex) { ex.printStackTrace(); } for (AcademicKPI tmpxx : academicKPIList) { String sqlAttribute = " select * from academic_kpi_attribute where academic_year ='" + tmpxx.getAcademicYear() + "' and academic_kpi_code ='" + tmpxx.getCode() + "'"; List<AcademicKPIAttribute> academicKPIAttributeList = new ArrayList(); try { academicKPIAttributeList = this.jdbcTemplate.query(sqlAttribute, new AcademicKPIAttributeMapper()); } catch (org.springframework.dao.EmptyResultDataAccessException ex) { ex.printStackTrace(); } tmpxx.setAcademicKPIAttributeList(academicKPIAttributeList); } tmp.setAcademicKPIList(academicKPIList); } academicKPIWrapper.setpBPWorkTypeList(pBPWorkTypeList); return academicKPIWrapper; }
@Override public AcademicKPI getById(String id) { String sql = " select * from academic_kpi where academic_kpi_id =" + id + ""; logger.info(" sql:" + sql); AcademicKPI academicKPI = academicKPI = this.jdbcTemplate.queryForObject(sql, new AcademicKPIMapper()); if (academicKPI != null) { String sqlAttribute = " select * from academic_kpi_attribute where academic_kpi_code ='" + academicKPI.getCode() + "' and academic_year='" + academicKPI.getAcademicYear() + "'"; logger.info(" sqlAttribute:" + sqlAttribute); List<AcademicKPIAttribute> academicKPIAttributeList = this.jdbcTemplate.query(sqlAttribute, new AcademicKPIAttributeMapper()); academicKPI.setAcademicKPIAttributeList(academicKPIAttributeList); } return academicKPI; }