From efbc40eaa037a1834ab5aa03bb2c0ba8cf3ad14b Mon Sep 17 00:00:00 2001 From: gongbiao Date: Fri, 17 Aug 2018 15:13:47 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=95=86=E9=93=BA=E5=95=86=E6=88=B7][?= =?UTF-8?q?=E4=BF=AE=E6=94=B9]:=E5=95=86=E6=88=B7=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E6=97=B6=E8=BF=94=E5=9B=9E=E6=95=B0=E6=8D=AE=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/simple/domain/po/WxMerchant.java | 13 ++++++++++++- .../service/impl/WxMerchantServiceImpl.java | 16 +++++++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/mallinkService/src/main/java/com/simple/domain/po/WxMerchant.java b/mallinkService/src/main/java/com/simple/domain/po/WxMerchant.java index e7fe5b37d..3e646af1c 100644 --- a/mallinkService/src/main/java/com/simple/domain/po/WxMerchant.java +++ b/mallinkService/src/main/java/com/simple/domain/po/WxMerchant.java @@ -42,7 +42,10 @@ public class WxMerchant implements Serializable { private String userids; @Transient private String shopids; - + + @Transient + private List shops; + /*租户ID**/ @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") private String tenantId; @@ -171,6 +174,14 @@ public class WxMerchant implements Serializable { this.shopids = shopids; } + public List getShops() { + return shops; + } + + public void setShops(List shops) { + this.shops = shops; + } + public static enum Field { Id_ASC("`id` ASC"),Id_DESC("`id` DESC") diff --git a/mallinkService/src/main/java/com/simple/service/impl/WxMerchantServiceImpl.java b/mallinkService/src/main/java/com/simple/service/impl/WxMerchantServiceImpl.java index be8cc5d64..ffed1a1db 100644 --- a/mallinkService/src/main/java/com/simple/service/impl/WxMerchantServiceImpl.java +++ b/mallinkService/src/main/java/com/simple/service/impl/WxMerchantServiceImpl.java @@ -17,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -42,7 +43,20 @@ public class WxMerchantServiceImpl implements WxMerchantService { @Override public WxMerchant getById(Long id) { - return wxMerchantMapper.selectByPrimaryKey(id); + WxMerchant wxMerchant = wxMerchantMapper.selectByPrimaryKey(id); + WxMerchantShop wxMerchantShop=new WxMerchantShop(); + wxMerchantShop.setMerchantId(wxMerchant.getId()); + List shops = new ArrayList<>(); + + List wxMerchantShopList = wxMerchantShopMapper.findList(wxMerchantShop); + for(WxMerchantShop merchantShop:wxMerchantShopList){ + WxShop wxShop = WxShopMapper.selectByPrimaryKey(merchantShop.getShopId()); + if(wxShop!=null) + shops.add(wxShop); + } + + wxMerchant.setShops(shops); + return wxMerchant; }