public Integer saveMachine(Map param) { String machineId = (String) param.get("MachineId"); Machine mt = null; if (WebUtil.isNotNull(machineId)) { List<Machine> l = this.getHibernateTemplate().find("from Machine where id = ?", new Integer(machineId)); if (!WebUtil.isNullForList(l)) { mt = l.get(0); } } Date date = new Date(); if (mt == null) { mt = new Machine(); mt.setCtime(date); mt.setCuser((String) param.get("UserName")); mt.setStatus("NORMAL"); mt.setOrigin("NEW"); } else { mt.setMtime(date); mt.setMuser((String) param.get("UserName")); } if (WebUtil.isNotNull(param.get("MachineCd"))) mt.setMachineCd((String) param.get("MachineCd")); if (WebUtil.isNotNull(param.get("MachineTypeId"))) mt.setMachineTypeId(new Integer(param.get("MachineTypeId").toString())); if (WebUtil.isNotNull(param.get("MachineNo"))) mt.setMachineNo((String) param.get("MachineNo")); if (WebUtil.isNotNull(param.get("PpsNo"))) mt.setPpsNo((String) param.get("PpsNo")); if (WebUtil.isNotNull(param.get("ServiceFromDate"))) mt.setServiceFromDate( WebUtil.toDateForString(param.get("ServiceFromDate").toString(), "yyyy-MM-dd")); if (WebUtil.isNotNull(param.get("ServiceEndDate"))) mt.setServiceEndDate( WebUtil.toDateForString(param.get("ServiceEndDate").toString(), "yyyy-MM-dd")); if (WebUtil.isNotNull(param.get("OutDate"))) mt.setOutDate(WebUtil.toDateForString(param.get("OutDate").toString(), "yyyy-MM-dd")); if (WebUtil.isNotNull(param.get("InvoiceDate"))) mt.setInvoiceDate(WebUtil.toDateForString(param.get("InvoiceDate").toString(), "yyyy-MM-dd")); if (WebUtil.isNotNull(param.get("PaymentStatus"))) mt.setPaymentStatus((String) param.get("PaymentStatus")); if (WebUtil.isNotNull(param.get("PaymentCompany"))) mt.setPaymentCompany((String) param.get("PaymentCompany")); if (WebUtil.isNotNull(param.get("PaymentCompanyCd"))) mt.setPaymentCompanyCd((String) param.get("PaymentCompanyCd")); if (WebUtil.isNotNull(param.get("PaymentDate"))) mt.setPaymentDate(WebUtil.toDateForString(param.get("PaymentDate").toString(), "yyyy-MM-dd")); if (WebUtil.isNotNull(param.get("PaymentAmt"))) mt.setPaymentAmt(new BigDecimal(param.get("PaymentAmt").toString())); if (WebUtil.isNotNull(param.get("CustomerNo"))) mt.setCustomerNo(param.get("CustomerNo").toString()); if (WebUtil.isNotNull(param.get("CustomerName"))) mt.setCustomerName(param.get("CustomerName").toString()); if (mt.getId() == null) this.getHibernateTemplate().save(mt); else this.getHibernateTemplate().update(mt); return mt.getId(); }