style: 调整后端部分方法名 save => add

This commit is contained in:
Charles7c 2023-12-24 22:39:15 +08:00
parent 2720275b97
commit 45bd3e10b6
10 changed files with 21 additions and 21 deletions

View File

@ -131,9 +131,9 @@ public class LoginServiceImpl implements LoginService {
user.setGender(GenderEnum.valueOf(authUser.getGender().name()));
user.setAvatar(authUser.getAvatar());
user.setDeptId(SysConstants.SUPER_DEPT_ID);
Long userId = userService.save(user);
Long userId = userService.add(user);
RoleDO role = roleService.getByCode(SysConstants.ADMIN_ROLE_CODE);
userRoleService.save(Collections.singletonList(role.getId()), userId);
userRoleService.add(Collections.singletonList(role.getId()), userId);
userSocial = new UserSocialDO();
userSocial.setUserId(userId);
userSocial.setSource(source);

View File

@ -27,7 +27,7 @@ import java.util.List;
public interface RoleDeptService {
/**
* 保存
* 新增
*
* @param deptIds
* 部门 ID 列表
@ -35,7 +35,7 @@ public interface RoleDeptService {
* 角色 ID
* @return true成功false无变更/失败
*/
boolean save(List<Long> deptIds, Long roleId);
boolean add(List<Long> deptIds, Long roleId);
/**
* 根据角色 ID 删除

View File

@ -27,7 +27,7 @@ import java.util.List;
public interface RoleMenuService {
/**
* 保存
* 新增
*
* @param menuIds
* 菜单 ID 列表
@ -35,7 +35,7 @@ public interface RoleMenuService {
* 角色 ID
* @return true成功false无变更/失败
*/
boolean save(List<Long> menuIds, Long roleId);
boolean add(List<Long> menuIds, Long roleId);
/**
* 根据角色 ID 删除

View File

@ -27,7 +27,7 @@ import java.util.List;
public interface UserRoleService {
/**
* 保存
* 新增
*
* @param roleIds
* 角色 ID 列表
@ -35,7 +35,7 @@ public interface UserRoleService {
* 用户 ID
* @return true成功false无变更/失败
*/
boolean save(List<Long> roleIds, Long userId);
boolean add(List<Long> roleIds, Long userId);
/**
* 根据用户 ID 删除

View File

@ -38,13 +38,13 @@ import top.charles7c.continew.starter.extension.crud.base.BaseService;
public interface UserService extends BaseService<UserResp, UserDetailResp, UserQuery, UserReq> {
/**
* 保存用户信息
* 新增
*
* @param user
* 用户信息
* @return ID
*/
Long save(UserDO user);
Long add(UserDO user);
/**
* 上传头像

View File

@ -44,7 +44,7 @@ public class RoleDeptServiceImpl implements RoleDeptService {
@Override
@Transactional(rollbackFor = Exception.class)
public boolean save(List<Long> deptIds, Long roleId) {
public boolean add(List<Long> deptIds, Long roleId) {
// 检查是否有变更
List<Long> oldDeptIdList = roleDeptMapper.lambdaQuery().select(RoleDeptDO::getDeptId)
.eq(RoleDeptDO::getRoleId, roleId).list().stream().map(RoleDeptDO::getDeptId).collect(Collectors.toList());

View File

@ -45,7 +45,7 @@ public class RoleMenuServiceImpl implements RoleMenuService {
@Override
@Transactional(rollbackFor = Exception.class)
public boolean save(List<Long> menuIds, Long roleId) {
public boolean add(List<Long> menuIds, Long roleId) {
// 检查是否有变更
List<Long> oldMenuIdList = roleMenuMapper.lambdaQuery().select(RoleMenuDO::getMenuId)
.eq(RoleMenuDO::getRoleId, roleId).list().stream().map(RoleMenuDO::getMenuId).collect(Collectors.toList());

View File

@ -75,9 +75,9 @@ public class RoleServiceImpl extends BaseServiceImpl<RoleMapper, RoleDO, RoleRes
req.setStatus(DisEnableStatusEnum.ENABLE);
Long roleId = super.add(req);
// 保存角色和菜单关联
roleMenuService.save(req.getMenuIds(), roleId);
roleMenuService.add(req.getMenuIds(), roleId);
// 保存角色和部门关联
roleDeptService.save(req.getDeptIds(), roleId);
roleDeptService.add(req.getDeptIds(), roleId);
return roleId;
}
@ -103,9 +103,9 @@ public class RoleServiceImpl extends BaseServiceImpl<RoleMapper, RoleDO, RoleRes
// 更新关联信息
if (!SysConstants.ADMIN_ROLE_CODE.equals(oldRole.getCode())) {
// 保存角色和菜单关联
boolean isSaveMenuSuccess = roleMenuService.save(req.getMenuIds(), id);
boolean isSaveMenuSuccess = roleMenuService.add(req.getMenuIds(), id);
// 保存角色和部门关联
boolean isSaveDeptSuccess = roleDeptService.save(req.getDeptIds(), id);
boolean isSaveDeptSuccess = roleDeptService.add(req.getDeptIds(), id);
// 如果角色编码功能权限或数据权限有变更则清除关联的在线用户重新登录以获取最新角色权限
if (ObjectUtil.notEqual(req.getCode(), oldCode) || ObjectUtil.notEqual(req.getDataScope(), oldDataScope)
|| isSaveMenuSuccess || isSaveDeptSuccess) {

View File

@ -44,7 +44,7 @@ public class UserRoleServiceImpl implements UserRoleService {
@Override
@Transactional(rollbackFor = Exception.class)
public boolean save(List<Long> roleIds, Long userId) {
public boolean add(List<Long> roleIds, Long userId) {
// 检查是否有变更
List<Long> oldRoleIdList = userRoleMapper.lambdaQuery().select(UserRoleDO::getRoleId)
.eq(UserRoleDO::getUserId, userId).list().stream().map(UserRoleDO::getRoleId).collect(Collectors.toList());

View File

@ -82,7 +82,7 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, UserDO, UserRes
private DeptService deptService;
@Override
public Long save(UserDO user) {
public Long add(UserDO user) {
user.setStatus(DisEnableStatusEnum.ENABLE);
baseMapper.insert(user);
return user.getId();
@ -104,7 +104,7 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, UserDO, UserRes
.set(UserDO::getPassword, SecureUtils.md5Salt(SysConstants.DEFAULT_PASSWORD, userId.toString()))
.set(UserDO::getPwdResetTime, LocalDateTime.now()).eq(UserDO::getId, userId).update();
// 保存用户和角色关联
userRoleService.save(req.getRoleIds(), userId);
userRoleService.add(req.getRoleIds(), userId);
return userId;
}
@ -132,7 +132,7 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, UserDO, UserRes
// 更新信息
super.update(req, id);
// 保存用户和角色关联
userRoleService.save(req.getRoleIds(), id);
userRoleService.add(req.getRoleIds(), id);
}
@Override
@ -248,7 +248,7 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, UserDO, UserRes
public void updateRole(UserRoleUpdateReq updateReq, Long id) {
super.getById(id);
// 保存用户和角色关联
userRoleService.save(updateReq.getRoleIds(), id);
userRoleService.add(updateReq.getRoleIds(), id);
}
@Override