小程序点歌 点歌记录增加shopId
This commit is contained in:
parent
e785ee6467
commit
50ec8c7cd7
|
|
@ -52,12 +52,13 @@ public class ShopSongController {
|
|||
@GetMapping("/record")
|
||||
public Result getRecord(
|
||||
@RequestHeader("openId") String openId,
|
||||
@RequestParam("shopId") Integer shopId,
|
||||
@RequestParam(defaultValue = "1") Integer page,
|
||||
@RequestParam(defaultValue = "10") Integer size,
|
||||
@RequestParam(required = false) Integer state,
|
||||
@RequestParam(defaultValue = "true") boolean isDesc
|
||||
) {
|
||||
return Result.successWithData(shopSongService.getRecord(openId, page, size, state, isDesc));
|
||||
return Result.successWithData(shopSongService.getRecord(openId, page, size, state, isDesc,shopId));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -34,9 +34,9 @@ public interface TbShopSongOrderMapper {
|
|||
" tb_shop_song_order AS a\n" +
|
||||
" LEFT JOIN tb_shop_song AS b ON a.song_id = b.id\n" +
|
||||
" WHERE\n" +
|
||||
" a.open_id = #{openId} " +
|
||||
" a.open_id = #{openId} and a.shop_id=#{shopId} " +
|
||||
" <if test=\"state!=null\">AND a.state = #{state}</if></script>")
|
||||
List<Map<String, Object>> selectByUserId(@Param("openId") String openId, @Param("state") Integer state);
|
||||
List<Map<String, Object>> selectByUserId(@Param("openId") String openId, @Param("state") Integer state, Integer shopId);
|
||||
|
||||
@Select(" SELECT\n" +
|
||||
" *\n" +
|
||||
|
|
@ -61,8 +61,8 @@ public interface TbShopSongOrderMapper {
|
|||
" tb_shop_song_order AS a\n" +
|
||||
" LEFT JOIN tb_shop_song AS b ON a.song_id = b.id\n" +
|
||||
" WHERE\n" +
|
||||
" a.open_id = #{openId} and a.state in (1, 2, 3)")
|
||||
List<Map<String, Object>> selectActiveOrderByUserId(@Param("openId") String openId);
|
||||
" a.open_id = #{openId} and a.state in (1, 2, 3) and a.shop_id=#{shopId}")
|
||||
List<Map<String, Object>> selectActiveOrderByUserId(@Param("openId") String openId, Integer shopId);
|
||||
|
||||
@Select("SELECT a.song_name songName, a.id, b.img FROM `tb_shop_song_order` as a left join tb_shop_song as b on a.song_id=b.id where state=2 limit 1")
|
||||
Map<String, Object> selectSinging();
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ public interface TbShopSongService {
|
|||
*/
|
||||
PageInfo<?> all(Integer shopId, Integer page, Integer size, String keyWord, boolean isDesc);
|
||||
|
||||
Object getRecord(String openId, Integer page, Integer size, Integer state, boolean isDesc);
|
||||
Object getRecord(String openId, Integer page, Integer size, Integer state, boolean isDesc, Integer shopId);
|
||||
|
||||
/**
|
||||
* 创建订单
|
||||
|
|
|
|||
|
|
@ -68,13 +68,13 @@ public class TbShopSongServiceImpl implements TbShopSongService{
|
|||
}
|
||||
|
||||
@Override
|
||||
public Object getRecord(String openId, Integer page, Integer size, Integer state, boolean isDesc) {
|
||||
public Object getRecord(String openId, Integer page, Integer size, Integer state, boolean isDesc, Integer shopId) {
|
||||
PageHelper.startPage(page, size);
|
||||
List<Map<String, Object>> songOrders;
|
||||
if (state == null) {
|
||||
songOrders = shopSongOrderMapper.selectActiveOrderByUserId(openId);
|
||||
songOrders = shopSongOrderMapper.selectActiveOrderByUserId(openId, shopId);
|
||||
}else {
|
||||
songOrders = shopSongOrderMapper.selectByUserId(openId, state);
|
||||
songOrders = shopSongOrderMapper.selectByUserId(openId, state, shopId);
|
||||
}
|
||||
|
||||
LinkedHashMap<String, Integer> rank = new LinkedHashMap<>();
|
||||
|
|
|
|||
Loading…
Reference in New Issue