| | |
| | | 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.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.api.ApiController; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.example.jz.modle.R; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.*; |
| | | import java.util.function.Consumer; |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | @DeleteMapping("/manager") |
| | | @ApiOperation("删除管理") |
| | | @ApiOperation("删除管理人员") |
| | | public R removeManager(@RequestParam Integer id) { |
| | | causeService.list(new LambdaQueryWrapper<Cause>().eq(Cause::getUserId, id)).forEach(item -> { |
| | | causeService.deleteCause(item.getId()); |
| | | }); |
| | | List<Cause> list = causeService.list(new LambdaQueryWrapper<Cause>().eq(Cause::getUserId, id)); |
| | | if (!Objects.isNull(list) && list.size() != 0){ |
| | | ArrayList<Map> maps = new ArrayList<>(); |
| | | for (Cause cause : list) { |
| | | HashMap<String, String> map = new HashMap<>(); |
| | | map.put("caseName", cause.getName()); |
| | | map.put("caseNumber", cause.getNumber()); |
| | | maps.add(map); |
| | | } |
| | | return R.failed(maps, "该警员还有案件关联,若要删除请先修改对应案件关联的警员"); |
| | | } |
| | | // causeService.list(new LambdaQueryWrapper<Cause>().eq(Cause::getUserId, id)).forEach(item -> { |
| | | // causeService.deleteCause(item.getId()); |
| | | // }); |
| | | // userService.remove(new LambdaQueryWrapper<User>().eq(User::getId, id)); |
| | | messageService.remove(new LambdaQueryWrapper<Message>().eq(Message::getCopId, id)); |
| | | return R.ok(userService.removeById(id)); |
| | | } |
| | | |
| | | @DeleteMapping("/crowd") |
| | | @ApiOperation("删除普通用户") |
| | | public R removeCrowd(@RequestParam Integer id){ |
| | | List<Report> list = reportService.list(Wrappers.<Report>lambdaQuery().eq(Report::getUserId, id)); |
| | | for (Report report : list) { |
| | | groupUserService.remove(new LambdaQueryWrapper<GroupUser>().eq(GroupUser::getUserId, report.getId())); |
| | | messageService.remove(new LambdaQueryWrapper<Message>().eq(Message::getUserId, report.getId())); |
| | | reportService.removeById(report.getId()); |
| | | } |
| | | userService.remove(Wrappers.<User>lambdaQuery().eq(User::getId, id)); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @GetMapping("/manager") |
| | | @ApiOperation("分页查询所有数据") |
| | | public R selectManager(Page<User> page, User user) { |