Commit b2f5ff48 by zhengxj

finish 菜单编辑 on 20190306 by zhengxj

git-svn-id: svn://192.168.3.233/frms/code/car-service/trunk/car-service@18175 aeb6102e-e053-11e5-9fec-f9ebc45caf4b
1 parent 71dc2427
...@@ -145,26 +145,24 @@ public class SysMenuServiceImpl implements ISysMenuService { ...@@ -145,26 +145,24 @@ public class SysMenuServiceImpl implements ISysMenuService {
public int updateByPrimaryKey(SysMenu sysMenu) { public int updateByPrimaryKey(SysMenu sysMenu) {
SysMenuExample example = new SysMenuExample(); SysMenuExample example = new SysMenuExample();
Criteria criteria = example.createCriteria(); Criteria criteria = example.createCriteria();
Integer targetSort=sysMenu.getSort();
SysMenu source = menuDao.selectByPrimaryKey(sysMenu.getId());
Integer sourceSort=source.getSort();
List<SysMenu> targets = null; List<SysMenu> targets = null;
if (sysMenu.getSort() != null) { if (targetSort != null) {
criteria.andSortEqualTo(sysMenu.getSort()).andParentIdEqualTo(sysMenu.getParentId());
criteria.andSortEqualTo(targetSort).andParentIdEqualTo(source.getParentId());
targets = menuDao.selectByExample(example); targets = menuDao.selectByExample(example);
} }
SysMenu source = menuDao.selectByPrimaryKey(sysMenu.getId());
int sort = 0;
if (source != null) {
sort = source.getSort();
if (sysMenu.getSort() != null) {
source.setSort(sysMenu.getSort());
}
}
if (targets != null && targets.size() == 1) { if (targets != null && targets.size() == 1) {
SysMenu target = targets.get(0); SysMenu target = targets.get(0);
target.setSort(sort); target.setSort(sourceSort);
target.setUpdateTime(new Date());
updateByPrimaryKeySelective(target); updateByPrimaryKeySelective(target);
} }
return updateByPrimaryKeySelective(source); sysMenu.setUpdateTime(new Date());
return updateByPrimaryKeySelective(sysMenu);
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!