From 39135af382d54e5af8fef7df2ae2dc395c82a177 Mon Sep 17 00:00:00 2001 From: Menethil Date: Sun, 5 Aug 2018 19:19:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=9B=A2=E8=B4=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../litemall/core/qcode/QCodeService.java | 4 +- .../litemall/db/domain/LitemallGroupon.java | 28 ++-- .../db/domain/LitemallGrouponExample.java | 48 +++--- .../db/service/LitemallGrouponService.java | 12 ++ .../litemall/db/dao/LitemallGrouponMapper.xml | 42 ++--- .../litemall/wx/web/WxGrouponController.java | 147 ++++++++---------- .../litemall/wx/web/WxOrderController.java | 5 +- 7 files changed, 145 insertions(+), 141 deletions(-) diff --git a/litemall-core/src/main/java/org/linlinjava/litemall/core/qcode/QCodeService.java b/litemall-core/src/main/java/org/linlinjava/litemall/core/qcode/QCodeService.java index 818e3b88..b87b1c47 100644 --- a/litemall-core/src/main/java/org/linlinjava/litemall/core/qcode/QCodeService.java +++ b/litemall-core/src/main/java/org/linlinjava/litemall/core/qcode/QCodeService.java @@ -31,9 +31,9 @@ public class QCodeService { FileInputStream inputStream = new FileInputStream(file); //将商品图片,商品名字,商城名字画到模版图中 byte[] imageData = drawPicture(inputStream, goodPicUrl, goodName, SystemConfig.getMallName()); - MultipartFile multipartFile = new MockMultipartFile(file.getName(), file.getName(), "image/jpeg", imageData); + ByteArrayInputStream inputStream2 = new ByteArrayInputStream(imageData); //存储分享图 - storageService.store(multipartFile, getKeyName(groupon.getId().toString())); + storageService.store(inputStream2, imageData.length, "image/jpeg", getKeyName(groupon.getId().toString())); } catch (WxErrorException e) { e.printStackTrace(); } catch (FileNotFoundException e) { diff --git a/litemall-db/src/main/java/org/linlinjava/litemall/db/domain/LitemallGroupon.java b/litemall-db/src/main/java/org/linlinjava/litemall/db/domain/LitemallGroupon.java index 8aea8d56..1cba589b 100644 --- a/litemall-db/src/main/java/org/linlinjava/litemall/db/domain/LitemallGroupon.java +++ b/litemall-db/src/main/java/org/linlinjava/litemall/db/domain/LitemallGroupon.java @@ -71,11 +71,11 @@ public class LitemallGroupon { /** * * This field was generated by MyBatis Generator. - * This field corresponds to the database column litemall_groupon.user_type + * This field corresponds to the database column litemall_groupon.creator_user_id * * @mbg.generated */ - private Boolean userType; + private Integer creatorUserId; /** * @@ -253,26 +253,26 @@ public class LitemallGroupon { /** * This method was generated by MyBatis Generator. - * This method returns the value of the database column litemall_groupon.user_type + * This method returns the value of the database column litemall_groupon.creator_user_id * - * @return the value of litemall_groupon.user_type + * @return the value of litemall_groupon.creator_user_id * * @mbg.generated */ - public Boolean getUserType() { - return userType; + public Integer getCreatorUserId() { + return creatorUserId; } /** * This method was generated by MyBatis Generator. - * This method sets the value of the database column litemall_groupon.user_type + * This method sets the value of the database column litemall_groupon.creator_user_id * - * @param userType the value for litemall_groupon.user_type + * @param creatorUserId the value for litemall_groupon.creator_user_id * * @mbg.generated */ - public void setUserType(Boolean userType) { - this.userType = userType; + public void setCreatorUserId(Integer creatorUserId) { + this.creatorUserId = creatorUserId; } /** @@ -436,7 +436,7 @@ public class LitemallGroupon { sb.append(", grouponId=").append(grouponId); sb.append(", rulesId=").append(rulesId); sb.append(", userId=").append(userId); - sb.append(", userType=").append(userType); + sb.append(", creatorUserId=").append(creatorUserId); sb.append(", addTime=").append(addTime); sb.append(", expireTime=").append(expireTime); sb.append(", shareUrl=").append(shareUrl); @@ -470,7 +470,7 @@ public class LitemallGroupon { && (this.getGrouponId() == null ? other.getGrouponId() == null : this.getGrouponId().equals(other.getGrouponId())) && (this.getRulesId() == null ? other.getRulesId() == null : this.getRulesId().equals(other.getRulesId())) && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId())) - && (this.getUserType() == null ? other.getUserType() == null : this.getUserType().equals(other.getUserType())) + && (this.getCreatorUserId() == null ? other.getCreatorUserId() == null : this.getCreatorUserId().equals(other.getCreatorUserId())) && (this.getAddTime() == null ? other.getAddTime() == null : this.getAddTime().equals(other.getAddTime())) && (this.getExpireTime() == null ? other.getExpireTime() == null : this.getExpireTime().equals(other.getExpireTime())) && (this.getShareUrl() == null ? other.getShareUrl() == null : this.getShareUrl().equals(other.getShareUrl())) @@ -494,7 +494,7 @@ public class LitemallGroupon { result = prime * result + ((getGrouponId() == null) ? 0 : getGrouponId().hashCode()); result = prime * result + ((getRulesId() == null) ? 0 : getRulesId().hashCode()); result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode()); - result = prime * result + ((getUserType() == null) ? 0 : getUserType().hashCode()); + result = prime * result + ((getCreatorUserId() == null) ? 0 : getCreatorUserId().hashCode()); result = prime * result + ((getAddTime() == null) ? 0 : getAddTime().hashCode()); result = prime * result + ((getExpireTime() == null) ? 0 : getExpireTime().hashCode()); result = prime * result + ((getShareUrl() == null) ? 0 : getShareUrl().hashCode()); @@ -528,7 +528,7 @@ public class LitemallGroupon { grouponId("groupon_id", "grouponId", "INTEGER"), rulesId("rules_id", "rulesId", "INTEGER"), userId("user_id", "userId", "INTEGER"), - userType("user_type", "userType", "BIT"), + creatorUserId("creator_user_id", "creatorUserId", "INTEGER"), addTime("add_time", "addTime", "TIMESTAMP"), expireTime("expire_time", "expireTime", "TIMESTAMP"), shareUrl("share_url", "shareUrl", "VARCHAR"), diff --git a/litemall-db/src/main/java/org/linlinjava/litemall/db/domain/LitemallGrouponExample.java b/litemall-db/src/main/java/org/linlinjava/litemall/db/domain/LitemallGrouponExample.java index 03810591..922c620d 100644 --- a/litemall-db/src/main/java/org/linlinjava/litemall/db/domain/LitemallGrouponExample.java +++ b/litemall-db/src/main/java/org/linlinjava/litemall/db/domain/LitemallGrouponExample.java @@ -526,63 +526,63 @@ public class LitemallGrouponExample { return (Criteria) this; } - public Criteria andUserTypeIsNull() { - addCriterion("user_type is null"); + public Criteria andCreatorUserIdIsNull() { + addCriterion("creator_user_id is null"); return (Criteria) this; } - public Criteria andUserTypeIsNotNull() { - addCriterion("user_type is not null"); + public Criteria andCreatorUserIdIsNotNull() { + addCriterion("creator_user_id is not null"); return (Criteria) this; } - public Criteria andUserTypeEqualTo(Boolean value) { - addCriterion("user_type =", value, "userType"); + public Criteria andCreatorUserIdEqualTo(Integer value) { + addCriterion("creator_user_id =", value, "creatorUserId"); return (Criteria) this; } - public Criteria andUserTypeNotEqualTo(Boolean value) { - addCriterion("user_type <>", value, "userType"); + public Criteria andCreatorUserIdNotEqualTo(Integer value) { + addCriterion("creator_user_id <>", value, "creatorUserId"); return (Criteria) this; } - public Criteria andUserTypeGreaterThan(Boolean value) { - addCriterion("user_type >", value, "userType"); + public Criteria andCreatorUserIdGreaterThan(Integer value) { + addCriterion("creator_user_id >", value, "creatorUserId"); return (Criteria) this; } - public Criteria andUserTypeGreaterThanOrEqualTo(Boolean value) { - addCriterion("user_type >=", value, "userType"); + public Criteria andCreatorUserIdGreaterThanOrEqualTo(Integer value) { + addCriterion("creator_user_id >=", value, "creatorUserId"); return (Criteria) this; } - public Criteria andUserTypeLessThan(Boolean value) { - addCriterion("user_type <", value, "userType"); + public Criteria andCreatorUserIdLessThan(Integer value) { + addCriterion("creator_user_id <", value, "creatorUserId"); return (Criteria) this; } - public Criteria andUserTypeLessThanOrEqualTo(Boolean value) { - addCriterion("user_type <=", value, "userType"); + public Criteria andCreatorUserIdLessThanOrEqualTo(Integer value) { + addCriterion("creator_user_id <=", value, "creatorUserId"); return (Criteria) this; } - public Criteria andUserTypeIn(List values) { - addCriterion("user_type in", values, "userType"); + public Criteria andCreatorUserIdIn(List values) { + addCriterion("creator_user_id in", values, "creatorUserId"); return (Criteria) this; } - public Criteria andUserTypeNotIn(List values) { - addCriterion("user_type not in", values, "userType"); + public Criteria andCreatorUserIdNotIn(List values) { + addCriterion("creator_user_id not in", values, "creatorUserId"); return (Criteria) this; } - public Criteria andUserTypeBetween(Boolean value1, Boolean value2) { - addCriterion("user_type between", value1, value2, "userType"); + public Criteria andCreatorUserIdBetween(Integer value1, Integer value2) { + addCriterion("creator_user_id between", value1, value2, "creatorUserId"); return (Criteria) this; } - public Criteria andUserTypeNotBetween(Boolean value1, Boolean value2) { - addCriterion("user_type not between", value1, value2, "userType"); + public Criteria andCreatorUserIdNotBetween(Integer value1, Integer value2) { + addCriterion("creator_user_id not between", value1, value2, "creatorUserId"); return (Criteria) this; } diff --git a/litemall-db/src/main/java/org/linlinjava/litemall/db/service/LitemallGrouponService.java b/litemall-db/src/main/java/org/linlinjava/litemall/db/service/LitemallGrouponService.java index 75bd32a7..4f0d7257 100644 --- a/litemall-db/src/main/java/org/linlinjava/litemall/db/service/LitemallGrouponService.java +++ b/litemall-db/src/main/java/org/linlinjava/litemall/db/service/LitemallGrouponService.java @@ -25,6 +25,18 @@ public class LitemallGrouponService { return mapper.selectByExample(example); } + public List queryMyGroupon(Integer userId) { + LitemallGrouponExample example = new LitemallGrouponExample(); + example.or().andUserIdEqualTo(userId).andCreatorUserIdEqualTo(userId).andGrouponIdEqualTo(0).andDeletedEqualTo(false); + return mapper.selectByExample(example); + } + + public List queryMyJoinGroupon(Integer userId) { + LitemallGrouponExample example = new LitemallGrouponExample(); + example.or().andUserIdEqualTo(userId).andGrouponIdNotEqualTo(0).andDeletedEqualTo(false); + return mapper.selectByExample(example); + } + public LitemallGroupon queryByOrderId(Integer orderId) { LitemallGrouponExample example = new LitemallGrouponExample(); example.or().andOrderIdEqualTo(orderId).andDeletedEqualTo(false); diff --git a/litemall-db/src/main/resources/org/linlinjava/litemall/db/dao/LitemallGrouponMapper.xml b/litemall-db/src/main/resources/org/linlinjava/litemall/db/dao/LitemallGrouponMapper.xml index b6672582..c9ce4d04 100644 --- a/litemall-db/src/main/resources/org/linlinjava/litemall/db/dao/LitemallGrouponMapper.xml +++ b/litemall-db/src/main/resources/org/linlinjava/litemall/db/dao/LitemallGrouponMapper.xml @@ -11,7 +11,7 @@ - + @@ -90,8 +90,8 @@ WARNING - @mbg.generated This element is automatically generated by MyBatis Generator, do not modify. --> - id, order_id, groupon_id, rules_id, user_id, user_type, add_time, expire_time, share_url, - payed, deleted, version + id, order_id, groupon_id, rules_id, user_id, creator_user_id, add_time, expire_time, + share_url, payed, deleted, version