Пример #1
0
  @Override
  public void edit(AcademicKPI domain) {
    logger.info("domain : " + BeanUtils.getBeanString(domain));

    this.jdbcTemplate.update(
        "update    academic_kpi set name=?,mark=?,unit_code=? ,rule_code=? ,order_no=?,description=? ,"
            + " special_p1=?,   special_p2=?, special_p3=?, special_p4=?, total_student_from=?, total_student_to=?,from_reg=? where academic_kpi_id=? ",
        domain.getName(),
        domain.getMark(),
        domain.getUnitCode(),
        domain.getMultiplyValue(),
        domain.getOrderNo(),
        domain.getDescription(),
        domain.getSpecialP1(),
        domain.getSpecialP2(),
        domain.getSpecialP3(),
        domain.getSpecialP4(),
        domain.getTotalStudentFrom(),
        domain.getTotalStudentTo(),
        domain.getFromRegis(),
        domain.getAcademicKPIId());

    List<AcademicKPIAttribute> academicKPIAttributeList = domain.getAcademicKPIAttributeList();
    if (academicKPIAttributeList != null && academicKPIAttributeList.size() > 0) {
      for (AcademicKPIAttribute tmp : academicKPIAttributeList) {
        logger.info(" checkValue:" + tmp.getIsCalculate());
        String isCheckFlage = "on".equalsIgnoreCase(tmp.getIsCalculate()) ? "Y" : "N";
        String isCheckFlage2 = "on".equalsIgnoreCase(tmp.getIsValidateNumber()) ? "Y" : "N";
        logger.info(
            "  Name :"
                + tmp.getName()
                + " isCal:"
                + isCheckFlage
                + " isValidateNumber:"
                + isCheckFlage2);
        this.jdbcTemplate.update(
            "update    academic_kpi_attribute set name=?, is_calculate=?,is_validate_number=?  where kpi_attribute_id=? ",
            tmp.getName(),
            isCheckFlage,
            isCheckFlage2,
            tmp.getAcademicKPIAtributeId());
      }
    }
  }
Пример #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;
  }
Пример #3
0
  @Override
  public AcademicKPIAttribute addNewAttribute(AcademicKPIAttribute academicKPIAttribute) {
    logger.info("domain : " + BeanUtils.getBeanString(academicKPIAttribute));
    final int nexCode = generateCodeUtil.getNextAttributeCode(academicKPIAttribute);
    final AcademicKPIAttribute finalDomain = academicKPIAttribute;
    KeyHolder keyHolder = new GeneratedKeyHolder();
    jdbcTemplate.update(
        new PreparedStatementCreator() {
          public PreparedStatement createPreparedStatement(Connection connection)
              throws SQLException {
            PreparedStatement ps =
                connection.prepareStatement(
                    ""
                        + "  insert into academic_kpi_attribute (name, code,academic_kpi_code,is_calculate,academic_year,academic_kpi_id,mandatory) values (?, ?,?,?,?,?,?  )"
                        + "",
                    Statement.RETURN_GENERATED_KEYS);
            ps.setString(1, finalDomain.getName());
            ps.setInt(2, nexCode);
            ps.setInt(3, new Integer(finalDomain.getAcademicKPICode()));
            ps.setString(4, finalDomain.getIsCalculate());

            ps.setString(5, finalDomain.getAcademicYear());
            ps.setLong(6, finalDomain.getAcademicKPIId());
            ps.setString(7, finalDomain.getMandatory());
            return ps;
          }
        },
        keyHolder);
    Long returnid = keyHolder.getKey().longValue();

    String sql = " select *  from academic_kpi_attribute where kpi_attribute_id =" + returnid + "";
    logger.info(" sql:" + sql);
    AcademicKPIAttribute returnObj =
        this.jdbcTemplate.queryForObject(sql, new AcademicKPIAttributeMapper());

    return returnObj;
  }
Пример #4
0
  @Override
  public Long importwork(AcademicKPIUserMapping domain) {
    logger.info("domain : " + BeanUtils.getBeanString(domain));

    final AcademicKPIUserMapping finalDomain = domain;

    if (finalDomain.getAcademicKPIId() != null) {

      if ("Y".equalsIgnoreCase(finalDomain.getIsCoTeach())) {
        finalDomain.setStatus(SchoolConstants.STATUS_CREATE_CO_TEACH);
      }

      KeyHolder keyHolder = new GeneratedKeyHolder();
      jdbcTemplate.update(
          new PreparedStatementCreator() {
            public PreparedStatement createPreparedStatement(Connection connection)
                throws SQLException {
              PreparedStatement ps =
                  connection.prepareStatement(
                      ""
                          + "  insert into academic_kpi_user_mapping (academic_kpi_code, academic_year,user_name,academic_kpi_id,work_type_code"
                          + " ,name,ratio,create_date,status,from_source, is_co_teach) values (?, ?,? ,?,?,?,?,?,?,?,?)"
                          + "",
                      Statement.RETURN_GENERATED_KEYS);
              ps.setString(1, finalDomain.getAcademicKPICode());
              ps.setString(2, finalDomain.getAcademicYear());
              ps.setString(3, finalDomain.getUserName());
              ps.setLong(4, finalDomain.getAcademicKPIId());
              ps.setString(5, finalDomain.getWorkTypeCode());
              ps.setString(6, finalDomain.getName());
              ps.setInt(7, finalDomain.getRatio());
              ps.setTimestamp(8, new Timestamp(System.currentTimeMillis()));
              ps.setString(9, finalDomain.getStatus());
              ps.setString(10, finalDomain.getFromSource());
              ps.setString(11, finalDomain.getIsCoTeach());
              return ps;
            }
          },
          keyHolder);
      final Long returnid = keyHolder.getKey().longValue();

      logger.info(" academic_kpi_return_id:" + returnid);

      List<AcademicKPIAttributeValue> academicKPIAttributeValueList =
          finalDomain.getAcademicKPIAttributeValueList();
      for (final AcademicKPIAttributeValue tmp : academicKPIAttributeValueList) {

        jdbcTemplate.update(
            new PreparedStatementCreator() {
              public PreparedStatement createPreparedStatement(Connection connection)
                  throws SQLException {
                PreparedStatement ps =
                    connection.prepareStatement(
                        ""
                            + "  insert into academic_kpi_attribute_value (kpi_user_mapping_id, name,value,academic_year,create_date ,from_source) values (?, ?,?,?,?,?  )"
                            + "",
                        Statement.RETURN_GENERATED_KEYS);
                ps.setLong(1, returnid);
                ps.setString(2, tmp.getName());
                ps.setString(3, tmp.getValue());
                ps.setString(4, finalDomain.getAcademicYear());
                ps.setTimestamp(5, new Timestamp(System.currentTimeMillis()));
                ps.setString(6, finalDomain.getFromSource());
                logger.info(
                    " insert  academic_kpi_attribute_value  with academic_kpi_user_mapping_id: "
                        + returnid
                        + "  with attribute name:"
                        + tmp.getName()
                        + "  value:"
                        + tmp.getValue());
                return ps;
              }
            },
            keyHolder);
      }
      return returnid;
    } else {
      return 1l;
    }
  }
Пример #5
0
 @Override
 public void update(Util util) {
   logger.info(" #UtilDaoImpl.update util: " + BeanUtils.getBeanString(util));
   this.jdbcTemplate.update(
       "update  project_util set detail=?   where util_id=? ", util.getDetail(), util.getUtilId());
 }