同步删除账户

This commit is contained in:
sxu 2025-04-07 16:24:50 +08:00
parent d86b20c246
commit 72615f513f
2 changed files with 17 additions and 0 deletions

View File

@ -6,16 +6,24 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import java.util.List;
@FeignClient(value="bonus-smart-canteen") @FeignClient(value="bonus-smart-canteen")
@Service @Service
@Component @Component
public interface SmartCanteenClient { public interface SmartCanteenClient {
@ApiOperation(value = "新增账户") @ApiOperation(value = "新增账户")
@RequestMapping(value = "/acc_info/sync",method = RequestMethod.POST) @RequestMapping(value = "/acc_info/sync",method = RequestMethod.POST)
AjaxResult syncAccInfo(SysUser sysUser); AjaxResult syncAccInfo(SysUser sysUser);
@ApiOperation(value = "删除账户")
@RequestMapping(value = "/acc_info/deleteAccInfoByUserIds",method = RequestMethod.POST)
AjaxResult deleteAccInfoByUserIds(List<SysUser> users);
} }

View File

@ -525,6 +525,15 @@ public class SysUserServiceImpl implements ISysUserService {
userRoleMapper.deleteUserRole(userIds); userRoleMapper.deleteUserRole(userIds);
// 删除用户与岗位关联 // 删除用户与岗位关联
userPostMapper.deleteUserPost(userIds); userPostMapper.deleteUserPost(userIds);
// 同步删除账户信息
List<SysUser> users = new ArrayList<>();
for (int i = 0; i < userIds.length; i++) {
SysUser user = new SysUser();
user.setUserId(userIds[i]);
users.add(user);
}
smartCanteenClient.deleteAccInfoByUserIds(users);
return userMapper.deleteUserByIds(userIds); return userMapper.deleteUserByIds(userIds);
} }