| | |
| | | package com.example.jz.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.example.jz.modle.R; |
| | | import com.example.jz.modle.dto.ManagerDto; |
| | | import com.example.jz.modle.entity.User; |
| | | import com.example.jz.service.UserService; |
| | | import com.example.jz.modle.entity.*; |
| | | import com.example.jz.service.*; |
| | | import com.example.jz.utils.Md5Utils; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | @Api(tags = "用户管理") |
| | | public class UserController extends ApiController { |
| | | private UserService userService; |
| | | |
| | | @Autowired |
| | | ReportService reportService; |
| | | @Autowired |
| | | GroupUserService groupUserService; |
| | | @Autowired |
| | | MessageService messageService; |
| | | @Autowired |
| | | CauseService causeService; |
| | | |
| | | @Autowired |
| | | public void setUserService(UserService userService) { |
| | |
| | | @DeleteMapping |
| | | @ApiOperation("删除用户数据") |
| | | public R delete(@RequestParam("id") Integer id) { |
| | | reportService |
| | | .list(new LambdaQueryWrapper<Report>().eq(Report::getUserId, id)) |
| | | .stream() |
| | | .forEach(item -> { |
| | | groupUserService.remove(new LambdaQueryWrapper<GroupUser>().eq(GroupUser::getUserId, item.getId())); |
| | | messageService.remove(new LambdaQueryWrapper<Message>().eq(Message::getUserId, item.getId())); |
| | | }); |
| | | reportService.remove(new LambdaQueryWrapper<Report>().eq(Report::getUserId, id)); |
| | | return R.ok(this.userService.removeById(id)); |
| | | } |
| | | |
| | |
| | | @DeleteMapping("/manager") |
| | | @ApiOperation("删除管理") |
| | | public R removeManager(@RequestParam Integer id) { |
| | | causeService.list(new LambdaQueryWrapper<Cause>().eq(Cause::getUserId, id)).forEach(item -> { |
| | | causeService.deleteCause(item.getId()); |
| | | }); |
| | | messageService.remove(new LambdaQueryWrapper<Message>().eq(Message::getCopId, id)); |
| | | return R.ok(userService.removeById(id)); |
| | | } |
| | | |