Просмотр исходного кода

[商铺商户][修改]:商户编辑时返回数据修改

release_toaliyun_real
gongbiao 7 лет назад
Родитель
Сommit
efbc40eaa0
2 измененных файлов: 27 добавлений и 2 удалений
  1. +12
    -1
      mallinkService/src/main/java/com/simple/domain/po/WxMerchant.java
  2. +15
    -1
      mallinkService/src/main/java/com/simple/service/impl/WxMerchantServiceImpl.java

+ 12
- 1
mallinkService/src/main/java/com/simple/domain/po/WxMerchant.java Просмотреть файл

@@ -42,7 +42,10 @@ public class WxMerchant implements Serializable {
private String userids; private String userids;
@Transient @Transient
private String shopids; private String shopids;

@Transient
private List<WxShop> shops;

/*租户ID**/ /*租户ID**/
@io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId")
private String tenantId; private String tenantId;
@@ -171,6 +174,14 @@ public class WxMerchant implements Serializable {
this.shopids = shopids; this.shopids = shopids;
} }


public List<WxShop> getShops() {
return shops;
}

public void setShops(List<WxShop> shops) {
this.shops = shops;
}

public static enum Field public static enum Field
{ {
Id_ASC("`id` ASC"),Id_DESC("`id` DESC") Id_ASC("`id` ASC"),Id_DESC("`id` DESC")


+ 15
- 1
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.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;


import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;


@@ -42,7 +43,20 @@ public class WxMerchantServiceImpl implements WxMerchantService {


@Override @Override
public WxMerchant getById(Long id) { public WxMerchant getById(Long id) {
return wxMerchantMapper.selectByPrimaryKey(id);
WxMerchant wxMerchant = wxMerchantMapper.selectByPrimaryKey(id);
WxMerchantShop wxMerchantShop=new WxMerchantShop();
wxMerchantShop.setMerchantId(wxMerchant.getId());
List<WxShop> shops = new ArrayList<>();

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






Загрузка…
Отмена
Сохранить