@Override public UmsUnit removeEntity(UmsUnit unit) { // 验证是否含有下级组织机构码 UmsUnit qryEntity = new UmsUnit(); qryEntity.setPid(unit.getId()); List<UmsUnit> list = basDAOFacade.select(qryEntity); if (list != null && list.size() > 0) { throw new BizException("warning.ums.01001", new Object[] {}); } return basDAOFacade.delete(unit); }
@Override public UmsUnit modifyEntity(UmsUnit unit) { // 验证名称是否存在 UmsUnit qryEntity = new UmsUnit(); qryEntity.setUnitName(unit.getUnitName()); List<UmsUnit> list = basDAOFacade.select(qryEntity); if (list != null && list.size() != 0) { if (list.size() > 1) { throw new BizException("warning.ums.01005", new Object[] {}); } else { if (!list.get(0).getId().equals(unit.getId())) { throw new BizException("warning.ums.01005", new Object[] {}); } } } return basDAOFacade.update(unit); }
@Override public UmsUnit addEntity(UmsUnit unit) { // 验证名称是否存在 UmsUnit qryEntity = new UmsUnit(); qryEntity.setUnitName(unit.getUnitName()); List list = basDAOFacade.select(qryEntity); if (list != null && list.size() > 0) { throw new BizException("warning.ums.01005", new Object[] {}); } // unit.setId(UuidUtil.create());//前端生成 String unitRelationship = umsUnitDAOImpl.getNewRelationship(unit.getPid()); unit.setUnitRelationship(unitRelationship); this.basDAOFacade.insert(unit); return unit; }