Esempio n. 1
0
 @Transactional(readOnly = false)
 public void save(Area area) {
   area.setParent(this.get(area.getParent().getId()));
   String oldParentIds = area.getParentIds(); // 获取修改前的parentIds,用于更新子节点的parentIds
   area.setParentIds(area.getParent().getParentIds() + area.getParent().getId() + ",");
   areaDao.clear();
   areaDao.save(area);
   // 更新子节点 parentIds
   List<Area> list = areaDao.findByParentIdsLike("%," + area.getId() + ",%");
   for (Area e : list) {
     e.setParentIds(e.getParentIds().replace(oldParentIds, area.getParentIds()));
   }
   areaDao.save(list);
   UserUtils.removeCache("areaList");
 }
Esempio n. 2
0
 @Transactional(readOnly = false)
 public void delete(Long id) {
   areaDao.deleteById(id, "%," + id + ",%");
   UserUtils.removeCache("areaList");
 }
Esempio n. 3
0
 public Area get(Long id) {
   return areaDao.findOne(id);
 }