歌曲页面 增加 歌手页地址

This commit is contained in:
wangw 2024-07-10 14:00:12 +08:00
parent 2efdb7d780
commit d528c4c10d
2 changed files with 28 additions and 20 deletions

View File

@ -1,4 +1,4 @@
package cn.ysk.cashier.controller.shop;
package cn.ysk.cashier.controller.order;
import cn.ysk.cashier.annotation.rest.AnonymousGetMapping;
import cn.ysk.cashier.annotation.rest.AnonymousPostMapping;
@ -51,27 +51,9 @@ public class TbShopSongOrderController{
@ApiOperation("获取歌曲列表 分页")
@AnonymousGetMapping
public ResponseEntity<Object> selectAll(TbShopSongOrderQueryCriteria tbShopSongOrder) {
String code = "";
if(redisUtils.hasKey(CacheKey.SONG_URL + tbShopSongOrder.getShopId())){
code = (String) redisUtils.get(CacheKey.SONG_URL + tbShopSongOrder.getShopId());
}
Map<String, Object> stringObjectMap = tbShopSongOrderService.queryAll(tbShopSongOrder);
stringObjectMap.put("songUrl",code);
return new ResponseEntity<>(stringObjectMap, HttpStatus.OK);
return new ResponseEntity<>(tbShopSongOrderService.queryAll(tbShopSongOrder), HttpStatus.OK);
}
@PostMapping("createUrl")
@ApiOperation("更新歌手页地址")
@AnonymousPostMapping
public ResponseEntity<Object> createUrl(String shopId) {
String key = RandomStringUtils.randomAlphanumeric(8);
redisUtils.set(CacheKey.SONG_URL + shopId, key);
redisUtils.set(CacheKey.SONG_URL + key, shopId);
return new ResponseEntity<>(key,HttpStatus.OK);
}
/**
* 通过主键查询单条数据
*

View File

@ -1,13 +1,17 @@
package cn.ysk.cashier.controller.shop;
import cn.ysk.cashier.annotation.Log;
import cn.ysk.cashier.annotation.rest.AnonymousPostMapping;
import cn.ysk.cashier.dto.shop.TbShopSongQueryCriteria;
import cn.ysk.cashier.exception.BadRequestException;
import cn.ysk.cashier.mybatis.entity.TbShopSong;
import cn.ysk.cashier.mybatis.service.TbShopSongService;
import cn.ysk.cashier.utils.CacheKey;
import cn.ysk.cashier.utils.RedisUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@ -16,6 +20,7 @@ import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List;
import java.util.Map;
@RestController
@ -23,14 +28,35 @@ import java.util.List;
@Api(tags = "歌曲管理")
@RequestMapping("/api/tbShopSong")
public class TbShopSongController {
private final RedisUtils redisUtils;
private final TbShopSongService tbShopSongService;
@GetMapping
@ApiOperation("查询歌曲列表")
public ResponseEntity<Object> queryTbShopPurveyor(TbShopSongQueryCriteria criteria){
String code = "";
if(redisUtils.hasKey(CacheKey.SONG_URL + criteria.getShopId())){
code = (String) redisUtils.get(CacheKey.SONG_URL + criteria.getShopId());
}else {
code = RandomStringUtils.randomAlphanumeric(8);
redisUtils.set(CacheKey.SONG_URL + criteria.getShopId(), code);
redisUtils.set(CacheKey.SONG_URL + code, criteria.getShopId());
}
Map<String, Object> stringObjectMap = tbShopSongService.queryAll(criteria);
stringObjectMap.put("songUrl",code);
return new ResponseEntity<>(tbShopSongService.queryAll(criteria), HttpStatus.OK);
}
@PostMapping("createUrl")
@ApiOperation("更新歌手页地址")
@AnonymousPostMapping
public ResponseEntity<Object> createUrl(String shopId) {
String key = RandomStringUtils.randomAlphanumeric(8);
redisUtils.set(CacheKey.SONG_URL + shopId, key);
redisUtils.set(CacheKey.SONG_URL + key, shopId);
return new ResponseEntity<>(key,HttpStatus.OK);
}
@PostMapping
@Log("新增歌曲:#resources.name")
@ApiOperation("新增歌曲")