歌曲页面 增加 歌手页地址
This commit is contained in:
@@ -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.AnonymousGetMapping;
|
||||||
import cn.ysk.cashier.annotation.rest.AnonymousPostMapping;
|
import cn.ysk.cashier.annotation.rest.AnonymousPostMapping;
|
||||||
@@ -51,27 +51,9 @@ public class TbShopSongOrderController{
|
|||||||
@ApiOperation("获取歌曲列表 分页")
|
@ApiOperation("获取歌曲列表 分页")
|
||||||
@AnonymousGetMapping
|
@AnonymousGetMapping
|
||||||
public ResponseEntity<Object> selectAll(TbShopSongOrderQueryCriteria tbShopSongOrder) {
|
public ResponseEntity<Object> selectAll(TbShopSongOrderQueryCriteria tbShopSongOrder) {
|
||||||
String code = "";
|
return new ResponseEntity<>(tbShopSongOrderService.queryAll(tbShopSongOrder), HttpStatus.OK);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@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);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过主键查询单条数据
|
* 通过主键查询单条数据
|
||||||
*
|
*
|
||||||
@@ -1,13 +1,17 @@
|
|||||||
package cn.ysk.cashier.controller.shop;
|
package cn.ysk.cashier.controller.shop;
|
||||||
|
|
||||||
import cn.ysk.cashier.annotation.Log;
|
import cn.ysk.cashier.annotation.Log;
|
||||||
|
import cn.ysk.cashier.annotation.rest.AnonymousPostMapping;
|
||||||
import cn.ysk.cashier.dto.shop.TbShopSongQueryCriteria;
|
import cn.ysk.cashier.dto.shop.TbShopSongQueryCriteria;
|
||||||
import cn.ysk.cashier.exception.BadRequestException;
|
import cn.ysk.cashier.exception.BadRequestException;
|
||||||
import cn.ysk.cashier.mybatis.entity.TbShopSong;
|
import cn.ysk.cashier.mybatis.entity.TbShopSong;
|
||||||
import cn.ysk.cashier.mybatis.service.TbShopSongService;
|
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.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.apache.commons.lang3.RandomStringUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
@@ -16,6 +20,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@@ -23,14 +28,35 @@ import java.util.List;
|
|||||||
@Api(tags = "歌曲管理")
|
@Api(tags = "歌曲管理")
|
||||||
@RequestMapping("/api/tbShopSong")
|
@RequestMapping("/api/tbShopSong")
|
||||||
public class TbShopSongController {
|
public class TbShopSongController {
|
||||||
|
private final RedisUtils redisUtils;
|
||||||
private final TbShopSongService tbShopSongService;
|
private final TbShopSongService tbShopSongService;
|
||||||
|
|
||||||
@GetMapping
|
@GetMapping
|
||||||
@ApiOperation("查询歌曲列表")
|
@ApiOperation("查询歌曲列表")
|
||||||
public ResponseEntity<Object> queryTbShopPurveyor(TbShopSongQueryCriteria criteria){
|
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);
|
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
|
@PostMapping
|
||||||
@Log("新增歌曲:#resources.name")
|
@Log("新增歌曲:#resources.name")
|
||||||
@ApiOperation("新增歌曲")
|
@ApiOperation("新增歌曲")
|
||||||
|
|||||||
Reference in New Issue
Block a user