防止操作跳到页面顶端

This commit is contained in:
RuoYi
2019-05-13 19:03:32 +08:00
parent 7662c1eeab
commit 0bad889607
19 changed files with 43 additions and 46 deletions

View File

@ -101,8 +101,8 @@ public interface SysDeptMapper
/**
* 根据ID查询所有子部门
* @param id
* @return
* @param deptId 部门ID
* @return 部门列表
*/
public List<SysDept> selectChildrenDeptById(Long id);
public List<SysDept> selectChildrenDeptById(Long deptId);
}

View File

@ -185,7 +185,7 @@ public class SysDeptServiceImpl implements ISysDeptService
* @return 结果
*/
@Override
@Transactional(rollbackFor = Exception.class)
@Transactional
public int updateDept(SysDept dept)
{
SysDept newParentDept = deptMapper.selectDeptById(dept.getParentId());
@ -195,7 +195,7 @@ public class SysDeptServiceImpl implements ISysDeptService
String newAncestors = newParentDept.getAncestors() + "," + newParentDept.getDeptId();
String oldAncestors = oldDept.getAncestors();
dept.setAncestors(newAncestors);
updateDeptChildren(dept.getDeptId(), newAncestors,oldAncestors);
updateDeptChildren(dept.getDeptId(), newAncestors, oldAncestors);
}
int result = deptMapper.updateDept(dept);
if (UserConstants.DEPT_NORMAL.equals(dept.getStatus()))
@ -221,16 +221,17 @@ public class SysDeptServiceImpl implements ISysDeptService
/**
* 修改子元素关系
*
* @param deptId 被修改的部门ID
* @param newAncestors 新的父ID集合
* @param oldAncestors 旧的父ID集合
*/
public void updateDeptChildren(Long deptId, String newAncestors,String oldAncestors)
public void updateDeptChildren(Long deptId, String newAncestors, String oldAncestors)
{
List<SysDept> children = deptMapper.selectChildrenDeptById(deptId);
for (SysDept child : children)
{
child.setAncestors(child.getAncestors().replace(oldAncestors,newAncestors));
child.setAncestors(child.getAncestors().replace(oldAncestors, newAncestors));
}
if (children.size() > 0)
{