🎨 Improving structure / format of the code. closed #I43RA1 部分方法涉及多表未加@Transactional事务处理

This commit is contained in:
lbw committed 2021-08-04 09:17:11 +08:00
1 parent 74d08316c1
commit c122af1b0c
2 files changed
+2 -16

No files matched your search

@@ -49,8 +49,8 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
* @return
*/
@Override
@CacheEvict(value = CacheConstants.DICT_DETAILS, allEntries = true)
@Transactional(rollbackFor = Exception.class)
@CacheEvict(value = CacheConstants.DICT_DETAILS, allEntries = true)
public R removeDict(Integer id) {
SysDict dict = this.getById(id);
// 系统内置
@@ -35,7 +35,6 @@ import com.pig4cloud.pigx.common.core.constant.CacheConstants;
import com.pig4cloud.pigx.common.core.constant.CommonConstants;
import com.pig4cloud.pigx.common.core.util.R;
import com.pig4cloud.pigx.common.data.datascope.DataScope;
import com.pig4cloud.pigx.common.security.util.SecurityUtils;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
@@ -70,8 +69,6 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
private final SysUserRoleService sysUserRoleService;
private final SysDeptRelationService sysDeptRelationService;
/**
* 保存用户信息
* @param userDto DTO 对象
@@ -174,6 +171,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
}
@Override
@Transactional(rollbackFor = Exception.class)
@CacheEvict(value = CacheConstants.USER_DETAILS, key = "#userDto.username")
public Boolean updateUser(UserDTO userDto) {
SysUser sysUser = new SysUser();
@@ -214,16 +212,4 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
return this.list(Wrappers.<SysUser>query().lambda().eq(SysUser::getDeptId, parentId));
}
/**
* 获取当前用户的子部门信息
* @return 子部门列表
*/
private List<Integer> getChildDepts() {
Integer deptId = SecurityUtils.getUser().getDeptId();
// 获取当前部门的子部门
return sysDeptRelationService
.list(Wrappers.<SysDeptRelation>query().lambda().eq(SysDeptRelation::getAncestor, deptId)).stream()
.map(SysDeptRelation::getDescendant).collect(Collectors.toList());
}
}