public void updateResource(Resource resource) {
   if (resource.getId() == null) {
     resourceDao.save(resource);
   } else {
     resourceDao.update(resource);
   }
 }
 public List<Resource> getResourceList() {
   QueryAppender appender = new QueryAppender();
   appender.asc("resource.code");
   return resourceDao.find(appender);
 }
 public Page<Resource> getResourcePage(Page<Resource> page) {
   QueryAppender appender = new QueryAppender();
   appender.asc("resource.code");
   return resourceDao.findPage(page, appender);
 }
 public void deleteResource(Long resourceId) {
   resourceDao.delete(resourceId);
 }
 public Resource getResource(String code) {
   QueryAppender appender = new QueryAppender().equal("resource.code", code);
   return resourceDao.findUnique(appender);
 }
 public Resource getResource(Long resourceId) {
   return resourceDao.get(resourceId);
 }