Пример #1
0
    @Override
    public AcademicKPIAttribute mapRow(ResultSet rs, int rowNum) throws SQLException {
      AcademicKPIAttribute domain = new AcademicKPIAttribute();
      domain.setAcademicKPIAtributeId(rs.getLong("kpi_attribute_id"));
      domain.setAcademicKPIId(rs.getLong("academic_kpi_id"));
      domain.setName(rs.getString("name"));
      domain.setCode(rs.getString("code"));
      domain.setAcademicKPICode(rs.getString("academic_kpi_code"));
      domain.setIsCalculate(rs.getString("is_calculate"));
      domain.setIsValidateNumber(rs.getString("is_validate_number"));
      domain.setAcademicYear(rs.getString("academic_year"));
      domain.setMandatory(rs.getString("mandatory"));

      return domain;
    }
Пример #2
0
  @Override
  public Long create(AcademicKPI domain) {
    logger.info("domain : " + BeanUtils.getBeanString(domain));
    final int nexCode = generateCodeUtil.getNextaAcademicKPI(domain);
    final AcademicKPI finalDomain = domain;
    KeyHolder keyHolder = new GeneratedKeyHolder();
    jdbcTemplate.update(
        new PreparedStatementCreator() {
          public PreparedStatement createPreparedStatement(Connection connection)
              throws SQLException {
            PreparedStatement ps =
                connection.prepareStatement(
                    ""
                        + "  insert into academic_kpi (name, code,work_type_code,mark,academic_year,unit_code,rule_code,order_no,description) values (?, ?,?,?,?,?,?,?,?)"
                        + "",
                    Statement.RETURN_GENERATED_KEYS);
            ps.setString(1, finalDomain.getName());
            ps.setInt(2, nexCode);
            ps.setInt(3, new Integer(finalDomain.getWorkTypeCode()));
            ps.setBigDecimal(4, finalDomain.getMark());
            ps.setString(5, finalDomain.getAcademicYear());
            ps.setInt(6, new Integer(finalDomain.getUnitCode()));
            ps.setString(7, finalDomain.getMultiplyValue());
            ps.setInt(8, new Integer(finalDomain.getOrderNo()));
            ps.setString(9, finalDomain.getDescription());
            return ps;
          }
        },
        keyHolder);
    Long returnid = keyHolder.getKey().longValue();

    AcademicKPIAttribute academicKPIAttribute = new AcademicKPIAttribute();
    academicKPIAttribute.setAcademicKPICode(nexCode + "");
    academicKPIAttribute.setAcademicKPIId(returnid);
    academicKPIAttribute.setName("���ͧҹ");
    // academicKPIAttribute.setMandatory("Y");
    academicKPIAttribute.setAcademicYear(finalDomain.getAcademicYear());
    addNewAttribute(academicKPIAttribute);

    return returnid;
  }