| | |
| | | package com.xinquan.meditation.controller.client; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.xinquan.common.core.constant.SecurityConstants; |
| | | import com.xinquan.common.core.domain.R; |
| | |
| | | private HomeBackgroundMusicUserService homeBackgroundMusicUserService; |
| | | @Autowired |
| | | private TokenService tokenService; |
| | | |
| | | // 新增需求 用户注册默认给一个背景音频设置 |
| | | @GetMapping("/addHomeBackgroundMusicDefault/{id}") |
| | | public R addHomeBackgroundMusicDefault(@PathVariable("id") Long id) { |
| | | List<HomeBackgroundMusic> list = homeBackgroundMusicService.list(); |
| | | if (!list.isEmpty()) { |
| | | List<HomeBackgroundMusicUser> homeBackgroundMusicUserList = homeBackgroundMusicUserService.lambdaQuery().eq(HomeBackgroundMusicUser::getAppUserId, id).list(); |
| | | if (homeBackgroundMusicUserList.isEmpty()) { |
| | | HomeBackgroundMusicUser homeBackgroundMusicUser = new HomeBackgroundMusicUser(); |
| | | homeBackgroundMusicUser.setAppUserId(id); |
| | | homeBackgroundMusicUser.setHomeBackgroundMusicId(list.get(0).getId()); |
| | | homeBackgroundMusicUserService.save(homeBackgroundMusicUser); |
| | | } |
| | | } |
| | | return R.ok(); |
| | | } |
| | | @GetMapping("/listHomeBackgroundMusic") |
| | | @ApiOperation(value = "背景音乐列表查询-分页", tags = "管理后台-首页背景音乐管理") |
| | | @ApiImplicitParams({ |
| | |
| | | @PostMapping("/addHomeBackgroundMusic") |
| | | @Log(title = "【首页背景音乐管理】新增", businessType = BusinessType.INSERT) |
| | | @ApiOperation(value = "新增背景", tags = "管理后台-首页背景音乐管理") |
| | | |
| | | public R addHomeBackgroundMusic(@RequestBody HomeBackgroundMusic homeBackgroundMusic) { |
| | | return R.ok(homeBackgroundMusicService.save(homeBackgroundMusic)); |
| | | } |
| | |
| | | @ApiOperation(value = "修改背景", tags = "管理后台-首页背景音乐管理") |
| | | @Log(title = "【首页背景音乐管理】修改", businessType = BusinessType.UPDATE) |
| | | public R updateHomeBackgroundMusic(@RequestBody HomeBackgroundMusic homeBackgroundMusic) { |
| | | return R.ok(homeBackgroundMusicService.updateById(homeBackgroundMusic)); |
| | | homeBackgroundMusicService.updateById(homeBackgroundMusic); |
| | | LambdaUpdateWrapper<HomeBackgroundMusic> homeBackgroundMusicLambdaUpdateWrapper = new LambdaUpdateWrapper<>(); |
| | | if (homeBackgroundMusic.getBackUrl()==null){ |
| | | homeBackgroundMusicLambdaUpdateWrapper.set(HomeBackgroundMusic::getBackUrl,null); |
| | | homeBackgroundMusicLambdaUpdateWrapper.set(HomeBackgroundMusic::getBackName,null); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | @PostMapping("/deleteHomeBackgroundMusic") |
| | | @ApiOperation(value = "批量删除", tags = "管理后台-首页背景音乐管理") |