private void appendChildProjects( long projectId, ResourceMapper mapper, List<ResourceDto> resources) { List<ResourceDto> subProjects = mapper.selectDescendantProjects(projectId); for (ResourceDto subProject : subProjects) { resources.add(subProject); appendChildProjects(subProject.getId(), mapper, resources); } }
public ResourceDao insertOrUpdate(ResourceDto... resources) { SqlSession session = mybatis.openSession(false); ResourceMapper mapper = session.getMapper(ResourceMapper.class); try { for (ResourceDto resource : resources) { if (resource.getId() == null) { resource.setCreatedAt(new Date()); mapper.insert(resource); } else { mapper.update(resource); } } session.commit(); } finally { MyBatis.closeQuietly(session); } return this; }
private String getExternalName(String path) { return m_mapper.externalize(path); }
private String getInternalPath(String path) { return m_mapper.internalize(path); }
public void insertUsingExistingSession(ResourceDto resourceDto, SqlSession session) { ResourceMapper resourceMapper = session.getMapper(ResourceMapper.class); resourceMapper.insert(resourceDto); }