| | |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.Arrays; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | } |
| | | return R.ok(PageDTO.of(page, CourseCategory.class)); |
| | | } |
| | | @PostMapping("/courseCategoryManagementList1") |
| | | @ApiOperation(value = "分类列表-分页", tags = {"管理后台-分类管理"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "pageCurr", value = "分页参数,当前页码", dataType = "Integer", required = true), |
| | | @ApiImplicitParam(name = "pageSize", value = "分页参数,每页数量", dataType = "Integer", required = true) |
| | | }) |
| | | public R<PageDTO<CourseCategory>> courseCategoryManagementList1(@RequestParam(value = "pageCurr")Integer pageCurr, |
| | | @RequestParam(value = "pageSize")Integer pageSize) { |
| | | LambdaQueryWrapper<CourseCategory> courseLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | courseLambdaQueryWrapper.ne(CourseCategory::getName,"线下课程"); |
| | | courseLambdaQueryWrapper.orderByDesc(CourseCategory::getSortNum); |
| | | Page<CourseCategory> page = courseCategoryService.page(new Page<>(pageCurr, pageSize), courseLambdaQueryWrapper); |
| | | if (CollUtils.isEmpty(page.getRecords())) { |
| | | return R.ok(PageDTO.empty(page)); |
| | | } |
| | | for (CourseCategory record : page.getRecords()) { |
| | | record.setUid(record.getId()+""); |
| | | } |
| | | return R.ok(PageDTO.of(page, CourseCategory.class)); |
| | | } |
| | | @PostMapping("/addCourseCategory") |
| | | @ApiOperation(value = "新增分类管理", notes = "管理后台-分类管理") |
| | | @ApiOperation(value = "新增分类管理", tags = "管理后台-分类管理") |
| | | public R addCourseCategory(@RequestBody CourseCategory homeBackgroundMusic) { |
| | | homeBackgroundMusic.setCreateBy(SecurityUtils.getUsername()); |
| | | homeBackgroundMusic.setCreateTime(LocalDateTime.now()); |
| | | return R.ok(courseCategoryService.save(homeBackgroundMusic)); |
| | | } |
| | | @GetMapping("/detailCourseCategory") |
| | | @ApiOperation(value = "查看详情分类管理", notes = "管理后台-分类管理") |
| | | @ApiOperation(value = "查看详情分类管理", tags = "管理后台-分类管理") |
| | | public R<CourseCategory> detailCourseCategory(String uid) { |
| | | return R.ok(courseCategoryService.getById(uid)); |
| | | } |
| | | @PostMapping("/updateCourseCategory") |
| | | @ApiOperation(value = "修改分类管理", notes = "管理后台-分类管理") |
| | | @ApiOperation(value = "修改分类管理", tags = "管理后台-分类管理") |
| | | public R updateCourseCategory(@RequestBody CourseCategory homeBackgroundMusic) { |
| | | homeBackgroundMusic.setUpdateBy(SecurityUtils.getUsername()); |
| | | homeBackgroundMusic.setUpdateTime(LocalDateTime.now()); |
| | | return R.ok(courseCategoryService.updateById(homeBackgroundMusic)); |
| | | } |
| | | @PostMapping("/deleteCourseCategory") |
| | | @ApiOperation(value = "批量删除", notes = "管理后台-分类管理") |
| | | @ApiOperation(value = "批量删除", tags = "管理后台-分类管理") |
| | | public R deleteCourseCategory(String ids) { |
| | | return R.ok(courseCategoryService.removeBatchByIds(Arrays.asList(ids.split(",")))); |
| | | return R.ok(courseCategoryService.removeBatchByIds(Arrays.asList(ids.split(",")).stream().map(Long::valueOf).collect(Collectors.toList()))); |
| | | } |
| | | } |
| | | |