public IdaMappingBean(Ida ida) { setId(ida.getId()); setStructName(ida.getStructName()); setStructAlias(ida.getStructAlias()); setMetadataId(ida.getMetadataId()); setSeq(ida.getSeq()); setXpath(ida.getXpath()); if (ida.getType() != null) { if (ida.getLength() != null) { setType(ida.getType() + "(" + ida.getLength() + ")"); } else { setType(ida.getType()); } } setScale(ida.getScale()); setLength(ida.getLength()); setRequired(ida.getRequired()); set_parentId(ida.getParentId()); setInterfaceId(ida.getInterfaceId()); setPotUser(ida.getPotUser()); setPotDate(ida.getPotDate()); setHeadId(ida.getHeadId()); setVersion(ida.getVersion()); setRemark(ida.getRemark()); }
@Override public boolean updateMetadataId(String metadataId, String id) { String hql = " update " + Ida.class.getName() + " set metadataId = ? where id = ?"; idaDAOImpl.batchExecute(hql, metadataId, id); Ida ida = idaDAOImpl.findUniqueBy("id", id); if (ida != null) { // 做一次版本更新 String interfaceId = ida.getInterfaceId(); if (org.apache.commons.lang.StringUtils.isNotEmpty(interfaceId)) { Interface inter = interfaceDAO.findUniqueBy("interfaceId", interfaceId); // 更新版本,只更新一次 versionServiceImpl.editVersion(inter.getVersionId()); } } return true; }
public void deletes(String[] ids) { boolean editFlag = true; for (String id : ids) { if (editFlag) { Ida ida = idaDAOImpl.findUniqueBy("id", id); String interfaceId = ida.getInterfaceId(); if (org.apache.commons.lang.StringUtils.isNotEmpty(interfaceId)) { Interface inter = interfaceDAO.findUniqueBy("interfaceId", interfaceId); // 更新版本,只更新一次 versionServiceImpl.editVersion(inter.getVersionId()); editFlag = false; } } idaDAOImpl.delete(id); } }
@Override public void saveOrUpdate(Ida[] idas) { boolean editFlag = true; for (Ida ida : idas) { if (StringUtils.isEmpty(ida.getHeadId())) { ida.setHeadId(null); } idaDAOImpl.save(ida); if (editFlag) { String interfaceId = ida.getInterfaceId(); if (org.apache.commons.lang.StringUtils.isNotEmpty(interfaceId)) { Interface inter = interfaceDAO.findUniqueBy("interfaceId", interfaceId); // 更新版本,只更新一次 versionServiceImpl.editVersion(inter.getVersionId()); editFlag = false; } } } }
public boolean deleteList(List<Ida> list) { idaDAOImpl.delete(list); boolean editFlag = true; for (int i = 0; i < list.size(); i++) { if (list.get(i) != null) { Ida ida = list.get(i); if (ida != null) { String interfaceId = ida.getInterfaceId(); if (org.apache.commons.lang.StringUtils.isNotEmpty(interfaceId)) { Interface inter = interfaceDAO.findUniqueBy("interfaceId", interfaceId); // 更新版本,只更新一次 versionServiceImpl.editVersion(inter.getVersionId()); editFlag = false; } } } if (!editFlag) break; } return true; }