| @@ -367,7 +367,7 @@ public class WxCUserBasicInfoController extends BaseController { | |||||
| } | } | ||||
| basicInfo.undateFinalTenantId(ifParentUpdateTenantInfo()); | basicInfo.undateFinalTenantId(ifParentUpdateTenantInfo()); | ||||
| wxCUserBasicInfoService.exportData(ifParentUpdateTenantInfo(),basicInfo, request, response); | |||||
| wxCUserBasicInfoService.exportData(getTenantInfo(),basicInfo, request, response); | |||||
| } | } | ||||
| @RequestMapping("/exportTemplate") | @RequestMapping("/exportTemplate") | ||||
| @@ -1,12 +1,10 @@ | |||||
| package com.iformall.domain.po.base; | package com.iformall.domain.po.base; | ||||
| import com.baomidou.mybatisplus.annotation.TableField; | import com.baomidou.mybatisplus.annotation.TableField; | ||||
| import lombok.Data; | |||||
| import com.fasterxml.jackson.annotation.JsonIgnore; | |||||
| import lombok.EqualsAndHashCode; | import lombok.EqualsAndHashCode; | ||||
| import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
| import com.iformall.domain.po.WxCUserBasicInfo; | |||||
| /** | /** | ||||
| * @author Stormeye | * @author Stormeye | ||||
| * @date 2019/4/24 14:32 | * @date 2019/4/24 14:32 | ||||
| @@ -25,9 +23,14 @@ public class TenantEntity extends BaseEntity { | |||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| protected String finalTenantId; | protected String finalTenantId; | ||||
| @JsonIgnore | |||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| protected String shardTableSuffix; | protected String shardTableSuffix; | ||||
| @JsonIgnore | |||||
| @TableField(exist = false) | |||||
| protected String shardFinalTableSuffix; | |||||
| public void updateTenantInfo(TenantEntity info) { | public void updateTenantInfo(TenantEntity info) { | ||||
| setTenantId(info.getTenantId()); | setTenantId(info.getTenantId()); | ||||
| setParentTenantId(null); | setParentTenantId(null); | ||||
| @@ -54,11 +57,18 @@ public class TenantEntity extends BaseEntity { | |||||
| } | } | ||||
| public String getShardTableSuffix() { | public String getShardTableSuffix() { | ||||
| if(StringUtils.isNotBlank(tenantId)){ | |||||
| shardTableSuffix = "_" + Integer.parseInt(this.getTenantId())%100; | |||||
| if(StringUtils.isNotBlank(getTenantId())){ | |||||
| shardTableSuffix = "_" + Integer.parseInt(getTenantId())%100; | |||||
| } | } | ||||
| return shardTableSuffix; | return shardTableSuffix; | ||||
| } | } | ||||
| public String getShardFinalTableSuffix(){ | |||||
| if(StringUtils.isNotBlank(getFinalTenantId())){ | |||||
| shardFinalTableSuffix = "_" + Integer.parseInt(getFinalTenantId())%100; | |||||
| } | |||||
| return shardFinalTableSuffix; | |||||
| } | |||||
| public String getTenantId() { | public String getTenantId() { | ||||
| @@ -1274,11 +1274,11 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc | |||||
| List<WxCUserBasicInfoVo> list = new ArrayList<WxCUserBasicInfoVo>(); | List<WxCUserBasicInfoVo> list = new ArrayList<WxCUserBasicInfoVo>(); | ||||
| basicInfo.setBegin((page-1)*10000); | basicInfo.setBegin((page-1)*10000); | ||||
| basicInfo.setLimit(10000); | basicInfo.setLimit(10000); | ||||
| if(StringUtils.isNotBlank(tenantInfo.getParentTenantId())){ | |||||
| //list = wxCUserBasicInfoMapper.findVoList1(tenantInfo,basicInfo); | |||||
| }else{ | |||||
| basicInfo.undateFinalTenantId(tenantInfo); | |||||
| } | |||||
| // if(StringUtils.isNotBlank(tenantInfo.getParentTenantId())){ | |||||
| // //list = wxCUserBasicInfoMapper.findVoList1(tenantInfo,basicInfo); | |||||
| // }else{ | |||||
| // basicInfo.undateFinalTenantId(tenantInfo); | |||||
| // } | |||||
| list = wxCUserBasicInfoMapper.findVoList1(tenantInfo,basicInfo); | list = wxCUserBasicInfoMapper.findVoList1(tenantInfo,basicInfo); | ||||
| if (null == list || list.size() <= 0 ) { | if (null == list || list.size() <= 0 ) { | ||||
| return null; | return null; | ||||
| @@ -822,8 +822,8 @@ | |||||
| <select id="findVoList1" resultMap="VoBaseResultMap"> | <select id="findVoList1" resultMap="VoBaseResultMap"> | ||||
| select | select | ||||
| <include refid="allVoColumns"/> | <include refid="allVoColumns"/> | ||||
| ,(select ifnull(sum(credit.credit_num),0) amount from wx_credit_history credit | |||||
| where credit.`tenant_id` = #{tenantInfo.tenantId} | |||||
| ,(select ifnull(sum(credit.credit_num),0) amount from wx_credit_history${tenantEntity.shardFinalTableSuffix} credit | |||||
| where credit.`tenant_id` = #{tenantInfo.finalTenantId} | |||||
| and credit.credit_num > 0 and credit.c_user_id = cu.id | and credit.credit_num > 0 and credit.c_user_id = cu.id | ||||
| <if test=" null != basicInfo.creditStartTime "> | <if test=" null != basicInfo.creditStartTime "> | ||||
| and credit.create_date >= #{basicInfo.creditStartTime} | and credit.create_date >= #{basicInfo.creditStartTime} | ||||
| @@ -831,8 +831,8 @@ | |||||
| <if test=" null != basicInfo.creditEndTime"> | <if test=" null != basicInfo.creditEndTime"> | ||||
| and credit.create_date < #{basicInfo.creditEndTime} | and credit.create_date < #{basicInfo.creditEndTime} | ||||
| </if>) as addCredit, | </if>) as addCredit, | ||||
| (select ifnull(sum(credit.credit_num),0) amount from wx_credit_history credit | |||||
| where credit.`tenant_id` = #{tenantInfo.tenantId} | |||||
| (select ifnull(sum(credit.credit_num),0) amount from wx_credit_history${tenantEntity.shardFinalTableSuffix} credit | |||||
| where credit.`tenant_id` = #{tenantInfo.finalTenantId} | |||||
| and credit.credit_num < 0 and credit.c_user_id = cu.id | and credit.credit_num < 0 and credit.c_user_id = cu.id | ||||
| <if test=" null != basicInfo.creditStartTime "> | <if test=" null != basicInfo.creditStartTime "> | ||||
| and credit.create_date >= #{basicInfo.creditStartTime} | and credit.create_date >= #{basicInfo.creditStartTime} | ||||