| | |
| | | package com.xinquan.meditation.controller.client; |
| | | |
| | | |
| | | import cn.afterturn.easypoi.cache.manager.IFileLoader; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.xinquan.common.core.domain.R; |
| | |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @ApiOperation(value = "冥想馆列表-分页", tags = {"管理后台-冥想馆管理"}) |
| | | public R<PageDTO<MeditationHall>> meditationCategoryManagementList(@RequestBody MeditationHallDTO dto) { |
| | | LambdaQueryWrapper<MeditationHall> meditationLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | meditationLambdaQueryWrapper.like(MeditationHall::getHallName, dto.getHallName()); |
| | | meditationLambdaQueryWrapper.like(MeditationHall::getAddress, dto.getAddress()); |
| | | if (StringUtils.hasLength(dto.getHallName())){ |
| | | meditationLambdaQueryWrapper.like(MeditationHall::getHallName, dto.getHallName()); |
| | | |
| | | } |
| | | if (StringUtils.hasLength(dto.getAddress())) { |
| | | meditationLambdaQueryWrapper.like(MeditationHall::getAddress, dto.getAddress()); |
| | | } |
| | | meditationLambdaQueryWrapper.orderByDesc(MeditationHall::getCreateTime); |
| | | Page<MeditationHall> page = meditationHallService.page(new Page<>(dto.getPageCurr(), dto.getPageSize()), meditationLambdaQueryWrapper); |
| | | if (CollUtils.isEmpty(page.getRecords())) { |
| | |
| | | return R.ok(PageDTO.of(page, MeditationHall.class)); |
| | | } |
| | | @PostMapping("/addMeditationHall") |
| | | @ApiOperation(value = "新增冥想馆管理", notes = "管理后台-冥想馆管理") |
| | | @ApiOperation(value = "新增冥想馆管理", tags = "管理后台-冥想馆管理") |
| | | public R addMeditationHall(@RequestBody MeditationHall homeBackgroundMusic) { |
| | | homeBackgroundMusic.setCreateBy(SecurityUtils.getUsername()); |
| | | homeBackgroundMusic.setCreateTime(LocalDateTime.now()); |
| | | return R.ok(meditationHallService.save(homeBackgroundMusic)); |
| | | } |
| | | @GetMapping("/updateState") |
| | | @ApiOperation(value = "修改课程上下架状态", notes = "管理后台-课程管理") |
| | | @ApiOperation(value = "修改冥想馆上下架状态", tags = "管理后台-冥想馆管理") |
| | | public R updateState(String uid) { |
| | | MeditationHall byId = meditationHallService.getById(uid); |
| | | if (byId.getListingStatus() == 1){ |
| | |
| | | }else { |
| | | byId.setListingStatus(1); |
| | | } |
| | | meditationHallService.updateById(byId); |
| | | return R.ok(); |
| | | } |
| | | @GetMapping("/detailMeditationHall") |
| | | @ApiOperation(value = "查看详情冥想馆管理", notes = "管理后台-冥想馆管理") |
| | | @ApiOperation(value = "查看详情冥想馆管理", tags = "管理后台-冥想馆管理") |
| | | public R<MeditationHall> detailMeditationHall(String uid) { |
| | | return R.ok(meditationHallService.getById(uid)); |
| | | } |
| | | @PostMapping("/updateMeditationHall") |
| | | @ApiOperation(value = "修改冥想馆管理", notes = "管理后台-冥想馆管理") |
| | | @ApiOperation(value = "修改冥想馆管理", tags = "管理后台-冥想馆管理") |
| | | public R updateMeditationHall(@RequestBody MeditationHall homeBackgroundMusic) { |
| | | homeBackgroundMusic.setUpdateBy(SecurityUtils.getUsername()); |
| | | homeBackgroundMusic.setUpdateTime(LocalDateTime.now()); |
| | | return R.ok(meditationHallService.updateById(homeBackgroundMusic)); |
| | | } |
| | | @PostMapping("/deleteMeditationHall") |
| | | @ApiOperation(value = "批量删除", notes = "管理后台-冥想馆管理") |
| | | @ApiOperation(value = "批量删除", tags = "管理后台-冥想馆管理") |
| | | public R deleteMeditationHall(String ids) { |
| | | return R.ok(meditationHallService.removeBatchByIds(Arrays.asList(ids.split(",")))); |
| | | return R.ok(meditationHallService.removeBatchByIds(Arrays.asList(ids.split(",")).stream().map(Long::valueOf).collect(Collectors.toList()))); |
| | | } |
| | | } |
| | | |