标签:
public synchronized void sort(File file, int displayOrder, int parentId){ int max = count(parentId); if(displayOrder > max){ displayOrder = max; } if(file.getDisplayOrder() > displayOrder){ fileDao.batchExecute("update File set displayOrder = displayOrder + 1 where parentId = ? and displayOrder >=? and displayOrder < ?", displayOrder, file.getDisplayOrder()); } else{ fileDao.batchExecute("update File set displayOrder = displayOrder - 1 where parentId = ? and displayOrder >? and displayOrder <= ?", file.getDisplayOrder(), displayOrder); } file.setDisplayOrder(displayOrder); save(file); }
标签:
原文地址:http://www.cnblogs.com/rubekid/p/4886592.html