diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighCouponController.java b/hai-cweb/src/main/java/com/cweb/controller/HighCouponController.java index be7d182f..355a2a68 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighCouponController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighCouponController.java @@ -9,6 +9,9 @@ import com.hai.common.security.SessionObject; import com.hai.common.security.UserCenter; import com.hai.common.utils.ResponseMsgUtil; import com.hai.entity.BsCompany; +import com.hai.entity.HighUserCoupon; +import com.hai.model.HighUserCouponModel; +import com.hai.model.HighUserModel; import com.hai.model.ResponseData; import com.hai.model.UserInfoModel; import com.hai.service.*; @@ -45,6 +48,12 @@ public class HighCouponController { @Resource private BsCompanyService bsCompanyService; + @Resource + private HighCouponCodeService highCouponCodeService; + + @Resource + private HighUserCouponService highUserCouponService; + @RequestMapping(value="/getCouponList",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "卡卷列表") @@ -92,4 +101,67 @@ public class HighCouponController { } } + + + @RequestMapping(value = "/getUserCouponList", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "获取用户卡卷") + public ResponseData getUserCouponList(@RequestParam(name = "status", required = false) Integer status, + @RequestParam(name = "pageNum", required = true) Integer pageNum, + @RequestParam(name = "pageSize", required = true) Integer pageSize, + HttpServletRequest request) { + try { + + // 用户 + SessionObject sessionObject = userCenter.getSessionObject(request); + HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject(); + + Map map = new HashMap<>(); + map.put("userId", userInfoModel.getHighUser().getId()); + + PageHelper.startPage(pageNum, pageSize); + List list = highUserCouponService.getUserCouponList(map); + for (HighUserCouponModel highUserCouponModel : list) { + highUserCouponModel.setHighCouponModel(highCouponService.getCouponById(highUserCouponModel.getCouponId())); + } + return ResponseMsgUtil.success(new PageInfo<>()); + + } catch (Exception e) { + log.error("HighCouponController --> getUserCouponList() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + + @RequestMapping(value = "/getUserCouponDetail", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "获取用户卡卷") + public ResponseData getUserCouponDetail(@RequestParam(name = "couponId", required = true) Long couponId, + HttpServletRequest request) { + try { + + // 用户 + SessionObject sessionObject = userCenter.getSessionObject(request); + HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject(); + + HighUserCoupon coupon = highUserCouponService.getUserCoupon(userInfoModel.getHighUser().getId(), couponId); + if (coupon == null) { + log.error("HighCouponController --> getUserCouponDetail() error!", "卡卷库存数量不足"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, ""); + } + + Map map = new HashMap<>(); + map.put("highUserCoupon", "coupon"); + map.put("couponInfo", highCouponService.getCouponById(coupon.getCouponId())); + map.put("couponCodeInfo", highCouponCodeService.getCouponCodeById(coupon.getCouponCodeId())); + + return ResponseMsgUtil.success(map); + + } catch (Exception e) { + log.error("HighCouponController --> getUserCouponDetail() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + } diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java b/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java index 88963f32..8a2c67fc 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java @@ -106,7 +106,6 @@ public class HighOrderController { childOrder.setGoodsImg(coupon.getCouponImg()); childOrder.setGoodsSpecName("默认"); childOrder.setGoodsPrice(coupon.getDiscountPrice()); - childOrder.setTotalPrice(childOrder.getGoodsPrice().multiply(new BigDecimal(childOrder.getSaleCount().toString()))); } if (childOrder.getGoodsType() == 2) { @@ -124,15 +123,15 @@ public class HighOrderController { childOrder.setGoodsName(user.getName()); childOrder.setGoodsImg(user.getHeaderImg()); childOrder.setGoodsSpecName("默认"); - childOrder.setTotalPrice(childOrder.getGoodsPrice().multiply(new BigDecimal(childOrder.getSaleCount().toString()))); } + childOrder.setTotalPrice(childOrder.getGoodsPrice().multiply(new BigDecimal(childOrder.getSaleCount().toString()))); childOrder.setGiveawayType(false); // 是否是赠品 0:否 1:是 childOrder.setChildOrdeStatus(1); // 1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消 childOrder.setPraiseStatus(0); // 累计订单价格 - totalPrice.add(childOrder.getTotalPrice()); + totalPrice = totalPrice.add(childOrder.getTotalPrice()); } highOrder.setOrderNo("HF" + DateUtil.date2String(new Date(),"yyyyMMddHHmmss") + IDGenerator.nextId(5)); diff --git a/hai-service/src/main/java/com/hai/dao/HighUserCouponMapper.java b/hai-service/src/main/java/com/hai/dao/HighUserCouponMapper.java index 79e2f019..a813d021 100644 --- a/hai-service/src/main/java/com/hai/dao/HighUserCouponMapper.java +++ b/hai-service/src/main/java/com/hai/dao/HighUserCouponMapper.java @@ -41,14 +41,14 @@ public interface HighUserCouponMapper extends HighUserCouponMapperExt { @Insert({ "insert into high_user_coupon (merchant_id, coupon_id, ", "user_id, coupon_code_id, ", - "use_end_time, `status`, ", - "ext_1, ext_2, ext_3, ", - "ext_4)", + "create_time, use_end_time, ", + "`status`, ext_1, ext_2, ", + "ext_3, ext_4)", "values (#{merchantId,jdbcType=BIGINT}, #{couponId,jdbcType=BIGINT}, ", "#{userId,jdbcType=BIGINT}, #{couponCodeId,jdbcType=BIGINT}, ", - "#{useEndTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER}, ", - "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR}, ", - "#{ext4,jdbcType=VARCHAR})" + "#{createTime,jdbcType=TIMESTAMP}, #{useEndTime,jdbcType=TIMESTAMP}, ", + "#{status,jdbcType=INTEGER}, #{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, ", + "#{ext3,jdbcType=VARCHAR}, #{ext4,jdbcType=VARCHAR})" }) @Options(useGeneratedKeys=true,keyProperty="id") int insert(HighUserCoupon record); @@ -64,6 +64,7 @@ public interface HighUserCouponMapper extends HighUserCouponMapperExt { @Result(column="coupon_id", property="couponId", jdbcType=JdbcType.BIGINT), @Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT), @Result(column="coupon_code_id", property="couponCodeId", jdbcType=JdbcType.BIGINT), + @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="use_end_time", property="useEndTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="status", property="status", jdbcType=JdbcType.INTEGER), @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), @@ -75,8 +76,8 @@ public interface HighUserCouponMapper extends HighUserCouponMapperExt { @Select({ "select", - "id, merchant_id, coupon_id, user_id, coupon_code_id, use_end_time, `status`, ", - "ext_1, ext_2, ext_3, ext_4", + "id, merchant_id, coupon_id, user_id, coupon_code_id, create_time, use_end_time, ", + "`status`, ext_1, ext_2, ext_3, ext_4", "from high_user_coupon", "where id = #{id,jdbcType=BIGINT}" }) @@ -86,6 +87,7 @@ public interface HighUserCouponMapper extends HighUserCouponMapperExt { @Result(column="coupon_id", property="couponId", jdbcType=JdbcType.BIGINT), @Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT), @Result(column="coupon_code_id", property="couponCodeId", jdbcType=JdbcType.BIGINT), + @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="use_end_time", property="useEndTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="status", property="status", jdbcType=JdbcType.INTEGER), @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), @@ -110,6 +112,7 @@ public interface HighUserCouponMapper extends HighUserCouponMapperExt { "coupon_id = #{couponId,jdbcType=BIGINT},", "user_id = #{userId,jdbcType=BIGINT},", "coupon_code_id = #{couponCodeId,jdbcType=BIGINT},", + "create_time = #{createTime,jdbcType=TIMESTAMP},", "use_end_time = #{useEndTime,jdbcType=TIMESTAMP},", "`status` = #{status,jdbcType=INTEGER},", "ext_1 = #{ext1,jdbcType=VARCHAR},", diff --git a/hai-service/src/main/java/com/hai/dao/HighUserCouponSqlProvider.java b/hai-service/src/main/java/com/hai/dao/HighUserCouponSqlProvider.java index b57d511a..c5b027e1 100644 --- a/hai-service/src/main/java/com/hai/dao/HighUserCouponSqlProvider.java +++ b/hai-service/src/main/java/com/hai/dao/HighUserCouponSqlProvider.java @@ -44,6 +44,10 @@ public class HighUserCouponSqlProvider { sql.VALUES("coupon_code_id", "#{couponCodeId,jdbcType=BIGINT}"); } + if (record.getCreateTime() != null) { + sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}"); + } + if (record.getUseEndTime() != null) { sql.VALUES("use_end_time", "#{useEndTime,jdbcType=TIMESTAMP}"); } @@ -82,6 +86,7 @@ public class HighUserCouponSqlProvider { sql.SELECT("coupon_id"); sql.SELECT("user_id"); sql.SELECT("coupon_code_id"); + sql.SELECT("create_time"); sql.SELECT("use_end_time"); sql.SELECT("`status`"); sql.SELECT("ext_1"); @@ -125,6 +130,10 @@ public class HighUserCouponSqlProvider { sql.SET("coupon_code_id = #{record.couponCodeId,jdbcType=BIGINT}"); } + if (record.getCreateTime() != null) { + sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); + } + if (record.getUseEndTime() != null) { sql.SET("use_end_time = #{record.useEndTime,jdbcType=TIMESTAMP}"); } @@ -162,6 +171,7 @@ public class HighUserCouponSqlProvider { sql.SET("coupon_id = #{record.couponId,jdbcType=BIGINT}"); sql.SET("user_id = #{record.userId,jdbcType=BIGINT}"); sql.SET("coupon_code_id = #{record.couponCodeId,jdbcType=BIGINT}"); + sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); sql.SET("use_end_time = #{record.useEndTime,jdbcType=TIMESTAMP}"); sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}"); @@ -194,6 +204,10 @@ public class HighUserCouponSqlProvider { sql.SET("coupon_code_id = #{couponCodeId,jdbcType=BIGINT}"); } + if (record.getCreateTime() != null) { + sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}"); + } + if (record.getUseEndTime() != null) { sql.SET("use_end_time = #{useEndTime,jdbcType=TIMESTAMP}"); } diff --git a/hai-service/src/main/java/com/hai/entity/HighUserCoupon.java b/hai-service/src/main/java/com/hai/entity/HighUserCoupon.java index 8533b6ad..0ddca157 100644 --- a/hai-service/src/main/java/com/hai/entity/HighUserCoupon.java +++ b/hai-service/src/main/java/com/hai/entity/HighUserCoupon.java @@ -38,6 +38,11 @@ public class HighUserCoupon implements Serializable { */ private Long couponCodeId; + /** + * 创建时间 + */ + private Date createTime; + /** * 使用截止时间 */ @@ -98,6 +103,14 @@ public class HighUserCoupon implements Serializable { this.couponCodeId = couponCodeId; } + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + public Date getUseEndTime() { return useEndTime; } @@ -163,6 +176,7 @@ public class HighUserCoupon implements Serializable { && (this.getCouponId() == null ? other.getCouponId() == null : this.getCouponId().equals(other.getCouponId())) && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId())) && (this.getCouponCodeId() == null ? other.getCouponCodeId() == null : this.getCouponCodeId().equals(other.getCouponCodeId())) + && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) && (this.getUseEndTime() == null ? other.getUseEndTime() == null : this.getUseEndTime().equals(other.getUseEndTime())) && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus())) && (this.getExt1() == null ? other.getExt1() == null : this.getExt1().equals(other.getExt1())) @@ -180,6 +194,7 @@ public class HighUserCoupon implements Serializable { result = prime * result + ((getCouponId() == null) ? 0 : getCouponId().hashCode()); result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode()); result = prime * result + ((getCouponCodeId() == null) ? 0 : getCouponCodeId().hashCode()); + result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); result = prime * result + ((getUseEndTime() == null) ? 0 : getUseEndTime().hashCode()); result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode()); result = prime * result + ((getExt1() == null) ? 0 : getExt1().hashCode()); @@ -200,6 +215,7 @@ public class HighUserCoupon implements Serializable { sb.append(", couponId=").append(couponId); sb.append(", userId=").append(userId); sb.append(", couponCodeId=").append(couponCodeId); + sb.append(", createTime=").append(createTime); sb.append(", useEndTime=").append(useEndTime); sb.append(", status=").append(status); sb.append(", ext1=").append(ext1); diff --git a/hai-service/src/main/java/com/hai/entity/HighUserCouponExample.java b/hai-service/src/main/java/com/hai/entity/HighUserCouponExample.java index 4ea7d575..821bf507 100644 --- a/hai-service/src/main/java/com/hai/entity/HighUserCouponExample.java +++ b/hai-service/src/main/java/com/hai/entity/HighUserCouponExample.java @@ -425,6 +425,66 @@ public class HighUserCouponExample { return (Criteria) this; } + public Criteria andCreateTimeIsNull() { + addCriterion("create_time is null"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNotNull() { + addCriterion("create_time is not null"); + return (Criteria) this; + } + + public Criteria andCreateTimeEqualTo(Date value) { + addCriterion("create_time =", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotEqualTo(Date value) { + addCriterion("create_time <>", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThan(Date value) { + addCriterion("create_time >", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) { + addCriterion("create_time >=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThan(Date value) { + addCriterion("create_time <", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThanOrEqualTo(Date value) { + addCriterion("create_time <=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeIn(List values) { + addCriterion("create_time in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotIn(List values) { + addCriterion("create_time not in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeBetween(Date value1, Date value2) { + addCriterion("create_time between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotBetween(Date value1, Date value2) { + addCriterion("create_time not between", value1, value2, "createTime"); + return (Criteria) this; + } + public Criteria andUseEndTimeIsNull() { addCriterion("use_end_time is null"); return (Criteria) this; diff --git a/hai-service/src/main/java/com/hai/model/HighUserCouponModel.java b/hai-service/src/main/java/com/hai/model/HighUserCouponModel.java new file mode 100644 index 00000000..6a0c73bf --- /dev/null +++ b/hai-service/src/main/java/com/hai/model/HighUserCouponModel.java @@ -0,0 +1,21 @@ +package com.hai.model; + +import com.hai.entity.HighUserCoupon; + +/** + * @Auther: 胡锐 + * @Description: + * @Date: 2021/3/27 17:19 + */ +public class HighUserCouponModel extends HighUserCoupon { + + private HighCouponModel highCouponModel; + + public HighCouponModel getHighCouponModel() { + return highCouponModel; + } + + public void setHighCouponModel(HighCouponModel highCouponModel) { + this.highCouponModel = highCouponModel; + } +} diff --git a/hai-service/src/main/java/com/hai/service/HighCouponCodeService.java b/hai-service/src/main/java/com/hai/service/HighCouponCodeService.java index 54084960..c1214810 100644 --- a/hai-service/src/main/java/com/hai/service/HighCouponCodeService.java +++ b/hai-service/src/main/java/com/hai/service/HighCouponCodeService.java @@ -57,6 +57,13 @@ public interface HighCouponCodeService { **/ HighCouponCode getCouponCodeBySalesCode(String code); + /** + * @Author 胡锐 + * @Description 根据id 查询 + * @Date 2021/3/27 17:52 + **/ + HighCouponCode getCouponCodeById(Long id); + /** * * @Title: getStockCountByCoupon diff --git a/hai-service/src/main/java/com/hai/service/HighUserCouponService.java b/hai-service/src/main/java/com/hai/service/HighUserCouponService.java index c20ea039..6917116b 100644 --- a/hai-service/src/main/java/com/hai/service/HighUserCouponService.java +++ b/hai-service/src/main/java/com/hai/service/HighUserCouponService.java @@ -1,8 +1,10 @@ package com.hai.service; import com.hai.entity.HighUserCoupon; +import com.hai.model.HighUserCouponModel; import java.util.List; +import java.util.Map; /** * @Auther: 胡锐 @@ -32,4 +34,18 @@ public interface HighUserCouponService { **/ List getOverdueCoupon(); + /** + * @Author 胡锐 + * @Description 查询用户列表 + * @Date 2021/3/27 17:21 + **/ + List getUserCouponList(Map map); + + /** + * @Author 胡锐 + * @Description 根据用户id 和 卡卷id查询 + * @Date 2021/3/27 17:42 + **/ + HighUserCoupon getUserCoupon(Long userId, Long couponId); + } diff --git a/hai-service/src/main/java/com/hai/service/impl/HighCouponCodeServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighCouponCodeServiceImpl.java index 2cdeb6d9..f51d3a1e 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighCouponCodeServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighCouponCodeServiceImpl.java @@ -107,6 +107,11 @@ public class HighCouponCodeServiceImpl implements HighCouponCodeService { return null; } + @Override + public HighCouponCode getCouponCodeById(Long id) { + return highCouponCodeMapper.selectByPrimaryKey(id); + } + @Override public Integer getStockCountByCoupon(Long couponId) { HighCouponCodeExample example = new HighCouponCodeExample(); diff --git a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java index a3bdcbd1..bd681d30 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java @@ -22,10 +22,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.io.File; import java.math.BigDecimal; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; /** * @Auther: 胡锐 @@ -89,6 +86,7 @@ public class HighOrderServiceImpl implements HighOrderService { // 查看是否需要赠送卡卷 List handselListByCoupon = highCouponHandselService.getHandselListByCoupon(childOrder.getGoodsId()); if (handselListByCoupon != null && handselListByCoupon.size() > 0) { + List handselChildOrderList = new ArrayList<>(); for (HighCouponHandsel highCouponHandsel : handselListByCoupon) { // 查询卡卷信息 HighCouponModel coupon = highCouponService.getCouponById(highCouponHandsel.getId()); @@ -111,9 +109,10 @@ public class HighOrderServiceImpl implements HighOrderService { highChildOrder.setGiveawayType(true); // 是否是赠品 0:否 1:是 highChildOrder.setChildOrdeStatus(1); // 1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消 highChildOrder.setPraiseStatus(0); - highOrder.getHighChildOrderList().add(highChildOrder); + handselChildOrderList.add(highChildOrder); } } + highOrder.getHighChildOrderList().addAll(handselChildOrderList); } } } diff --git a/hai-service/src/main/java/com/hai/service/impl/HighUserCouponServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighUserCouponServiceImpl.java index 5da5eb9e..7acee4f8 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighUserCouponServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighUserCouponServiceImpl.java @@ -1,14 +1,19 @@ package com.hai.service.impl; +import com.alibaba.fastjson.JSON; import com.hai.dao.HighUserCouponMapper; import com.hai.entity.HighUserCoupon; import com.hai.entity.HighUserCouponExample; +import com.hai.model.HighUserCouponModel; import com.hai.service.HighUserCouponService; +import org.apache.commons.collections4.MapUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.ArrayList; import java.util.Date; import java.util.List; +import java.util.Map; /** * @Auther: 胡锐 @@ -37,4 +42,36 @@ public class HighUserCouponServiceImpl implements HighUserCouponService { example.createCriteria().andStatusEqualTo(1).andUseEndTimeGreaterThanOrEqualTo(new Date()); return highUserCouponMapper.selectByExample(example); } + + @Override + public List getUserCouponList(Map map) { + HighUserCouponExample example = new HighUserCouponExample(); + HighUserCouponExample.Criteria criteria = example.createCriteria(); + + if (MapUtils.getLong(map, "userId") != null) { + criteria.andUserIdEqualTo(MapUtils.getLong(map, "userId")); + } + + if (MapUtils.getInteger(map, "status") != null) { + criteria.andStatusEqualTo(MapUtils.getInteger(map, "status")); + } + + example.setOrderByClause("create_time desc"); + List highUserCoupons = highUserCouponMapper.selectByExample(example); + if (highUserCoupons != null && highUserCoupons.size() > 0) { + return JSON.parseArray(JSON.toJSONString(highUserCoupons), HighUserCouponModel.class); + } + return new ArrayList<>(); + } + + @Override + public HighUserCoupon getUserCoupon(Long userId, Long couponId) { + HighUserCouponExample example = new HighUserCouponExample(); + example.createCriteria().andUserIdEqualTo(userId).andCouponIdEqualTo(couponId); + List coupons = highUserCouponMapper.selectByExample(example); + if (coupons != null && coupons.size() > 0) { + return coupons.get(0); + } + return null; + } }