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;
 }
示例#3
0
 private String getExternalName(String path) {
   return m_mapper.externalize(path);
 }
示例#4
0
 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);
 }