| @@ -103,11 +103,10 @@ public class WxMerchantController extends BaseController { | |||||
| @PostMapping("saveOrUpdate") | @PostMapping("saveOrUpdate") | ||||
| @SystemControllerLog(description = "区域商户和普通商户关系新增或更新") | @SystemControllerLog(description = "区域商户和普通商户关系新增或更新") | ||||
| public ResultData saveOrUpdate(@RequestBody WxMerchantRelation wxMerchantRelation) { | public ResultData saveOrUpdate(@RequestBody WxMerchantRelation wxMerchantRelation) { | ||||
| logger.debug(getTenantInfo().toString()); | |||||
| logger.debug("[" + getIpAddr() + "] WxMerchantController::saveOrUpdate"); | logger.debug("[" + getIpAddr() + "] WxMerchantController::saveOrUpdate"); | ||||
| if (null == wxMerchantRelation) wxMerchantRelation = new WxMerchantRelation(); | if (null == wxMerchantRelation) wxMerchantRelation = new WxMerchantRelation(); | ||||
| wxMerchantRelation.updateTenantInfo(getTenantInfo()); | wxMerchantRelation.updateTenantInfo(getTenantInfo()); | ||||
| return wxMerchantRelationService.saveOrUpdate(wxMerchantRelation.getRegionMerchantId(),wxMerchantRelation.getMerchantIds(),wxMerchantRelation.getType(),wxMerchantRelation.getTenantId()); | |||||
| return wxMerchantRelationService.saveOrUpdate(wxMerchantRelation.getRegionMerchantId(),wxMerchantRelation.getMerchantIds(),wxMerchantRelation.getType(),getTenantInfo()); | |||||
| } | } | ||||
| @ApiOperation("区域商户删除普通商户") | @ApiOperation("区域商户删除普通商户") | ||||
| @@ -25,16 +25,6 @@ public class WxMerchantRelation extends TenantEntity { | |||||
| */ | */ | ||||
| private Long id; | private Long id; | ||||
| /** | |||||
| * 租户ID | |||||
| */ | |||||
| private String tenantId; | |||||
| /** | |||||
| * 父租户ID | |||||
| */ | |||||
| private String parentTenantId; | |||||
| /** | /** | ||||
| * 区域商户id | * 区域商户id | ||||
| */ | */ | ||||
| @@ -2,12 +2,13 @@ package com.iformall.service; | |||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import java.util.List; | import java.util.List; | ||||
| public interface WxMerchantRelationService { | public interface WxMerchantRelationService { | ||||
| ResultData saveOrUpdate(Long regionId, List<Long> ids, Integer type, String tenantId); | |||||
| ResultData saveOrUpdate(Long regionId, List<Long> ids, Integer type, TenantEntity tenantEntity); | |||||
| void deleteByMerchantId(Long id); | void deleteByMerchantId(Long id); | ||||
| @@ -5,6 +5,7 @@ import com.iformall.common.IdWorker; | |||||
| import com.iformall.common.Result; | import com.iformall.common.Result; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.WxMerchantRelation; | import com.iformall.domain.po.WxMerchantRelation; | ||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import com.iformall.mapper.WxMerchantRelationMapper; | import com.iformall.mapper.WxMerchantRelationMapper; | ||||
| import com.iformall.service.WxMerchantRelationService; | import com.iformall.service.WxMerchantRelationService; | ||||
| import com.iformall.service.WxMerchantService; | import com.iformall.service.WxMerchantService; | ||||
| @@ -14,7 +15,6 @@ import org.springframework.stereotype.Service; | |||||
| import org.springframework.transaction.annotation.Transactional; | import org.springframework.transaction.annotation.Transactional; | ||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import java.util.Date; | |||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.stream.Collectors; | import java.util.stream.Collectors; | ||||
| @@ -30,7 +30,7 @@ public class WxMerchantRelationServiceImpl implements WxMerchantRelationService | |||||
| @Transactional(rollbackFor = {Exception.class}) | @Transactional(rollbackFor = {Exception.class}) | ||||
| @Override | @Override | ||||
| public ResultData saveOrUpdate(Long regionId, List<Long> ids, Integer type, String tenantId) { | |||||
| public ResultData saveOrUpdate(Long regionId, List<Long> ids, Integer type, TenantEntity tenantEntity) { | |||||
| if (regionId == null) { | if (regionId == null) { | ||||
| return new ResultData(Result.ERROR, "区域商户id不能为空"); | return new ResultData(Result.ERROR, "区域商户id不能为空"); | ||||
| } | } | ||||
| @@ -69,7 +69,8 @@ public class WxMerchantRelationServiceImpl implements WxMerchantRelationService | |||||
| relation.setId(IdWorker.get().nextId()); | relation.setId(IdWorker.get().nextId()); | ||||
| relation.setMerchantId(id); | relation.setMerchantId(id); | ||||
| relation.setRegionMerchantId(regionId); | relation.setRegionMerchantId(regionId); | ||||
| relation.setTenantId(tenantId); | |||||
| relation.setTenantId(tenantEntity.getTenantId()); | |||||
| relation.setParentTenantId(tenantEntity.getParentTenantId()); | |||||
| list.add(relation); | list.add(relation); | ||||
| } | } | ||||
| wxMerchantRelationMapper.insertBatch(list); | wxMerchantRelationMapper.insertBatch(list); | ||||
| @@ -24,13 +24,14 @@ | |||||
| </update> | </update> | ||||
| <insert id="insertBatch" parameterType="java.util.List"> | <insert id="insertBatch" parameterType="java.util.List"> | ||||
| insert into wx_merchant_relation (id, tenant_id,merchant_id,region_merchant_id ) | |||||
| insert into wx_merchant_relation (id, tenant_id,merchant_id,region_merchant_id,parent_tenant_id) | |||||
| values | values | ||||
| <foreach collection="list" item="item" index="index" separator=","> | <foreach collection="list" item="item" index="index" separator=","> | ||||
| (#{item.id}, | (#{item.id}, | ||||
| #{item.tenantId}, | #{item.tenantId}, | ||||
| #{item.merchantId}, | #{item.merchantId}, | ||||
| #{item.regionMerchantId}) | |||||
| #{item.regionMerchantId}, | |||||
| #{item.parentTenantId}) | |||||
| </foreach> | </foreach> | ||||
| </insert> | </insert> | ||||