diff --git a/litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/web/AdminGoodsController.java b/litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/web/AdminGoodsController.java index d280de1e..48c9637e 100644 --- a/litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/web/AdminGoodsController.java +++ b/litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/web/AdminGoodsController.java @@ -90,6 +90,10 @@ public class AdminGoodsController { TransactionStatus status = txManager.getTransaction(def); try { + //将生成的分享图片地址写入数据库 + qCodeService.createGoodShareImage(goods.getId().toString(), goods.getPicUrl(), goods.getName()); + goods.setShareUrl(qCodeService.getShareImageUrl(goods.getId().toString())); + // 商品基本信息表litemall_goods goodsService.updateById(goods); @@ -180,6 +184,11 @@ public class AdminGoodsController { // 商品基本信息表litemall_goods goods.setAddTime(LocalDateTime.now()); + + //将生成的分享图片地址写入数据库 + qCodeService.createGoodShareImage(goods.getId().toString(), goods.getPicUrl(), goods.getName()); + goods.setShareUrl(qCodeService.getShareImageUrl(goods.getId().toString())); + goodsService.add(goods); // 商品规格表litemall_goods_specification @@ -210,9 +219,6 @@ public class AdminGoodsController { } txManager.commit(status); - - qCodeService.createGoodShareImage(goods.getId().toString(), goods.getPicUrl(), goods.getName()); - return ResponseUtil.ok(); } diff --git a/litemall-core/src/main/java/org/linlinjava/litemall/core/system/SystemConfig.java b/litemall-core/src/main/java/org/linlinjava/litemall/core/system/SystemConfig.java index 5ac42e94..0a94135f 100644 --- a/litemall-core/src/main/java/org/linlinjava/litemall/core/system/SystemConfig.java +++ b/litemall-core/src/main/java/org/linlinjava/litemall/core/system/SystemConfig.java @@ -61,7 +61,7 @@ public class SystemConfig extends BaseConfig { } public static boolean isAutoCreateShareImage() { - int autoCreate = getConfigInt("shareimage.autocreate"); + int autoCreate = getConfigInt(PRE_FIX + "shareimage.autocreate"); return autoCreate == 0 ? false : true; } diff --git a/litemall-db/src/main/java/org/linlinjava/litemall/db/domain/LitemallGoods.java b/litemall-db/src/main/java/org/linlinjava/litemall/db/domain/LitemallGoods.java index ee16f76f..2bf44baa 100644 --- a/litemall-db/src/main/java/org/linlinjava/litemall/db/domain/LitemallGoods.java +++ b/litemall-db/src/main/java/org/linlinjava/litemall/db/domain/LitemallGoods.java @@ -123,6 +123,15 @@ public class LitemallGoods { */ private String picUrl; + /** + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column litemall_goods.share_url + * + * @mbg.generated + */ + private String shareUrl; + /** * * This field was generated by MyBatis Generator. @@ -468,6 +477,30 @@ public class LitemallGoods { this.picUrl = picUrl; } + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column litemall_goods.share_url + * + * @return the value of litemall_goods.share_url + * + * @mbg.generated + */ + public String getShareUrl() { + return shareUrl; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column litemall_goods.share_url + * + * @param shareUrl the value for litemall_goods.share_url + * + * @mbg.generated + */ + public void setShareUrl(String shareUrl) { + this.shareUrl = shareUrl; + } + /** * This method was generated by MyBatis Generator. * This method returns the value of the database column litemall_goods.is_new @@ -707,6 +740,7 @@ public class LitemallGoods { sb.append(", isOnSale=").append(isOnSale); sb.append(", sortOrder=").append(sortOrder); sb.append(", picUrl=").append(picUrl); + sb.append(", shareUrl=").append(shareUrl); sb.append(", isNew=").append(isNew); sb.append(", isHot=").append(isHot); sb.append(", unit=").append(unit); @@ -749,6 +783,7 @@ public class LitemallGoods { && (this.getIsOnSale() == null ? other.getIsOnSale() == null : this.getIsOnSale().equals(other.getIsOnSale())) && (this.getSortOrder() == null ? other.getSortOrder() == null : this.getSortOrder().equals(other.getSortOrder())) && (this.getPicUrl() == null ? other.getPicUrl() == null : this.getPicUrl().equals(other.getPicUrl())) + && (this.getShareUrl() == null ? other.getShareUrl() == null : this.getShareUrl().equals(other.getShareUrl())) && (this.getIsNew() == null ? other.getIsNew() == null : this.getIsNew().equals(other.getIsNew())) && (this.getIsHot() == null ? other.getIsHot() == null : this.getIsHot().equals(other.getIsHot())) && (this.getUnit() == null ? other.getUnit() == null : this.getUnit().equals(other.getUnit())) @@ -781,6 +816,7 @@ public class LitemallGoods { result = prime * result + ((getIsOnSale() == null) ? 0 : getIsOnSale().hashCode()); result = prime * result + ((getSortOrder() == null) ? 0 : getSortOrder().hashCode()); result = prime * result + ((getPicUrl() == null) ? 0 : getPicUrl().hashCode()); + result = prime * result + ((getShareUrl() == null) ? 0 : getShareUrl().hashCode()); result = prime * result + ((getIsNew() == null) ? 0 : getIsNew().hashCode()); result = prime * result + ((getIsHot() == null) ? 0 : getIsHot().hashCode()); result = prime * result + ((getUnit() == null) ? 0 : getUnit().hashCode()); @@ -823,6 +859,7 @@ public class LitemallGoods { isOnSale("is_on_sale", "isOnSale", "BIT"), sortOrder("sort_order", "sortOrder", "SMALLINT"), picUrl("pic_url", "picUrl", "VARCHAR"), + shareUrl("share_url", "shareUrl", "VARCHAR"), isNew("is_new", "isNew", "BIT"), isHot("is_hot", "isHot", "BIT"), unit("unit", "unit", "VARCHAR"), diff --git a/litemall-db/src/main/java/org/linlinjava/litemall/db/domain/LitemallGoodsExample.java b/litemall-db/src/main/java/org/linlinjava/litemall/db/domain/LitemallGoodsExample.java index c852ff9c..47ebc062 100644 --- a/litemall-db/src/main/java/org/linlinjava/litemall/db/domain/LitemallGoodsExample.java +++ b/litemall-db/src/main/java/org/linlinjava/litemall/db/domain/LitemallGoodsExample.java @@ -981,6 +981,76 @@ public class LitemallGoodsExample { return (Criteria) this; } + public Criteria andShareUrlIsNull() { + addCriterion("share_url is null"); + return (Criteria) this; + } + + public Criteria andShareUrlIsNotNull() { + addCriterion("share_url is not null"); + return (Criteria) this; + } + + public Criteria andShareUrlEqualTo(String value) { + addCriterion("share_url =", value, "shareUrl"); + return (Criteria) this; + } + + public Criteria andShareUrlNotEqualTo(String value) { + addCriterion("share_url <>", value, "shareUrl"); + return (Criteria) this; + } + + public Criteria andShareUrlGreaterThan(String value) { + addCriterion("share_url >", value, "shareUrl"); + return (Criteria) this; + } + + public Criteria andShareUrlGreaterThanOrEqualTo(String value) { + addCriterion("share_url >=", value, "shareUrl"); + return (Criteria) this; + } + + public Criteria andShareUrlLessThan(String value) { + addCriterion("share_url <", value, "shareUrl"); + return (Criteria) this; + } + + public Criteria andShareUrlLessThanOrEqualTo(String value) { + addCriterion("share_url <=", value, "shareUrl"); + return (Criteria) this; + } + + public Criteria andShareUrlLike(String value) { + addCriterion("share_url like", value, "shareUrl"); + return (Criteria) this; + } + + public Criteria andShareUrlNotLike(String value) { + addCriterion("share_url not like", value, "shareUrl"); + return (Criteria) this; + } + + public Criteria andShareUrlIn(List values) { + addCriterion("share_url in", values, "shareUrl"); + return (Criteria) this; + } + + public Criteria andShareUrlNotIn(List values) { + addCriterion("share_url not in", values, "shareUrl"); + return (Criteria) this; + } + + public Criteria andShareUrlBetween(String value1, String value2) { + addCriterion("share_url between", value1, value2, "shareUrl"); + return (Criteria) this; + } + + public Criteria andShareUrlNotBetween(String value1, String value2) { + addCriterion("share_url not between", value1, value2, "shareUrl"); + return (Criteria) this; + } + public Criteria andIsNewIsNull() { addCriterion("is_new is null"); return (Criteria) this; diff --git a/litemall-db/src/main/resources/org/linlinjava/litemall/db/dao/LitemallGoodsMapper.xml b/litemall-db/src/main/resources/org/linlinjava/litemall/db/dao/LitemallGoodsMapper.xml index 93e6fdc4..d602e5d8 100644 --- a/litemall-db/src/main/resources/org/linlinjava/litemall/db/dao/LitemallGoodsMapper.xml +++ b/litemall-db/src/main/resources/org/linlinjava/litemall/db/dao/LitemallGoodsMapper.xml @@ -17,6 +17,7 @@ + @@ -143,8 +144,8 @@ This element is automatically generated by MyBatis Generator, do not modify. --> id, goods_sn, `name`, category_id, brand_id, gallery, keywords, brief, is_on_sale, - sort_order, pic_url, is_new, is_hot, unit, counter_price, retail_price, add_time, - deleted, version + sort_order, pic_url, share_url, is_new, is_hot, unit, counter_price, retail_price, + add_time, deleted, version