小程序点歌 新增待演唱统计数字段
This commit is contained in:
parent
465d6f8d60
commit
37fb8e55c1
|
|
@ -29,7 +29,7 @@ public interface TbShopSongOrderMapper {
|
|||
int updateByPrimaryKey(TbShopSongOrder record);
|
||||
|
||||
@Select("<script>SELECT\n" +
|
||||
" b.img, b.name, b.origin_singer originSinger, b.price, a.from_name fromName, a.to_name toName, a.note\n" +
|
||||
" a.id orderId, b.img, b.name, b.origin_singer originSinger, b.price, a.from_name fromName, a.to_name toName, a.note\n" +
|
||||
" FROM\n" +
|
||||
" tb_shop_song_order AS a\n" +
|
||||
" LEFT JOIN tb_shop_song AS b ON a.song_id = b.id\n" +
|
||||
|
|
@ -56,7 +56,7 @@ public interface TbShopSongOrderMapper {
|
|||
int deleteExpireOrder();
|
||||
|
||||
@Select("SELECT\n" +
|
||||
" b.img, b.name, b.origin_singer originSinger, b.price, a.from_name fromName, a.to_name toName, a.note\n" +
|
||||
" a.id orderId,b.img, b.name, b.origin_singer originSinger, b.price, a.from_name fromName, a.to_name toName, a.note\n" +
|
||||
" FROM\n" +
|
||||
" tb_shop_song_order AS a\n" +
|
||||
" LEFT JOIN tb_shop_song AS b ON a.song_id = b.id\n" +
|
||||
|
|
@ -66,4 +66,7 @@ public interface TbShopSongOrderMapper {
|
|||
|
||||
@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 open_id=#{openId} and state=2 limit 1")
|
||||
Map<String, Object> selectSinging(@Param("openId") String openId);
|
||||
|
||||
@Select("select id from tb_shop_song_order where state=1 or state=2 order by create_time asc")
|
||||
List<TbShopSongOrder> selectWaitAll();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,10 +27,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
|
|
@ -80,10 +77,16 @@ public class TbShopSongServiceImpl implements TbShopSongService{
|
|||
songOrders = shopSongOrderMapper.selectByUserId(openId, state);
|
||||
}
|
||||
|
||||
LinkedHashMap<String, Integer> rank = new LinkedHashMap<>();
|
||||
List<TbShopSongOrder> tbShopSongOrders = shopSongOrderMapper.selectWaitAll();
|
||||
for (int i = 0; i < tbShopSongOrders.size(); i++) {
|
||||
rank.put(tbShopSongOrders.get(i).getId().toString(), i);
|
||||
}
|
||||
|
||||
ArrayList<Map<String, Object>> infos = new ArrayList<>();
|
||||
for (int i = 0; i < songOrders.size(); i++) {
|
||||
Map<String, Object> toMap = songOrders.get(i);
|
||||
toMap.put("preCount", i);
|
||||
toMap.put("preCount", rank.get(String.valueOf(songOrders.get(i).get("orderId"))));
|
||||
infos.add(toMap);
|
||||
}
|
||||
return new PageInfo<>(infos);
|
||||
|
|
|
|||
Loading…
Reference in New Issue