@POST @At("/ht/pamget") @Ok("json") public Parameter get(String table, long id) { Parameter para = null; if (id > 0 && StringUtil.checkNotNull(table)) { Record rd = baseService.dao.fetch(table, Cnd.where("parameterID", "=", id)); para = this.record2Object(rd); para.setStationID(table); para.setParameterID(id); } return para; }
private Parameter record2Object(Record rd) { Parameter p = new Parameter(); p.setParameterID((Long) rd.get("parameterID")); p.setCreateDate((Date) rd.get("createDate")); p.setFmin(rd.getString("Fmin")); p.setM3000F(rd.getString("M3000F")); p.setM3000F1(rd.getString("M3000F1")); p.setM3000F2(rd.getString("M3000F2")); p.setM1500F2(rd.getString("M1500F2")); p.setMUF3000F1(rd.getString("MUF3000F1")); p.setMUF3000F2(rd.getString("MUF3000F2")); for (String fie : paField) { try { BeanUtils.setProperty(p, fie, rd.get(fie)); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InvocationTargetException e) { // TODO Auto-generated catch block e.printStackTrace(); } } return p; }