字符串类型key

This commit is contained in:
wangw 2025-03-08 17:41:19 +08:00
parent 41a27794b2
commit a05437d3e7
2 changed files with 2 additions and 4 deletions

View File

@ -25,8 +25,6 @@ public class UserCouponVo {
//优惠券类型 1 满减 2 商品券 //优惠券类型 1 满减 2 商品券
private Integer type; private Integer type;
//数量
private Integer num;
//到期时间 //到期时间
private Date endTime; private Date endTime;
private String useRestrictions; private String useRestrictions;

View File

@ -160,14 +160,14 @@ public class ShopActivateServiceImpl extends ServiceImpl<ShopActivateMapper, Sho
* 获取优惠券详细信息 目前仅返回 id 名称 剩余数量 赠送数量 * 获取优惠券详细信息 目前仅返回 id 名称 剩余数量 赠送数量
*/ */
private List<ShopCoupon> getCoupons(String couponJson) { private List<ShopCoupon> getCoupons(String couponJson) {
Map<Long, Integer> couponMap = JSONObject.parseObject(couponJson, new TypeReference<>() { Map<String, Integer> couponMap = JSONObject.parseObject(couponJson, new TypeReference<>() {
}); });
List<ShopCoupon> list = couponService.queryChain() List<ShopCoupon> list = couponService.queryChain()
.select(ShopCoupon::getId, ShopCoupon::getTitle, ShopCoupon::getLeftNumber) .select(ShopCoupon::getId, ShopCoupon::getTitle, ShopCoupon::getLeftNumber)
.eq(ShopCoupon::getId, couponMap.keySet()) .eq(ShopCoupon::getId, couponMap.keySet())
.list(); .list();
list.forEach(coupon -> { list.forEach(coupon -> {
coupon.setNumber(couponMap.get(coupon.getId())); coupon.setNumber(couponMap.get(coupon.getId().toString()));
}); });
return list; return list;
} }