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; }