From 84f9418d4c8cc763bc0a31ae1b431c8ac76d8390 Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Mon, 29 Mar 2021 23:28:35 +0800 Subject: [PATCH] 1 --- .../cweb/controller/HighCouponController.java | 10 ++-- .../com/cweb/controller/WechatController.java | 1 - .../src/main/resources/dev/application.yml | 2 +- .../java/com/hai/dao/HighCouponMapper.java | 17 ++++-- .../com/hai/dao/HighCouponSqlProvider.java | 14 +++++ .../main/java/com/hai/entity/HighCoupon.java | 18 +++++- .../com/hai/entity/HighCouponExample.java | 60 +++++++++++++++++++ .../impl/HighCouponHandselServiceImpl.java | 2 +- 8 files changed, 110 insertions(+), 14 deletions(-) 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 d6de41ce..6e4c66c0 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighCouponController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighCouponController.java @@ -113,18 +113,20 @@ public class HighCouponController { try { // 用户 - SessionObject sessionObject = userCenter.getSessionObject(request); - HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject(); +// SessionObject sessionObject = userCenter.getSessionObject(request); +// HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject(); Map map = new HashMap<>(); - map.put("userId", userInfoModel.getHighUser().getId()); +// map.put("userId", userInfoModel.getHighUser().getId()); + map.put("userId", 24); + map.put("status", status); PageHelper.startPage(pageNum, pageSize); List list = highUserCouponService.getUserCouponList(map); for (HighUserCouponModel highUserCouponModel : list) { highUserCouponModel.setHighCouponModel(highCouponService.getCouponById(highUserCouponModel.getCouponId())); } - return ResponseMsgUtil.success(new PageInfo<>()); + return ResponseMsgUtil.success(new PageInfo<>(list)); } catch (Exception e) { log.error("HighCouponController --> getUserCouponList() error!", e); diff --git a/hai-cweb/src/main/java/com/cweb/controller/WechatController.java b/hai-cweb/src/main/java/com/cweb/controller/WechatController.java index de09c6c3..e402d69c 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/WechatController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/WechatController.java @@ -210,7 +210,6 @@ public class WechatController { SessionObject so = new SessionObject(openId, 1 , highUserModel); userCenter.save(request, response, so); - return ResponseMsgUtil.success(so); } catch (Exception e) { diff --git a/hai-cweb/src/main/resources/dev/application.yml b/hai-cweb/src/main/resources/dev/application.yml index 78260bf2..9fd95874 100644 --- a/hai-cweb/src/main/resources/dev/application.yml +++ b/hai-cweb/src/main/resources/dev/application.yml @@ -1,5 +1,5 @@ server: - port: 9301 + port: servlet: context-path: /crest diff --git a/hai-service/src/main/java/com/hai/dao/HighCouponMapper.java b/hai-service/src/main/java/com/hai/dao/HighCouponMapper.java index 68941832..a033a7a0 100644 --- a/hai-service/src/main/java/com/hai/dao/HighCouponMapper.java +++ b/hai-service/src/main/java/com/hai/dao/HighCouponMapper.java @@ -50,7 +50,8 @@ public interface HighCouponMapper extends HighCouponMapperExt { "create_time, update_time, ", "operator_id, operator_name, ", "pay_type, ext_1, ext_2, ", - "ext_3, `status`, display_area)", + "ext_3, `status`, display_area, ", + "coupon_source)", "values (#{companyId,jdbcType=BIGINT}, #{merchantId,jdbcType=BIGINT}, ", "#{couponKey,jdbcType=VARCHAR}, #{couponName,jdbcType=VARCHAR}, ", "#{couponPrice,jdbcType=DECIMAL}, #{couponImg,jdbcType=VARCHAR}, ", @@ -62,7 +63,8 @@ public interface HighCouponMapper extends HighCouponMapperExt { "#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ", "#{operatorId,jdbcType=BIGINT}, #{operatorName,jdbcType=VARCHAR}, ", "#{payType,jdbcType=INTEGER}, #{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, ", - "#{ext3,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{displayArea,jdbcType=INTEGER})" + "#{ext3,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{displayArea,jdbcType=INTEGER}, ", + "#{couponSource,jdbcType=INTEGER})" }) @Options(useGeneratedKeys=true,keyProperty="id") int insert(HighCoupon record); @@ -99,7 +101,8 @@ public interface HighCouponMapper extends HighCouponMapperExt { @Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), @Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR), @Result(column="status", property="status", jdbcType=JdbcType.INTEGER), - @Result(column="display_area", property="displayArea", jdbcType=JdbcType.INTEGER) + @Result(column="display_area", property="displayArea", jdbcType=JdbcType.INTEGER), + @Result(column="coupon_source", property="couponSource", jdbcType=JdbcType.INTEGER) }) List selectByExample(HighCouponExample example); @@ -109,7 +112,7 @@ public interface HighCouponMapper extends HighCouponMapperExt { "coupon_carousel_img, coupon_desc, coupon_type, sales_end_time, recycle_day, ", "limit_number, sales_price, discount_price, sales_count, is_present, create_time, ", "update_time, operator_id, operator_name, pay_type, ext_1, ext_2, ext_3, `status`, ", - "display_area", + "display_area, coupon_source", "from high_coupon", "where id = #{id,jdbcType=BIGINT}" }) @@ -140,7 +143,8 @@ public interface HighCouponMapper extends HighCouponMapperExt { @Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), @Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR), @Result(column="status", property="status", jdbcType=JdbcType.INTEGER), - @Result(column="display_area", property="displayArea", jdbcType=JdbcType.INTEGER) + @Result(column="display_area", property="displayArea", jdbcType=JdbcType.INTEGER), + @Result(column="coupon_source", property="couponSource", jdbcType=JdbcType.INTEGER) }) HighCoupon selectByPrimaryKey(Long id); @@ -180,7 +184,8 @@ public interface HighCouponMapper extends HighCouponMapperExt { "ext_2 = #{ext2,jdbcType=VARCHAR},", "ext_3 = #{ext3,jdbcType=VARCHAR},", "`status` = #{status,jdbcType=INTEGER},", - "display_area = #{displayArea,jdbcType=INTEGER}", + "display_area = #{displayArea,jdbcType=INTEGER},", + "coupon_source = #{couponSource,jdbcType=INTEGER}", "where id = #{id,jdbcType=BIGINT}" }) int updateByPrimaryKey(HighCoupon record); diff --git a/hai-service/src/main/java/com/hai/dao/HighCouponSqlProvider.java b/hai-service/src/main/java/com/hai/dao/HighCouponSqlProvider.java index c6aaeb6f..7b11386b 100644 --- a/hai-service/src/main/java/com/hai/dao/HighCouponSqlProvider.java +++ b/hai-service/src/main/java/com/hai/dao/HighCouponSqlProvider.java @@ -132,6 +132,10 @@ public class HighCouponSqlProvider { sql.VALUES("display_area", "#{displayArea,jdbcType=INTEGER}"); } + if (record.getCouponSource() != null) { + sql.VALUES("coupon_source", "#{couponSource,jdbcType=INTEGER}"); + } + return sql.toString(); } @@ -168,6 +172,7 @@ public class HighCouponSqlProvider { sql.SELECT("ext_3"); sql.SELECT("`status`"); sql.SELECT("display_area"); + sql.SELECT("coupon_source"); sql.FROM("high_coupon"); applyWhere(sql, example, false); @@ -293,6 +298,10 @@ public class HighCouponSqlProvider { sql.SET("display_area = #{record.displayArea,jdbcType=INTEGER}"); } + if (record.getCouponSource() != null) { + sql.SET("coupon_source = #{record.couponSource,jdbcType=INTEGER}"); + } + applyWhere(sql, example, true); return sql.toString(); } @@ -328,6 +337,7 @@ public class HighCouponSqlProvider { sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}"); sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); sql.SET("display_area = #{record.displayArea,jdbcType=INTEGER}"); + sql.SET("coupon_source = #{record.couponSource,jdbcType=INTEGER}"); HighCouponExample example = (HighCouponExample) parameter.get("example"); applyWhere(sql, example, true); @@ -442,6 +452,10 @@ public class HighCouponSqlProvider { sql.SET("display_area = #{displayArea,jdbcType=INTEGER}"); } + if (record.getCouponSource() != null) { + sql.SET("coupon_source = #{couponSource,jdbcType=INTEGER}"); + } + sql.WHERE("id = #{id,jdbcType=BIGINT}"); return sql.toString(); diff --git a/hai-service/src/main/java/com/hai/entity/HighCoupon.java b/hai-service/src/main/java/com/hai/entity/HighCoupon.java index e14a7252..e357c6fc 100644 --- a/hai-service/src/main/java/com/hai/entity/HighCoupon.java +++ b/hai-service/src/main/java/com/hai/entity/HighCoupon.java @@ -140,6 +140,11 @@ public class HighCoupon implements Serializable { */ private Integer displayArea; + /** + * 卡券来源:1.中石化 + */ + private Integer couponSource; + private static final long serialVersionUID = 1L; public Long getId() { @@ -358,6 +363,14 @@ public class HighCoupon implements Serializable { this.displayArea = displayArea; } + public Integer getCouponSource() { + return couponSource; + } + + public void setCouponSource(Integer couponSource) { + this.couponSource = couponSource; + } + @Override public boolean equals(Object that) { if (this == that) { @@ -396,7 +409,8 @@ public class HighCoupon implements Serializable { && (this.getExt2() == null ? other.getExt2() == null : this.getExt2().equals(other.getExt2())) && (this.getExt3() == null ? other.getExt3() == null : this.getExt3().equals(other.getExt3())) && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus())) - && (this.getDisplayArea() == null ? other.getDisplayArea() == null : this.getDisplayArea().equals(other.getDisplayArea())); + && (this.getDisplayArea() == null ? other.getDisplayArea() == null : this.getDisplayArea().equals(other.getDisplayArea())) + && (this.getCouponSource() == null ? other.getCouponSource() == null : this.getCouponSource().equals(other.getCouponSource())); } @Override @@ -430,6 +444,7 @@ public class HighCoupon implements Serializable { result = prime * result + ((getExt3() == null) ? 0 : getExt3().hashCode()); result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode()); result = prime * result + ((getDisplayArea() == null) ? 0 : getDisplayArea().hashCode()); + result = prime * result + ((getCouponSource() == null) ? 0 : getCouponSource().hashCode()); return result; } @@ -466,6 +481,7 @@ public class HighCoupon implements Serializable { sb.append(", ext3=").append(ext3); sb.append(", status=").append(status); sb.append(", displayArea=").append(displayArea); + sb.append(", couponSource=").append(couponSource); sb.append(", serialVersionUID=").append(serialVersionUID); sb.append("]"); return sb.toString(); diff --git a/hai-service/src/main/java/com/hai/entity/HighCouponExample.java b/hai-service/src/main/java/com/hai/entity/HighCouponExample.java index d8f7805b..51d3076a 100644 --- a/hai-service/src/main/java/com/hai/entity/HighCouponExample.java +++ b/hai-service/src/main/java/com/hai/entity/HighCouponExample.java @@ -1835,6 +1835,66 @@ public class HighCouponExample { addCriterion("display_area not between", value1, value2, "displayArea"); return (Criteria) this; } + + public Criteria andCouponSourceIsNull() { + addCriterion("coupon_source is null"); + return (Criteria) this; + } + + public Criteria andCouponSourceIsNotNull() { + addCriterion("coupon_source is not null"); + return (Criteria) this; + } + + public Criteria andCouponSourceEqualTo(Integer value) { + addCriterion("coupon_source =", value, "couponSource"); + return (Criteria) this; + } + + public Criteria andCouponSourceNotEqualTo(Integer value) { + addCriterion("coupon_source <>", value, "couponSource"); + return (Criteria) this; + } + + public Criteria andCouponSourceGreaterThan(Integer value) { + addCriterion("coupon_source >", value, "couponSource"); + return (Criteria) this; + } + + public Criteria andCouponSourceGreaterThanOrEqualTo(Integer value) { + addCriterion("coupon_source >=", value, "couponSource"); + return (Criteria) this; + } + + public Criteria andCouponSourceLessThan(Integer value) { + addCriterion("coupon_source <", value, "couponSource"); + return (Criteria) this; + } + + public Criteria andCouponSourceLessThanOrEqualTo(Integer value) { + addCriterion("coupon_source <=", value, "couponSource"); + return (Criteria) this; + } + + public Criteria andCouponSourceIn(List values) { + addCriterion("coupon_source in", values, "couponSource"); + return (Criteria) this; + } + + public Criteria andCouponSourceNotIn(List values) { + addCriterion("coupon_source not in", values, "couponSource"); + return (Criteria) this; + } + + public Criteria andCouponSourceBetween(Integer value1, Integer value2) { + addCriterion("coupon_source between", value1, value2, "couponSource"); + return (Criteria) this; + } + + public Criteria andCouponSourceNotBetween(Integer value1, Integer value2) { + addCriterion("coupon_source not between", value1, value2, "couponSource"); + return (Criteria) this; + } } /** diff --git a/hai-service/src/main/java/com/hai/service/impl/HighCouponHandselServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighCouponHandselServiceImpl.java index 0dfa582e..a5cca226 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighCouponHandselServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighCouponHandselServiceImpl.java @@ -63,7 +63,7 @@ public class HighCouponHandselServiceImpl implements HighCouponHandselService { for (HighCouponHandsel handsel : list) { model = new HighCouponHandselModel(); BeanUtils.copyProperties(handsel, model); - model.setHighCouponModel(highCouponService.getCouponDetail(handsel.getId())); + model.setHighCouponModel(highCouponService.getCouponDetail(handsel.getHandselCouponId())); modelList.add(model); } return modelList;