Browse Source

Merge branch 'release_toaliyun_real' of http://221.219.212.246:13000/server/formallProject into release_toaliyun_real

release_toaliyun_real
xiaohanzi 5 years ago
parent
commit
a6fa5656d5
100 changed files with 1875 additions and 909 deletions
  1. +17
    -10
      mallinkAdmin/src/main/java/com/iformall/controller/base/BaseController.java
  2. +0
    -1
      mallinkAdmin/src/main/java/com/iformall/controller/basic/WxProjectConfigController.java
  3. +4
    -3
      mallinkAdmin/src/main/java/com/iformall/controller/sys/HomeController.java
  4. +1
    -1
      mallinkAdmin/src/main/java/com/iformall/controller/sys/WxAdminLogController.java
  5. +0
    -2
      mallinkAdmin/src/main/java/com/iformall/shiro/UserSession.java
  6. +13
    -0
      mallinkAdmin/src/main/resources/application-dev.yml
  7. +13
    -0
      mallinkBApi/src/main/resources/application-dev.yml
  8. +13
    -0
      mallinkCApi/src/main/resources/application-dev.yml
  9. +13
    -0
      mallinkCallback/src/main/resources/application-dev.yml
  10. +13
    -0
      mallinkMQConsumer/src/main/resources/application-dev.yml
  11. +13
    -0
      mallinkPosApi/src/main/resources/application-dev.yml
  12. +13
    -0
      mallinkSchedule/src/main/resources/application-dev.yml
  13. +109
    -0
      mallinkService/src/main/java/com/iformall/aliyunSMS/SimpleSMSSender.java
  14. +30
    -0
      mallinkService/src/main/java/com/iformall/aliyunSMS/bean/AliyunSMSConfig.java
  15. +24
    -0
      mallinkService/src/main/java/com/iformall/aliyunSMS/bean/Query.java
  16. +20
    -0
      mallinkService/src/main/java/com/iformall/aliyunSMS/bean/Result.java
  17. +20
    -0
      mallinkService/src/main/java/com/iformall/aliyunSMS/bean/SMS.java
  18. +3
    -1
      mallinkService/src/main/java/com/iformall/domain/po/WxMsgValidationcodeModel.java
  19. +58
    -26
      mallinkService/src/main/java/com/iformall/service/msg/impl/SendSmsServiceImpl.java
  20. +3
    -4
      mallinkService/src/main/resources/mapper/KwBoxCmdHistoryMapper.xml
  21. +3
    -4
      mallinkService/src/main/resources/mapper/KwBoxMapper.xml
  22. +15
    -11
      mallinkService/src/main/resources/mapper/KwMerchantMeterMapper.xml
  23. +3
    -3
      mallinkService/src/main/resources/mapper/KwMeterMapper.xml
  24. +4
    -4
      mallinkService/src/main/resources/mapper/MallResourceMapper.xml
  25. +6
    -7
      mallinkService/src/main/resources/mapper/MallRoleMapper.xml
  26. +2
    -3
      mallinkService/src/main/resources/mapper/MallRolePermissionMapper.xml
  27. +2
    -2
      mallinkService/src/main/resources/mapper/MallUserActionMapper.xml
  28. +2
    -3
      mallinkService/src/main/resources/mapper/MallUserInfoMapper.xml
  29. +4
    -4
      mallinkService/src/main/resources/mapper/PosCouponOrderVerifyMapper.xml
  30. +11
    -6
      mallinkService/src/main/resources/mapper/PosMallConfigMapper.xml
  31. +4
    -4
      mallinkService/src/main/resources/mapper/PosOrderMapper.xml
  32. +4
    -4
      mallinkService/src/main/resources/mapper/PosPayOrderMapper.xml
  33. +2
    -3
      mallinkService/src/main/resources/mapper/PushLimitMapper.xml
  34. +2
    -2
      mallinkService/src/main/resources/mapper/WxActivityJoinMapper.xml
  35. +2
    -3
      mallinkService/src/main/resources/mapper/WxActivityMapper.xml
  36. +7
    -7
      mallinkService/src/main/resources/mapper/WxAdminLogMapper.xml
  37. +2
    -3
      mallinkService/src/main/resources/mapper/WxBillActionMapper.xml
  38. +211
    -77
      mallinkService/src/main/resources/mapper/WxBillAllMapper.xml
  39. +7
    -3
      mallinkService/src/main/resources/mapper/WxBillDailyMapper.xml
  40. +77
    -24
      mallinkService/src/main/resources/mapper/WxBillDepositMapper.xml
  41. +21
    -7
      mallinkService/src/main/resources/mapper/WxBillOtherDepositMapper.xml
  42. +50
    -16
      mallinkService/src/main/resources/mapper/WxBillOtherMapper.xml
  43. +35
    -13
      mallinkService/src/main/resources/mapper/WxBillPropertyDepositMapper.xml
  44. +48
    -18
      mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml
  45. +43
    -16
      mallinkService/src/main/resources/mapper/WxBillRentMapper.xml
  46. +6
    -2
      mallinkService/src/main/resources/mapper/WxBillSettleBillMapper.xml
  47. +6
    -2
      mallinkService/src/main/resources/mapper/WxBillSettleMapper.xml
  48. +6
    -2
      mallinkService/src/main/resources/mapper/WxBillSettleRecordMapper.xml
  49. +18
    -6
      mallinkService/src/main/resources/mapper/WxBrandMapper.xml
  50. +14
    -8
      mallinkService/src/main/resources/mapper/WxBusinessMapper.xml
  51. +136
    -80
      mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml
  52. +25
    -10
      mallinkService/src/main/resources/mapper/WxCUserMapper.xml
  53. +2
    -3
      mallinkService/src/main/resources/mapper/WxCampaignMapper.xml
  54. +48
    -29
      mallinkService/src/main/resources/mapper/WxCarCmdLogMapper.xml
  55. +2
    -2
      mallinkService/src/main/resources/mapper/WxCarPayRecordMapper.xml
  56. +4
    -4
      mallinkService/src/main/resources/mapper/WxCardInfoMapper.xml
  57. +12
    -12
      mallinkService/src/main/resources/mapper/WxCardSpendMapper.xml
  58. +96
    -40
      mallinkService/src/main/resources/mapper/WxCouponActionLogMapper.xml
  59. +6
    -7
      mallinkService/src/main/resources/mapper/WxCouponCarMapper.xml
  60. +4
    -5
      mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml
  61. +7
    -8
      mallinkService/src/main/resources/mapper/WxCouponInjectMapper.xml
  62. +45
    -18
      mallinkService/src/main/resources/mapper/WxCouponMapper.xml
  63. +2
    -3
      mallinkService/src/main/resources/mapper/WxCouponMerchantMapper.xml
  64. +108
    -56
      mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml
  65. +20
    -11
      mallinkService/src/main/resources/mapper/WxCouponPasswordMapper.xml
  66. +2
    -2
      mallinkService/src/main/resources/mapper/WxCouponPresentMapper.xml
  67. +6
    -7
      mallinkService/src/main/resources/mapper/WxCouponSendConfigMapper.xml
  68. +4
    -5
      mallinkService/src/main/resources/mapper/WxCouponSendMapper.xml
  69. +17
    -13
      mallinkService/src/main/resources/mapper/WxCreditHistoryMapper.xml
  70. +4
    -5
      mallinkService/src/main/resources/mapper/WxDataRuleTargetMapper.xml
  71. +9
    -6
      mallinkService/src/main/resources/mapper/WxDateAmountRecordMapper.xml
  72. +2
    -3
      mallinkService/src/main/resources/mapper/WxDeviceMapper.xml
  73. +6
    -2
      mallinkService/src/main/resources/mapper/WxFlowConfigMapper.xml
  74. +5
    -5
      mallinkService/src/main/resources/mapper/WxFlowModelMapper.xml
  75. +3
    -3
      mallinkService/src/main/resources/mapper/WxFlowRecordMapper.xml
  76. +7
    -7
      mallinkService/src/main/resources/mapper/WxGameActionLogMapper.xml
  77. +3
    -4
      mallinkService/src/main/resources/mapper/WxGameMapper.xml
  78. +16
    -12
      mallinkService/src/main/resources/mapper/WxLevelConfigMapper.xml
  79. +5
    -7
      mallinkService/src/main/resources/mapper/WxLevelMerchantMapper.xml
  80. +6
    -7
      mallinkService/src/main/resources/mapper/WxMallBuildingMapper.xml
  81. +4
    -4
      mallinkService/src/main/resources/mapper/WxMallFloorMapper.xml
  82. +4
    -5
      mallinkService/src/main/resources/mapper/WxMallMapper.xml
  83. +4
    -5
      mallinkService/src/main/resources/mapper/WxMerchantBUserMapper.xml
  84. +7
    -3
      mallinkService/src/main/resources/mapper/WxMerchantCorpMapper.xml
  85. +7
    -8
      mallinkService/src/main/resources/mapper/WxMerchantMapper.xml
  86. +3
    -4
      mallinkService/src/main/resources/mapper/WxMerchantPowerBillConfigMapper.xml
  87. +5
    -6
      mallinkService/src/main/resources/mapper/WxMerchantShopMapper.xml
  88. +7
    -7
      mallinkService/src/main/resources/mapper/WxMerchantSubsidyMapper.xml
  89. +7
    -3
      mallinkService/src/main/resources/mapper/WxMerchantTaxMapper.xml
  90. +30
    -29
      mallinkService/src/main/resources/mapper/WxMerchantTradeDailyMapper.xml
  91. +15
    -8
      mallinkService/src/main/resources/mapper/WxMsgConfigMapper.xml
  92. +6
    -7
      mallinkService/src/main/resources/mapper/WxMsgMapper.xml
  93. +4
    -4
      mallinkService/src/main/resources/mapper/WxMsgModelMapper.xml
  94. +4
    -4
      mallinkService/src/main/resources/mapper/WxMsgRecordMapper.xml
  95. +6
    -7
      mallinkService/src/main/resources/mapper/WxMsgSignatureMapper.xml
  96. +6
    -2
      mallinkService/src/main/resources/mapper/WxMsgValidationcodeMapper.xml
  97. +9
    -3
      mallinkService/src/main/resources/mapper/WxMsgValidationcodeModelMapper.xml
  98. +46
    -38
      mallinkService/src/main/resources/mapper/WxOrderGroupMapper.xml
  99. +90
    -68
      mallinkService/src/main/resources/mapper/WxOrderMapper.xml
  100. +2
    -3
      mallinkService/src/main/resources/mapper/WxParkMapper.xml

+ 17
- 10
mallinkAdmin/src/main/java/com/iformall/controller/base/BaseController.java View File

@@ -7,7 +7,6 @@ import java.util.Date;

import com.iformall.domain.po.MallUserInfo;
import com.iformall.domain.po.base.TenantEntity;
import com.iformall.enums.EnumGroupSupport;
import com.iformall.shiro.UserSession;
import com.iformall.utils.IPUtil;
import org.apache.commons.lang3.StringUtils;
@@ -66,21 +65,29 @@ public class BaseController {
* @return
*/
public TenantEntity getTenantInfo(){
TenantEntity tenantEntity = new TenantEntity();
Session session = SecurityUtils.getSubject().getSession();
String isParent = (String)session.getAttribute(UserSession.isParent);
String tenantId = (String)session.getAttribute(UserSession.tenantId);
String parentTenantId = (String)session.getAttribute(UserSession.parentTenantId);
if(StringUtils.isNotBlank(isParent) && isParent.equalsIgnoreCase(EnumGroupSupport.SUPPORT.getCode().toString())){
tenantEntity.setTenantId(null);
tenantEntity.setParentTenantId(tenantId);
}else{
tenantEntity.setTenantId(tenantId);
tenantEntity.setParentTenantId(parentTenantId);
}
TenantEntity tenantEntity = new TenantEntity(){{
setTenantId(tenantId);
setParentTenantId(parentTenantId);
}};
return tenantEntity;
}

/**
* 处理集团新增修改所需租户信息
* ifParentUpdateTenantInfo
*/
public TenantEntity ifParentUpdateTenantInfo() {
TenantEntity info = this.getTenantInfo();
if(StringUtils.isBlank(info.getTenantId())){
info.setTenantId(info.getParentTenantId());
info.setParentTenantId(null);
}
return info;
}

public String getIpAddr() {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String ipaddress = IPUtil.getIpAddr(request);


+ 0
- 1
mallinkAdmin/src/main/java/com/iformall/controller/basic/WxProjectConfigController.java View File

@@ -32,7 +32,6 @@ public class WxProjectConfigController extends BaseController {
return new ResultData(ErrorCode.SYS_SERVER_ERROR);
}


}




+ 4
- 3
mallinkAdmin/src/main/java/com/iformall/controller/sys/HomeController.java View File

@@ -163,7 +163,8 @@ public class HomeController extends BaseController {
StringUtils.isBlank(info.getParentTenantId())) {

Session session = SecurityUtils.getSubject().getSession();
session.setAttribute(UserSession.isParent, EnumGroupSupport.SUPPORT.getCode());
session.setAttribute(UserSession.tenantId, null);
session.setAttribute(UserSession.parentTenantId, info.getTenantId());

// 集团用户获取子商场
List<WxMall> mallList = mallService.getSubByParentTenantId(info.getTenantId());
@@ -216,8 +217,8 @@ public class HomeController extends BaseController {
session.setAttribute(UserSession.tenantId, subTenantId);
session.setAttribute(UserSession.parentTenantId, tenantId);
} else {
session.setAttribute(UserSession.tenantId, tenantId);
session.setAttribute(UserSession.parentTenantId, null);
session.setAttribute(UserSession.tenantId, null);
session.setAttribute(UserSession.parentTenantId, tenantId);
}
}
return new ResultData();


+ 1
- 1
mallinkAdmin/src/main/java/com/iformall/controller/sys/WxAdminLogController.java View File

@@ -22,7 +22,7 @@ public class WxAdminLogController extends BaseController {
@PostMapping("pvlog")
public ResultData pvLog(@RequestBody WxAdminLog wxAdminLog) {
logger.debug("[" + getIpAddr() + "] WxAdminLogController::pvLog");
wxAdminLog.updateTenantInfo(getTenantInfo());
wxAdminLog.updateTenantInfo(ifParentUpdateTenantInfo());
wxAdminLogService.saveLogCount(wxAdminLog);
return new ResultData();
}


+ 0
- 2
mallinkAdmin/src/main/java/com/iformall/shiro/UserSession.java View File

@@ -10,6 +10,4 @@ public class UserSession {

public static String parentTenantId ="PARENT_TENANT_ID";

public static String isParent ="IS_PARENT";

}

+ 13
- 0
mallinkAdmin/src/main/resources/application-dev.yml View File

@@ -4,6 +4,7 @@ spring:
#include: rabbitMQ
# JDBC
datasource:
#url: jdbc:mysql://rm-2zel9i9t555zy7lftmo.mysql.rds.aliyuncs.com:3306/mallink?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useUnicode=true&useSSL=false&useAffectedRows=true&allowMultiQueries=true
url: jdbc:mysql://zc349w82qvn56ftl5e64-rw4rm.rwlb.rds.aliyuncs.com:3306/mallink?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useUnicode=true&useSSL=false&useAffectedRows=true&allowMultiQueries=true
username: ENC(dZ8fmrtuBMQYaRytKQgTqg==)
password: ENC(IKH7HxMZwIqMttMc9+QsqWa1KMsJvTs4)
@@ -40,6 +41,18 @@ spring:
max-idle: 500
max-wait: -1
min-idle: 10

# SMS
aliyun:
sms:
accessKeyId: LTAI4G7ixY4AhvM35F8o3W3V
accessKeySecret: VfWqGb83qIQrS9us45utskl8itd7ry
product: Dysmsapi
domain: dysmsapi.aliyuncs.com
regionId: cn-hangzhou
dateFormat: yyyyMMdd
endpointName: cn-hangzhou

# EMAIL
mail:
host: smtp.exmail.qq.com


+ 13
- 0
mallinkBApi/src/main/resources/application-dev.yml View File

@@ -4,6 +4,7 @@ spring:
#include: rabbitMQ
# JDBC
datasource:
#url: jdbc:mysql://rm-2zel9i9t555zy7lftmo.mysql.rds.aliyuncs.com:3306/mallink?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useUnicode=true&useSSL=false&useAffectedRows=true
url: jdbc:mysql://zc349w82qvn56ftl5e64-rw4rm.rwlb.rds.aliyuncs.com:3306/mallink?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useUnicode=true&useSSL=false&useAffectedRows=true
username: ENC(dZ8fmrtuBMQYaRytKQgTqg==)
password: ENC(IKH7HxMZwIqMttMc9+QsqWa1KMsJvTs4)
@@ -39,6 +40,18 @@ spring:
max-idle: 30
max-wait: -1
min-idle: 0

# SMS
aliyun:
sms:
accessKeyId: LTAI4G7ixY4AhvM35F8o3W3V
accessKeySecret: VfWqGb83qIQrS9us45utskl8itd7ry
product: Dysmsapi
domain: dysmsapi.aliyuncs.com
regionId: cn-hangzhou
dateFormat: yyyyMMdd
endpointName: cn-hangzhou

# EMAIL
mail:
host: smtp.exmail.qq.com


+ 13
- 0
mallinkCApi/src/main/resources/application-dev.yml View File

@@ -4,6 +4,7 @@ spring:
#include: rabbitMQ
# JDBC
datasource:
#url: jdbc:mysql://rm-2zel9i9t555zy7lftmo.mysql.rds.aliyuncs.com:3306/mallink?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useUnicode=true&useSSL=false&useAffectedRows=true
url: jdbc:mysql://zc349w82qvn56ftl5e64-rw4rm.rwlb.rds.aliyuncs.com:3306/mallink?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useUnicode=true&useSSL=false&useAffectedRows=true
username: ENC(dZ8fmrtuBMQYaRytKQgTqg==)
password: ENC(IKH7HxMZwIqMttMc9+QsqWa1KMsJvTs4)
@@ -39,6 +40,18 @@ spring:
max-idle: 100
max-wait: -1
min-idle: 0

# SMS
aliyun:
sms:
accessKeyId: LTAI4G7ixY4AhvM35F8o3W3V
accessKeySecret: VfWqGb83qIQrS9us45utskl8itd7ry
product: Dysmsapi
domain: dysmsapi.aliyuncs.com
regionId: cn-hangzhou
dateFormat: yyyyMMdd
endpointName: cn-hangzhou

# EMAIL
mail:
host: smtp.exmail.qq.com


+ 13
- 0
mallinkCallback/src/main/resources/application-dev.yml View File

@@ -4,6 +4,7 @@ spring:
#include: rabbitMQ
# JDBC
datasource:
#url: jdbc:mysql://rm-2zel9i9t555zy7lftmo.mysql.rds.aliyuncs.com:3306/mallink?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useUnicode=true&useSSL=false&useAffectedRows=true
url: jdbc:mysql://zc349w82qvn56ftl5e64-rw4rm.rwlb.rds.aliyuncs.com:3306/mallink?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useUnicode=true&useSSL=false&useAffectedRows=true
username: ENC(dZ8fmrtuBMQYaRytKQgTqg==)
password: ENC(IKH7HxMZwIqMttMc9+QsqWa1KMsJvTs4)
@@ -40,6 +41,18 @@ spring:
max-idle: 500
max-wait: -1
min-idle: 10

# SMS
aliyun:
sms:
accessKeyId: LTAI4G7ixY4AhvM35F8o3W3V
accessKeySecret: VfWqGb83qIQrS9us45utskl8itd7ry
product: Dysmsapi
domain: dysmsapi.aliyuncs.com
regionId: cn-hangzhou
dateFormat: yyyyMMdd
endpointName: cn-hangzhou

# EMAIL
mail:
host: smtp.exmail.qq.com


+ 13
- 0
mallinkMQConsumer/src/main/resources/application-dev.yml View File

@@ -4,6 +4,7 @@ spring:
#include: rabbitMQ
# JDBC
datasource:
#url: jdbc:mysql://rm-2zel9i9t555zy7lftmo.mysql.rds.aliyuncs.com:3306/mallink?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useUnicode=true&useSSL=false&useAffectedRows=true
url: jdbc:mysql://zc349w82qvn56ftl5e64-rw4rm.rwlb.rds.aliyuncs.com:3306/mallink?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useUnicode=true&useSSL=false&useAffectedRows=true
username: ENC(dZ8fmrtuBMQYaRytKQgTqg==)
password: ENC(IKH7HxMZwIqMttMc9+QsqWa1KMsJvTs4)
@@ -41,6 +42,18 @@ spring:
max-idle: 50
max-wait: -1
min-idle: 10

# SMS
aliyun:
sms:
accessKeyId: LTAI4G7ixY4AhvM35F8o3W3V
accessKeySecret: VfWqGb83qIQrS9us45utskl8itd7ry
product: Dysmsapi
domain: dysmsapi.aliyuncs.com
regionId: cn-hangzhou
dateFormat: yyyyMMdd
endpointName: cn-hangzhou

# EMAIL
mail:
host: smtp.exmail.qq.com


+ 13
- 0
mallinkPosApi/src/main/resources/application-dev.yml View File

@@ -4,6 +4,7 @@ spring:
#include: rabbitMQ
# JDBC
datasource:
#url: jdbc:mysql://rm-2zel9i9t555zy7lftmo.mysql.rds.aliyuncs.com:3306/mallinkDevGroup1?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useUnicode=true&useSSL=false&useAffectedRows=true
url: jdbc:mysql://zc349w82qvn56ftl5e64-rw4rm.rwlb.rds.aliyuncs.com:3306/mallinkDevGroup1?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useUnicode=true&useSSL=false&useAffectedRows=true
username: ENC(dZ8fmrtuBMQYaRytKQgTqg==)
password: ENC(IKH7HxMZwIqMttMc9+QsqWa1KMsJvTs4)
@@ -39,6 +40,18 @@ spring:
max-idle: 30
max-wait: -1
min-idle: 0

# SMS
aliyun:
sms:
accessKeyId: LTAI4G7ixY4AhvM35F8o3W3V
accessKeySecret: VfWqGb83qIQrS9us45utskl8itd7ry
product: Dysmsapi
domain: dysmsapi.aliyuncs.com
regionId: cn-hangzhou
dateFormat: yyyyMMdd
endpointName: cn-hangzhou

# EMAIL
mail:
host: smtp.exmail.qq.com


+ 13
- 0
mallinkSchedule/src/main/resources/application-dev.yml View File

@@ -4,6 +4,7 @@ spring:
#include: rabbitMQ
# JDBC
datasource:
#url: jdbc:mysql://rm-2zel9i9t555zy7lftmo.mysql.rds.aliyuncs.com:3306/mallink?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useUnicode=true&useSSL=false&useAffectedRows=true
url: jdbc:mysql://zc349w82qvn56ftl5e64-rw4rm.rwlb.rds.aliyuncs.com:3306/mallink?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useUnicode=true&useSSL=false&useAffectedRows=true
username: ENC(dZ8fmrtuBMQYaRytKQgTqg==)
password: ENC(IKH7HxMZwIqMttMc9+QsqWa1KMsJvTs4)
@@ -41,6 +42,18 @@ spring:
max-idle: 50
max-wait: -1
min-idle: 10

# SMS
aliyun:
sms:
accessKeyId: LTAI4G7ixY4AhvM35F8o3W3V
accessKeySecret: VfWqGb83qIQrS9us45utskl8itd7ry
product: Dysmsapi
domain: dysmsapi.aliyuncs.com
regionId: cn-hangzhou
dateFormat: yyyyMMdd
endpointName: cn-hangzhou

# EMAIL
mail:
host: smtp.exmail.qq.com


+ 109
- 0
mallinkService/src/main/java/com/iformall/aliyunSMS/SimpleSMSSender.java View File

@@ -0,0 +1,109 @@
package com.iformall.aliyunSMS;

import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.dysmsapi.model.v20170525.QuerySendDetailsRequest;
import com.aliyuncs.dysmsapi.model.v20170525.QuerySendDetailsResponse;
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsRequest;
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.profile.DefaultProfile;
import com.aliyuncs.profile.IClientProfile;
import com.iformall.aliyunSMS.bean.AliyunSMSConfig;
import com.iformall.aliyunSMS.bean.Query;
import com.iformall.aliyunSMS.bean.Result;
import com.iformall.aliyunSMS.bean.SMS;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;

@Component
@Slf4j
public class SimpleSMSSender {

@Autowired
private AliyunSMSConfig smsConfig;

/**
* 发送短信
* @param sms
* @return
*/
public Result sendSms(SMS sms) {
IAcsClient acsClient = getClient();
SendSmsRequest request = getRequest(sms);
SendSmsResponse sendSmsResponse = null;
try {
sendSmsResponse = acsClient.getAcsResponse(request);
} catch (ClientException e) {
log.error("发送短信发生错误。错误代码是 [{}],错误消息是 [{}],错误请求ID是 [{}],错误Msg是 [{}],错误类型是 [{}]",
e.getErrCode(), e.getMessage(), e.getRequestId(), e.getErrMsg(), e.getErrorType());
}
if(sendSmsResponse.getCode() != null && sendSmsResponse.getCode().equals("OK")){

log.info(sendSmsResponse.getCode() + "----" + sendSmsResponse.getMessage());

Result result = new Result();
result.setSendSmsResponse(sendSmsResponse);
result.setSms(sms);
return result;
}else{
log.error(sendSmsResponse.getCode() + "----" + sendSmsResponse.getMessage());
return null;
}
}

/**
* 查询短信发送结果
* @param query
* @return
*/
public QuerySendDetailsResponse querySendDetails(Query query) {
IAcsClient acsClient = getClient();
QuerySendDetailsRequest request = new QuerySendDetailsRequest();
request.setPhoneNumber(query.getPhoneNumber());
request.setBizId(query.getBizId());
SimpleDateFormat ft = new SimpleDateFormat(smsConfig.getDateFormat());
request.setSendDate(ft.format(query.getSendDate()));
request.setPageSize(query.getPageSize());
request.setCurrentPage(query.getCurrentPage());
QuerySendDetailsResponse querySendDetailsResponse = null;
try {
querySendDetailsResponse = acsClient.getAcsResponse(request);
} catch (ClientException e) {
log.error("AliyunSMS查询短信发送结果异常" + e);
}
return querySendDetailsResponse;
}

/**
* 获取短信请求
* @param sms
* @return
*/
private SendSmsRequest getRequest(SMS sms) {
SendSmsRequest request = new SendSmsRequest();
request.setPhoneNumbers(sms.getPhoneNumbers());
request.setSignName(sms.getSignName());
request.setTemplateCode(sms.getTemplateCode());
request.setTemplateParam(sms.getTemplateParam());
request.setOutId(sms.getOutId());
return request;
}

/**
* 获取短信发送服务机
* @return
*/
private IAcsClient getClient() {
IClientProfile profile = DefaultProfile.getProfile(smsConfig.getRegionId(), smsConfig.getAccessKeyId(), smsConfig.getAccessKeySecret());
try {
DefaultProfile.addEndpoint(smsConfig.getEndpointName(), smsConfig.getRegionId(), smsConfig.getProduct(), smsConfig.getDomain());
} catch (ClientException e) {
log.error("AliyunSMS获取短信发送服务机异常" + e);
}
return new DefaultAcsClient(profile);
}
}

+ 30
- 0
mallinkService/src/main/java/com/iformall/aliyunSMS/bean/AliyunSMSConfig.java View File

@@ -0,0 +1,30 @@
package com.iformall.aliyunSMS.bean;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
* aliyun 配置
*/
@Component
@Data
@ConfigurationProperties(prefix = "spring.aliyun.sms")
public class AliyunSMSConfig {

//用户标识
private String accessKeyId;
//密钥
private String accessKeySecret;
// 短信API产品名称(短信产品名固定,无需修改) product = "Dysmsapi"
private String product;
//短信API产品域名,接口地址固定,无需修改 domain = "dysmsapi.aliyuncs.com"
private String domain;
//API支持的RegionID,如短信API的值为: cn-hangzhou。
private String regionId;
//#发送日期 支持30天内记录查询,格式: yyyyMMdd
private String dateFormat;
//服务结点: cn-hangzhou
private String endpointName;

}

+ 24
- 0
mallinkService/src/main/java/com/iformall/aliyunSMS/bean/Query.java View File

@@ -0,0 +1,24 @@
package com.iformall.aliyunSMS.bean;

import lombok.Data;

import java.util.Date;

/**
* aliyun 查询对象
*/
@Data
public class Query {

//阿里云返回的回执ID
private String bizId;
//接收短信的手机号码。
private String phoneNumber;
//短信发送日期,支持查询最近30天的记录。
private Date sendDate;
//分页查看发送记录,指定每页显示的短信记录数量。
private Long pageSize;
//分页查看发送记录,指定发送记录的的当前页码。
private Long currentPage;

}

+ 20
- 0
mallinkService/src/main/java/com/iformall/aliyunSMS/bean/Result.java View File

@@ -0,0 +1,20 @@
package com.iformall.aliyunSMS.bean;

import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse;
import lombok.Data;


@Data
public class Result {

/**
* 发送短信的返回结果对象
* Code:请求状态码。返回OK代表请求成功。
* Message:状态码的描述。
* bizId:回执ID
*/
private SendSmsResponse sendSmsResponse;

private SMS sms;

}

+ 20
- 0
mallinkService/src/main/java/com/iformall/aliyunSMS/bean/SMS.java View File

@@ -0,0 +1,20 @@
package com.iformall.aliyunSMS.bean;

import lombok.Data;


@Data
public class SMS {

//接收短信的手机号码。
private String phoneNumbers;
//短信模板变量对应的实际值,JSON格式。
private String templateParam;
//外部流水扩展字段。
private String outId;
//短信模板ID。请在控制台模板管理页面模板CODE一列查看。
private String templateCode;
//短信签名名称。请在控制台签名管理页面签名名称一列查看。
private String signName;

}

+ 3
- 1
mallinkService/src/main/java/com/iformall/domain/po/WxMsgValidationcodeModel.java View File

@@ -28,6 +28,8 @@ public class WxMsgValidationcodeModel extends TenantEntity {
private Integer minutes;
@io.swagger.annotations.ApiModelProperty(value="",name="modelId")
private Integer modelId;
@io.swagger.annotations.ApiModelProperty(value="阿里云模板code",name="modelCode")
private String modelCode;
@io.swagger.annotations.ApiModelProperty(value="场景",name="type")
private Integer type;

@@ -37,7 +39,7 @@ public class WxMsgValidationcodeModel extends TenantEntity {
@io.swagger.annotations.ApiModelProperty(value="发送开关 0开1关",name="open")
private Integer open;

@io.swagger.annotations.ApiModelProperty(value="消息类型 0全部 1短信 2邮箱",name="msgType")
@io.swagger.annotations.ApiModelProperty(value="消息类型 0全部 1短信 2邮箱 11阿里云短信(暂未启用)",name="msgType")
private Integer msgType;

@io.swagger.annotations.ApiModelProperty(value="0通用1管理员2商户端3消费者",name="roleType")


+ 58
- 26
mallinkService/src/main/java/com/iformall/service/msg/impl/SendSmsServiceImpl.java View File

@@ -1,6 +1,12 @@
package com.iformall.service.msg.impl;


import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.iformall.aliyunSMS.SimpleSMSSender;
import com.iformall.aliyunSMS.bean.AliyunSMSConfig;
import com.iformall.aliyunSMS.bean.Result;
import com.iformall.aliyunSMS.bean.SMS;
import com.iformall.common.ErrorCode;
import com.iformall.common.IdWorker;
import com.iformall.domain.po.*;
@@ -32,6 +38,10 @@ import java.util.Map;
@Service
public class SendSmsServiceImpl implements MsgSendService {
private final Logger logger = LoggerFactory.getLogger(this.getClass());

@Autowired
private SimpleSMSSender simpleSMSSender;

@Autowired
private WxMsgConfigMapper wxMsgConfigMapper;
@Autowired
@@ -50,18 +60,6 @@ public class SendSmsServiceImpl implements MsgSendService {
wxMsgValidationcode.updateTenantInfo(tenantEntity);
wxMsgValidationcode.setType(record.getModelType());

//3、从短信配置中查询密钥 bid 等信息
WxMsgConfig wxMsgConfig = new WxMsgConfig();
wxMsgConfig.updateTenantInfo(wxMsgValidationcode);
List<WxMsgConfig> wxMsgConfigs = wxMsgConfigMapper.findList(wxMsgConfig);
if(CollectionUtils.isEmpty(wxMsgConfigs)){
throw new MallinkException(ErrorCode.MSG_CONFIG_NOT_FOUND);
}
wxMsgConfig = wxMsgConfigs.get(0);
if (wxMsgConfig.getRemains() <= 0L) {
throw new MallinkException(ErrorCode.MSG_CONFIG_ACCOUNT);
}

WxMsgValidationcodeModel wxMsgValidationcodeModel = new WxMsgValidationcodeModel();
wxMsgValidationcodeModel.updateTenantInfo(wxMsgValidationcode);
wxMsgValidationcodeModel.setType(record.getModelType());
@@ -73,28 +71,62 @@ public class SendSmsServiceImpl implements MsgSendService {

wxMsgValidationcodeModel = wxMsgValidationcodeModelMapper.findList(wxMsgValidationcodeModel).get(0);

String secret = wxMsgConfig.getSecret();
String bid = wxMsgConfig.getBid();
String publickey = wxMsgConfig.getPublickey();
String phone = record.getReceiver();
String signature = wxMsgValidationcodeModel.getSignature();
wxMsgValidationcode.setSignature(signature);
//替换内容
wxMsgValidationcode.setSignature(wxMsgValidationcodeModel.getSignature());
//替换短信内容
String msg = wxMsgValidationcodeModel.getContent();
for (Map.Entry<String, String> entry : record.getDynamicContentMap().entrySet()) {
msg = msg.replace("{"+entry.getKey()+"}", entry.getValue());
}

wxMsgValidationcode.setMsg(msg);
if(record.getDynamicContentMap() !=null) {
wxMsgValidationcode.setCode(record.getDynamicContentMap().get("s6"));
}

String notifyUrl = wxMsgConfig.getNotifyurl();
Integer modelId = wxMsgValidationcodeModel.getModelId();
String result = WiwideUtil.sendMsg(secret, bid, publickey, phone, signature, msg, notifyUrl, EnumVerifyCode.YES.getCode().toString(), modelId);
JSONObject jsonObjectResult = JSONObject.parseObject(result);
String ret = jsonObjectResult.get("ret").toString();
String batchNo = jsonObjectResult.get("data").toString();
//3、从短信配置中查询密钥 bid 等信息
WxMsgConfig wxMsgConfig = new WxMsgConfig();
wxMsgConfig.updateTenantInfo(wxMsgValidationcode);
List<WxMsgConfig> wxMsgConfigs = wxMsgConfigMapper.findList(wxMsgConfig);
if(CollectionUtils.isEmpty(wxMsgConfigs)){
throw new MallinkException(ErrorCode.MSG_CONFIG_NOT_FOUND);
}
wxMsgConfig = wxMsgConfigs.get(0);
if (wxMsgConfig.getRemains() <= 0L) {
throw new MallinkException(ErrorCode.MSG_CONFIG_ACCOUNT);
}
String ret = "",batchNo = "";
if(wxMsgValidationcodeModel.getMsgType().equals(11)){
//阿里云发短信
SMS sms = new SMS();
sms.setPhoneNumbers(record.getReceiver());
sms.setTemplateParam(JSON.toJSONString(record.getDynamicContentMap()));
sms.setTemplateCode(wxMsgValidationcodeModel.getModelCode());
sms.setOutId(wxMsgValidationcodeModel.getId().toString());
sms.setSignName(wxMsgValidationcodeModel.getSignature());
Result result = simpleSMSSender.sendSms(sms);

if(result != null){
ret = "1";
batchNo = result.getSendSmsResponse().getBizId();
}

}else{
//迈外迪发短信

String secret = wxMsgConfig.getSecret();
String bid = wxMsgConfig.getBid();
String publickey = wxMsgConfig.getPublickey();
String phone = record.getReceiver();
String signature = wxMsgValidationcodeModel.getSignature();

String notifyUrl = wxMsgConfig.getNotifyurl();
Integer modelId = wxMsgValidationcodeModel.getModelId();
String result = WiwideUtil.sendMsg(secret, bid, publickey, phone, signature, msg, notifyUrl, EnumVerifyCode.YES.getCode().toString(), modelId);
JSONObject jsonObjectResult = JSONObject.parseObject(result);
ret = jsonObjectResult.get("ret").toString();
batchNo = jsonObjectResult.get("data").toString();
}

if (ret.equals("1")) {
final IdWorker idWorker = IdWorker.get();
wxMsgValidationcode.setId(idWorker.nextId());
@@ -114,7 +146,7 @@ public class SendSmsServiceImpl implements MsgSendService {
wxMsgConfig.setRemains(1L);
wxMsgConfigMapper.updateRemains(wxMsgConfig);
}else{
throw new MallinkException(1001,"运营商返回失败:"+result);
throw new MallinkException(1001,"运营商返回失败:");
}
}



+ 3
- 4
mallinkService/src/main/resources/mapper/KwBoxCmdHistoryMapper.xml View File

@@ -23,12 +23,11 @@
<if test=" null != id ">
and `id` = #{id}
</if>
<if test=" null != tenantId ">
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>

<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>


+ 3
- 4
mallinkService/src/main/resources/mapper/KwBoxMapper.xml View File

@@ -34,12 +34,11 @@
<if test=" null != id ">
and `id` = #{id}
</if>
<if test=" null != tenantId ">
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>

<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>


+ 15
- 11
mallinkService/src/main/resources/mapper/KwMerchantMeterMapper.xml View File

@@ -24,11 +24,10 @@
and `id` = #{id}
</if>

<if test=" null != tenantId ">
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>

<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
@@ -94,12 +93,12 @@
from (
select merchant_id from kw_merchant_meter
where `status` = 0
<if test=" null != tenantId ">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>

<if test=" null != merchantId ">
and `merchant_id` = #{merchantId}
@@ -293,8 +292,13 @@
where m.status=1
and m.id not in (
select merchant_id from wx_merchant_power_bill_config
where tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
where 1=1
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
)
</select>



+ 3
- 3
mallinkService/src/main/resources/mapper/KwMeterMapper.xml View File

@@ -35,11 +35,11 @@
<if test=" null != id ">
and `kw_meter`.`id` = #{id}
</if>
<if test=" null != tenantId ">
<if test=" null != tenantId and '' != tenantId">
and `kw_meter`.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and `kw_meter`.`parent_tenant_id` = #{parentTenantId}
</if>


+ 4
- 4
mallinkService/src/main/resources/mapper/MallResourceMapper.xml View File

@@ -18,11 +18,11 @@
where 1 = 1
<if test=" null != id ">
and `id` = #{id}
</if>
<if test=" null != tenantId ">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != bucket ">


+ 6
- 7
mallinkService/src/main/resources/mapper/MallRoleMapper.xml View File

@@ -20,14 +20,13 @@
<if test=" null != id ">
and `id` = #{id}
</if>
<if test=" null != tenantId ">
and `tenant_id` = #{tenantId}
</if>
</if>

<if test=" null != parentTenantId ">
and `parent_tenant_id` = #{parentTenantId}
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != name and '' != name ">


+ 2
- 3
mallinkService/src/main/resources/mapper/MallRolePermissionMapper.xml View File

@@ -20,11 +20,10 @@
and `id` = #{id}
</if>

<if test=" null != tenantId ">
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>

<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>



+ 2
- 2
mallinkService/src/main/resources/mapper/MallUserActionMapper.xml View File

@@ -21,10 +21,10 @@
<if test=" null != id ">
and `id` = #{id}
</if>
<if test=" null != tenantId ">
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != userId ">


+ 2
- 3
mallinkService/src/main/resources/mapper/MallUserInfoMapper.xml View File

@@ -35,11 +35,10 @@
and `id` = #{id}
</if>

<if test=" null != tenantId ">
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>

<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>



+ 4
- 4
mallinkService/src/main/resources/mapper/PosCouponOrderVerifyMapper.xml View File

@@ -20,11 +20,11 @@
where 1 = 1
<if test=" null != id ">
and `id` = #{id}
</if>
<if test=" null != tenantId ">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != couponOrderId ">


+ 11
- 6
mallinkService/src/main/resources/mapper/PosMallConfigMapper.xml View File

@@ -20,11 +20,11 @@
where 1 = 1
<if test=" null != id ">
and `id` = #{id}
</if>
<if test=" null != tenantId ">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != discount ">
@@ -67,8 +67,13 @@
select
<include refid="allColumns"/>
from pos_mall_config
where 1=1 and `tenant_id` = #{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
where 1=1
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
</select>


+ 4
- 4
mallinkService/src/main/resources/mapper/PosOrderMapper.xml View File

@@ -22,11 +22,11 @@
where 1 = 1
<if test=" null != id ">
and `id` = #{id}
</if>
<if test=" null != tenantId ">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != posOrderNo ">


+ 4
- 4
mallinkService/src/main/resources/mapper/PosPayOrderMapper.xml View File

@@ -36,11 +36,11 @@
where 1 = 1
<if test=" null != id ">
and `id` = #{id}
</if>
<if test=" null != tenantId ">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != createTime ">


+ 2
- 3
mallinkService/src/main/resources/mapper/PushLimitMapper.xml View File

@@ -27,11 +27,10 @@
and `id` = #{id}
</if>

<if test=" null != tenantId ">
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>

<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>



+ 2
- 2
mallinkService/src/main/resources/mapper/WxActivityJoinMapper.xml View File

@@ -34,10 +34,10 @@
<if test=" null != id ">
and `id` = #{id}
</if>
<if test=" null != tenantId ">
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != name and ''!=name">


+ 2
- 3
mallinkService/src/main/resources/mapper/WxActivityMapper.xml View File

@@ -43,11 +43,10 @@
and `id` = #{id}
</if>
<if test=" null != tenantId ">
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>

<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>


+ 7
- 7
mallinkService/src/main/resources/mapper/WxAdminLogMapper.xml View File

@@ -21,14 +21,14 @@
<if test=" null != id ">
and `id` = #{id}
</if>
<if test=" null != tenantId ">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
</if>
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
</if>
<if test=" null != url ">
and `url` like concat('%', #{url},'%')


+ 2
- 3
mallinkService/src/main/resources/mapper/WxBillActionMapper.xml View File

@@ -28,11 +28,10 @@
and `id` = #{id}
</if>

<if test=" null != tenantId ">
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>

<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>


+ 211
- 77
mallinkService/src/main/resources/mapper/WxBillAllMapper.xml View File

@@ -64,67 +64,100 @@
endtime,rent_shop_type,case when shop_info is null then '[]' else shop_info end shop_info,comments,''
price_detail,updatetime,freeze,ifnull(late_pay_price,0) late_pay_price,service_charge_pay
from wx_bill_rent
where tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
and is_preview = 0
where is_preview = 0
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
union all
select id,merchant_id,shop_id,tenant_id,parent_tenant_id,'租赁押金' name,2 bill_type_value,'租赁押金'
bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,
endtime,rent_shop_type,shop_info,NULL comments,'' price_detail,updatetime,freeze,0
late_pay_price,0 service_charge_pay
from wx_bill_rent_deposit
where tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
where 1=1
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
union all
select id,merchant_id,shop_id,tenant_id,parent_tenant_id,'物业费' name,3 bill_type_value,'物业费'
bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,
endtime,rent_shop_type,case when shop_info is null then '[]' else shop_info end shop_info,comments,''
price_detail,updatetime,freeze,ifnull(late_pay_price,0) late_pay_price,service_charge_pay
from wx_bill_property
where tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
and is_preview = 0
where is_preview = 0
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
union all
select id,merchant_id,shop_id,tenant_id,parent_tenant_id,'物业押金' name,4 bill_type_value,'物业押金'
bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,
endtime,rent_shop_type,shop_info,NULL comments,'' price_detail,updatetime,freeze,0
late_pay_price,0 service_charge_pay
from wx_bill_property_deposit
where tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
where 1=1
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
union all
select id,merchant_id,shop_id,tenant_id,parent_tenant_id,case when type=1 then '水费' when type=2 then '电费' else '空调费' end name,
case when type=1 then 5 when type=2 then 6 else 9 end bill_type_value,
case when type=1 then '水费' when type=2 then '电费' else '空调费' end bill_type,0 as
need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime,
rent_shop_type,'[]' shop_info, NULL comments,price_detail,updatetime,freeze,0 late_pay_price,service_charge_pay
from wx_bill_daily where tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
from wx_bill_daily where 1=1
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
union all
select id,merchant_id,shop_id,tenant_id,parent_tenant_id,name,7 bill_type_value,concat('其他费用-',name) as bill_type,0 as
need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime,
rent_shop_type,'[]' shop_info,comments,'' price_detail,updatetime,freeze,0 late_pay_price,service_charge_pay
from wx_bill_other
where tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
where 1=1
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
union all
select id,merchant_id,shop_id,tenant_id,parent_tenant_id,comments as name,8 bill_type_value,concat('其他押金-',comments) as
bill_type,0 as
need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime,
rent_shop_type,'[]' shop_info,comments,'' price_detail,updatetime,freeze,0 late_pay_price,service_charge_pay
from wx_bill_other_deposit
where tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
where 1=1
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
) bill
left join wx_merchant m on bill.merchant_id=m.id
left join wx_shop s on bill.shop_id=s.id
where 1=1
<if test=" null != tenantId ">
and bill.tenant_id=#{tenantId}
<if test=" null != tenantId and '' != tenantId">
and bill.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and bill.`parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != parentTenantId ">
and bill.parent_tenant_id=#{parentTenantId}
</if>
<if test=" null != month and ''!=month">
and date_format(bill.receive_date,'%Y-%m')=#{month}
</if>
@@ -196,9 +229,13 @@
select id,merchant_id,shop_id,tenant_id,parent_tenant_id,8 bill_type_value,'其他押金' bill_type,0 as
need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_other_deposit
) bill
where (bill.tenant_id=#{tenantId} or bill.parent_tenant_id=#{tenantId})
<!--<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>-->
and bill.status=#{status}
where bill.status=#{status}
<if test=" null != tenantId and '' != tenantId">
and bill.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and bill.`parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != starttime and null!= endtime ">
and bill.receive_date between #{starttime} and #{endtime}
</if>
@@ -253,9 +290,13 @@
select id,merchant_id,shop_id,tenant_id,parent_tenant_id,8 bill_type_value,'其他押金' bill_type,0 as
need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_other_deposit
) bill
where (bill.tenant_id=#{tenantId} or bill.parent_tenant_id=#{tenantId})
<!--<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>-->
and bill.status=#{status}
where bill.status=#{status}
<if test=" null != tenantId and '' != tenantId">
and bill.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and bill.`parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != starttime and null!= endtime ">
and bill.receive_date between #{starttime} and #{endtime}
</if>
@@ -281,8 +322,12 @@
price_detail,freeze,ifnull(late_pay_price,0) late_pay_price,service_charge_pay
from wx_bill_rent
where is_preview = 0
and tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
and rent_contract_id in (select id from wx_rent_contract where status in (2,3,4))
union all
select '' settle_number,id,merchant_id,shop_id,tenant_id,parent_tenant_id,'租赁押金' name,2 bill_type_value,'租赁押金'
@@ -290,8 +335,13 @@
owe,receive_date,pay_date,expired_day,status,starttime,endtime,rent_shop_type,''
price_detail,freeze,0 late_pay_price,0 service_charge_pay
from wx_bill_rent_deposit
where tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
where 1=1
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
and rent_contract_id in (select id from wx_rent_contract
where status in (2,3,4))
union all
@@ -301,8 +351,12 @@
price_detail,freeze,ifnull(late_pay_price,0) late_pay_price,service_charge_pay
from wx_bill_property
where is_preview = 0
and tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and parent_tenant_id=#{parentTenantId}</if>
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
and property_contract_id in (select id from
wx_property_contract
where status in(2,3,4))
@@ -312,8 +366,13 @@
owe,receive_date,pay_date,expired_day,status,starttime,endtime,rent_shop_type,''
price_detail,freeze,0 late_pay_price,0 service_charge_pay
from wx_bill_property_deposit
where tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
where 1=1
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
and property_contract_id in (select id from
wx_property_contract where status in
(2,3,4))
@@ -323,23 +382,37 @@
case when type=1 then '水费' when type=2 then '电费' else '空调费' end bill_type, 0 as need_pay,receive_pay,
pay,(receive_pay+service_charge_pay-pay) owe,receive_date,pay_date,expired_day,status,starttime,endtime,
rent_shop_type,price_detail,freeze,0 late_pay_price,service_charge_pay
from wx_bill_daily where tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
from wx_bill_daily where 1=1
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
union all
select '' settle_number,id,merchant_id,shop_id,tenant_id,parent_tenant_id,name,7 bill_type_vaue,'其他费用' bill_type,0 as
need_pay,receive_pay,pay,(receive_pay+service_charge_pay-pay) owe,receive_date,pay_date,expired_day,status,''
starttime,'' endtime,rent_shop_type,''
price_detail,freeze,0 late_pay_price,service_charge_pay
from wx_bill_other where tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
from wx_bill_other where 1=1
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
union all
select '' settle_number,id,merchant_id,shop_id,tenant_id,parent_tenant_id,comments as name,8 bill_type_value,'其他押金' bill_type,0 as
need_pay,receive_pay,pay,(receive_pay+service_charge_pay-pay) owe,receive_date,pay_date,expired_day,status,''
starttime,'' endtime,rent_shop_type,''
price_detail,freeze,0 late_pay_price,service_charge_pay
from wx_bill_other_deposit where tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>

from wx_bill_other_deposit where 1=1
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
union all
select s.settle_number,s.id,s.merchant_id,'' shop_id,s.tenant_id,parent_tenant_id,'结算单' name, 10 bill_type_value,'结算单' bill_type,0 need_pay,
((select IFNULL(sum(bill.owe),0) from wx_bill_settle_bill bb left join
@@ -441,9 +514,13 @@
,0 pay,0 owe,s.createtime receive_date,'' pay_date,0 expired_day,
status,'' starttime,'' endtime,'' rent_shop_type,'' price_detail, 0 freeze,
0 late_pay_price,0 service_charge_pay
from wx_bill_settle s where s.tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and s.`parent_tenant_id` = #{parentTenantId} </if>
and s.status >0
from wx_bill_settle s where s.status >0
<if test=" null != tenantId and '' != tenantId">
and s.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and s.`parent_tenant_id` = #{parentTenantId}
</if>

) bill
left join wx_merchant m on bill.merchant_id=m.id
@@ -454,12 +531,12 @@
<if test=" null != id ">
and bill.id=#{id}
</if>
<if test=" null != tenantId ">
and bill.tenant_id=#{tenantId}
<if test=" null != tenantId and '' != tenantId">
and bill.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and bill.`parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != parentTenantId ">
and bill.parent_tenant_id=#{parentTenantId}
</if>
<if test=" null != merchantId ">
and bill.merchant_id=#{merchantId}
</if>
@@ -777,16 +854,25 @@
select id,merchant_id,shop_id,tenant_id,parent_tenant_id,'租金' name,1 bill_type_value,'租金'
bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d')
receive_date,pay_date,expired_day,status,'' starttime,''
endtime,rent_shop_type,late_pay_price,service_charge_pay from wx_bill_rent where tenant_id = #{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
and is_preview = 0
endtime,rent_shop_type,late_pay_price,service_charge_pay from wx_bill_rent
where is_preview = 0
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<include refid="getOweBillAsPageConditions"/>
union all
select id,merchant_id,shop_id,tenant_id,parent_tenant_id,'物业费' name,3 bill_type_value,'物业费'
bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,''
endtime,rent_shop_type,late_pay_price,service_charge_pay from wx_bill_property where tenant_id = #{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
and is_preview = 0
endtime,rent_shop_type,late_pay_price,service_charge_pay from wx_bill_property where is_preview = 0
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<include refid="getOweBillAsPageConditions"/>
union all
select res.id,res.merchant_id,res.shop_id,res.tenant_id,res.parent_tenant_id,res.name,res.bill_type_value,res.bill_type,res.need_pay,
@@ -795,21 +881,36 @@
late_pay_price,0 service_charge_pay from(
select id,merchant_id,shop_id,tenant_id,parent_tenant_id,'欠缴押金' name,2 bill_type_value,'欠缴押金'
bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,''
endtime,rent_shop_type,service_charge_pay from wx_bill_rent_deposit where tenant_id = #{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
endtime,rent_shop_type,service_charge_pay from wx_bill_rent_deposit where 1=1
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<include refid="getOweBillAsPageConditions"/>
union all
select id,merchant_id,shop_id,tenant_id,parent_tenant_id,'欠缴押金' name,4 bill_type_value,'欠缴押金'
bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,''
endtime,rent_shop_type,0 service_charge_pay from wx_bill_property_deposit where tenant_id = #{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
endtime,rent_shop_type,0 service_charge_pay from wx_bill_property_deposit where 1=1
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<include refid="getOweBillAsPageConditions"/>
union all
select id,merchant_id,shop_id,tenant_id,parent_tenant_id,'欠缴押金' name,8 bill_type_value,'欠缴押金' bill_type,0 as
need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,
pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type,service_charge_pay
from wx_bill_other_deposit where tenant_id = #{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
from wx_bill_other_deposit where 1=1
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<include refid="getOweBillAsPageConditions"/>
) res
union all
@@ -820,16 +921,25 @@
select id,merchant_id,shop_id,tenant_id,parent_tenant_id,'其他费用' name,5 bill_type_value,'其他费用' bill_type,0 as
need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,
expired_day,status,'' starttime,'' endtime,rent_shop_type,service_charge_pay
from wx_bill_daily where tenant_id = #{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
and type in(1,2,3)
from wx_bill_daily where type in(1,2,3)
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<include refid="getOweBillAsPageConditions"/>
union all
select id,merchant_id,shop_id,tenant_id,parent_tenant_id,'其他费用' name,7 bill_type_value,'其他费用' bill_type,0 as
need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,
expired_day,status,'' starttime,'' endtime,rent_shop_type,service_charge_pay
from wx_bill_other where tenant_id = #{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
from wx_bill_other where 1=1
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<include refid="getOweBillAsPageConditions"/>
) res

@@ -841,8 +951,13 @@

) bill
left join wx_merchant m on bill.merchant_id=m.id
where m.tenant_id = #{tenantId}
<if test=" null != parentTenantId "> and m.`parent_tenant_id` = #{parentTenantId} </if>
where 1=1
<if test=" null != tenantId and '' != tenantId">
and m.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and m.`parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != merchantName and '' != merchantName">and m.name like concat('%', #{merchantName},'%')</if>
<if test=" null != sortColumns"> order by ${sortColumns} </if>
<if test=" null == sortColumns"> order by totalOwe desc </if>
@@ -950,8 +1065,12 @@
where m.status=1
) tt where 1=1

<if test=" null != tenantId"> and tt.tenant_id = #{tenantId} </if>
<if test=" null != parentTenantId "> and tt.`parent_tenant_id` = #{parentTenantId} </if>
<if test=" null != tenantId and '' != tenantId">
and tt.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and tt.`parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != merchantId"> and tt.id = #{merchantId} </if>
<if test=" null != merchantName and ''!=merchantName">and tt.name like concat('%', #{merchantName},'%')</if>
<if test=" null != rentShopType"> and tt.rent_shop_type = #{rentShopType} </if>
@@ -971,22 +1090,37 @@
billType,need_pay,receive_pay receivePay,pay,owe,receive_date receiveDate,pay_date,expired_day,status,freeze,0
late_pay_price,0
service_charge_pay
from wx_bill_rent_deposit where tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
from wx_bill_rent_deposit where 1=1
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
union all
select id,merchant_id,shop_id,tenant_id,parent_tenant_id,'物业押金' name,4 billTypeValue,'物业押金'
billType,need_pay,receive_pay receivePay,pay,owe,receive_date receiveDate,pay_date,expired_day,status,freeze,0
late_pay_price,0
service_charge_pay
from wx_bill_property_deposit where tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
from wx_bill_property_deposit where 1=1
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
union all
select id,merchant_id,shop_id,tenant_id,parent_tenant_id,comments as name,8 billTypeValue,concat('其他押金-',comments) as
billType,0 as need_pay,receive_pay receivePay,pay,owe,receive_date
receiveDate,pay_date,expired_day,status,freeze,0
late_pay_price,service_charge_pay
from wx_bill_other_deposit where tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
from wx_bill_other_deposit where 1=1
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
) bill
where 1=1
<if test=" null != freeze"> and bill.freeze = #{freeze} </if>


+ 7
- 3
mallinkService/src/main/resources/mapper/WxBillDailyMapper.xml View File

@@ -46,9 +46,13 @@
<if test=" null != receiveDate "> and `receive_date` = #{receiveDate} </if>
<if test=" null != payDate "> and `pay_date` = #{payDate} </if>
<if test=" null != createtime "> and `createtime` = #{createtime} </if>
<if test=" null != expiredDay "> and `expired_day` = #{expiredDay} </if>
<if test=" null != tenantId "> and `tenant_id` = #{tenantId} </if>
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
<if test=" null != expiredDay "> and `expired_day` = #{expiredDay} </if>
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != owe "> and `owe` = #{owe} </if>
<if test=" null != status "> and `status` = #{status} </if>
<if test=" null != isDel "> and `is_del` = #{isDel} </if>


+ 77
- 24
mallinkService/src/main/resources/mapper/WxBillDepositMapper.xml View File

@@ -39,8 +39,12 @@
<sql id="dynamicWhereConditions">
where 1 = 1
<if test=" null != id "> and `id` = #{id} </if>
<if test=" null != tenantId "> and `tenant_id` = #{tenantId} </if>
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != rentContractId "> and `rent_contract_id` = #{rentContractId} </if>
<if test=" null != receivePay "> and `receive_pay` = #{receivePay} </if>
<if test=" null != pay "> and `pay` = #{pay} </if>
@@ -83,8 +87,12 @@
<if test=" null != id ">and br.`id` = #{id}</if>
<if test=" null != merchantId ">and br.`merchant_id` = #{merchantId}</if>
<if test=" null != merchantName and ''!=merchantName ">and m.`name` like concat('%',#{merchantName},'%')</if>
<if test=" null != tenantId ">and br.`tenant_id` = #{tenantId}</if>
<if test=" null != parentTenantId "> and br.`parent_tenant_id` = #{parentTenantId} </if>
<if test=" null != tenantId and '' != tenantId">
and br.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and br.`parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != status ">and br.`status` = #{status}</if>
<if test=" null != isDel ">and br.`is_del` = #{isDel}</if>
<if test=" null != rentShopType ">and br.`rent_shop_type` = #{rentShopType}</if>
@@ -96,8 +104,13 @@

<select id="queryPayInfo" resultType="hashmap" parameterType="hashmap">
select IFNULL(sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id,parent_tenant_id from wx_bill_rent_deposit
where tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
where 1=1
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
and date_format(receive_date,'%Y-%m')=#{receiveDate}
group by tenant_id,parent_tenant_id
</select>
@@ -106,18 +119,33 @@
select round(sum(res.receivepay)/100,2) receivepay,round(sum(res.pay)/100,2) pay,res.tenant_id from
(
select IFNULL(sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id from wx_bill_rent_deposit
where tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
where 1=1
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
and receive_date between #{startdate} and #{enddate}
union all
select IFNULL(sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id from wx_bill_property_deposit
where tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
where 1=1
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
and receive_date between #{startdate} and #{enddate}
union all
select IFNULL(sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id from wx_bill_other_deposit
where tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
where 1=1
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
and receive_date between #{startdate} and #{enddate}
) res
</select>
@@ -126,36 +154,61 @@
select IFNULL(round(sum(res.owe)/100,2),0) owe,res.tenant_id from
(
select IFNULL(sum(owe),0) owe,tenant_id from wx_bill_rent_deposit
where status = 1 and tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
where status = 1
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
and receive_date between #{startdate} and #{enddate}
union all
select IFNULL(sum(owe),0) owe,tenant_id from wx_bill_property_deposit
where status = 1 and tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
where status = 1
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
and receive_date between #{startdate} and #{enddate}
union all
select IFNULL(sum(owe),0) owe,tenant_id from wx_bill_other_deposit
where status = 1 and tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
where status = 1
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
and receive_date between #{startdate} and #{enddate}
) res
</select>

<update id="updateNotPaidStatus" parameterType="hashmap">
update wx_bill_rent_deposit set status=#{notPaid},expired_day=DATEDIFF(now(),receive_date)
where tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
and status!=#{paid} and status!=5 and DATEDIFF(now(),receive_date)>0
where status!=#{paid}
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
and status!=5 and DATEDIFF(now(),receive_date)>0
</update>

<update id="updateWaitPayStatus" parameterType="hashmap">
update wx_bill_rent_deposit set status=#{waitPay} where id in(
select a.id from (select br.id,rc.receive_period,br.rent_contract_id,br.receive_date from wx_bill_rent_deposit br
left join wx_rent_contract rc on br.rent_contract_id=rc.id
where br.tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and br.`parent_tenant_id` = #{parentTenantId} </if>
and br.status!=#{paid} and br.status!=5 and now() &lt; br.receive_date
where br.status!=#{paid}
<if test=" null != tenantId and '' != tenantId">
and br.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and br.`parent_tenant_id` = #{parentTenantId}
</if>
and br.status!=5 and now() &lt; br.receive_date
and DATE_ADD(now(),INTERVAL 1 MONTH)>br.receive_date) a)
</update>



+ 21
- 7
mallinkService/src/main/resources/mapper/WxBillOtherDepositMapper.xml View File

@@ -41,8 +41,12 @@
<sql id="dynamicWhereConditions">
where 1 = 1
<if test=" null != id ">and `id` = #{id}</if>
<if test=" null != tenantId ">and `tenant_id` = #{tenantId}</if>
<if test=" null != parentTenantId ">and `parent_tenant_id` = #{parentTenantId}</if>
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != receivePay ">and `receive_pay` = #{receivePay}</if>
<if test=" null != pay ">and `pay` = #{pay}</if>
<if test=" null != receiveDate ">and `receive_date` = #{receiveDate}</if>
@@ -103,15 +107,25 @@
<update id="updateNotPaidStatus" parameterType="hashmap">
update wx_bill_other_deposit set status=#{notPaid},expired_day=DATEDIFF(now(),receive_date)
where tenant_id=#{tenantId}
<if test=" null != parentTenantId ">and `parent_tenant_id` = #{parentTenantId}</if>
and status!=#{paid} and status!=5 and DATEDIFF(now(),receive_date)>0
where status!=#{paid}
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
and status!=5 and DATEDIFF(now(),receive_date)>0
</update>
<update id="updateWaitPayStatus" parameterType="hashmap">
update wx_bill_other_deposit set status=#{waitPay}
where tenant_id=#{tenantId}
<if test=" null != parentTenantId ">and `parent_tenant_id` = #{parentTenantId}</if>
where 1=1
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
and status!=5
and status!=#{paid} and DATEDIFF(now(),receive_date) &lt;=0
</update>


+ 50
- 16
mallinkService/src/main/resources/mapper/WxBillOtherMapper.xml View File

@@ -40,8 +40,12 @@
<sql id="dynamicWhereConditions">
where 1 = 1
<if test=" null != id "> and `id` = #{id} </if>
<if test=" null != tenantId "> and `tenant_id` = #{tenantId} </if>
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != receivePay "> and `receive_pay` = #{receivePay} </if>
<if test=" null != pay "> and `pay` = #{pay} </if>
<if test=" null != receiveDate "> and `receive_date` = #{receiveDate} </if>
@@ -102,14 +106,24 @@

<update id="updateNotPaidStatus" parameterType="hashmap">
update wx_bill_other set status=#{notPaid},expired_day=DATEDIFF(now(),receive_date)
where tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
where 1=1
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
and status!=#{paid} and DATEDIFF(now(),receive_date)>0
</update>

<update id="updateWaitPayStatus" parameterType="hashmap">
update wx_bill_other set status=#{waitPay} where tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
update wx_bill_other set status=#{waitPay} where 1=1
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
and status!=#{paid} and DATEDIFF(now(),receive_date) &lt;=0
</update>

@@ -118,13 +132,23 @@
select round(sum(t.receivepay)/100,2) receivepay,round(sum(t.pay)/100,2) pay from
(
select IFNULL(sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id from wx_bill_other
where tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
where 1=1
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
and receive_date between #{startdate} and #{enddate}
union
select IFNULL(sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id from wx_bill_daily
where tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
where 1=1
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
and receive_date between #{startdate} and #{enddate}
) t
</select>
@@ -134,14 +158,24 @@
select IFNULL(round(sum(res.owe)/100,2),0) owe,res.tenant_id from
(
select IFNULL(sum(owe),0) owe,tenant_id from wx_bill_daily
where tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
and receive_date between #{startdate} and #{enddate} and status = 1
where status = 1
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
and receive_date between #{startdate} and #{enddate}
union all
select IFNULL(sum(owe),0) owe,tenant_id from wx_bill_daily
where tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
and receive_date between #{startdate} and #{enddate} and status = 1
where status = 1
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
and receive_date between #{startdate} and #{enddate}
) res
</select>



+ 35
- 13
mallinkService/src/main/resources/mapper/WxBillPropertyDepositMapper.xml View File

@@ -39,8 +39,12 @@
<sql id="dynamicWhereConditions">
where 1 = 1
<if test=" null != id "> and `id` = #{id} </if>
<if test=" null != tenantId "> and `tenant_id` = #{tenantId} </if>
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != propertyContractId "> and `property_contract_id` = #{propertyContractId} </if>
<if test=" null != receivePay "> and `receive_pay` = #{receivePay} </if>
<if test=" null != pay "> and `pay` = #{pay} </if>
@@ -84,8 +88,12 @@
left join wx_shop s on br.shop_id=s.id
<where>
<if test=" null != id ">and br.`id` = #{id}</if>
<if test=" null != tenantId ">and br.`tenant_id` = #{tenantId}</if>
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
<if test=" null != tenantId and '' != tenantId">
and br.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and br.`parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != merchantId ">and br.`merchant_id` = #{merchantId}</if>
<if test=" null != merchantName and ''!=merchantName ">and m.`name` like concat('%',#{merchantName},'%')</if>
<if test=" null != status ">and br.`status` = #{status}</if>
@@ -100,26 +108,40 @@
<select id="queryPayInfo" resultType="hashmap" parameterType="hashmap">
select IFNULL((sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id from wx_bill_property_deposit
where tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
and date_format(receive_date,'%Y-%m')=#{receiveDate}
where date_format(receive_date,'%Y-%m')=#{receiveDate}
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
group by tenant_id
</select>
<update id="updateNotPaidStatus" parameterType="hashmap">
update wx_bill_property_deposit set status=#{notPaid},expired_day=DATEDIFF(now(),receive_date)
where tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
and status!=#{paid} and status!=5 and DATEDIFF(now(),receive_date)>0
where status!=#{paid}
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
and status!=5 and DATEDIFF(now(),receive_date)>0
</update>
<update id="updateWaitPayStatus" parameterType="hashmap">
update wx_bill_property_deposit set status=#{waitPay} where id in(
select a.id from (select br.id,rc.receive_period,br.property_contract_id,br.receive_date from wx_bill_property_deposit br
left join wx_property_contract rc on br.property_contract_id=rc.id
where br.tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and br.`parent_tenant_id` = #{parentTenantId} </if>
and br.status!=#{paid} and br.status!=5 and now() &lt; br.receive_date
where br.status!=#{paid}
<if test=" null != tenantId and '' != tenantId">
and br.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and br.`parent_tenant_id` = #{parentTenantId}
</if>
and br.status!=5 and now() &lt; br.receive_date
and DATE_ADD(now(),INTERVAL 1 MONTH)>br.receive_date) a)
</update>



+ 48
- 18
mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml View File

@@ -56,8 +56,12 @@
<sql id="dynamicWhereConditions">
where 1=1
<if test=" null != id ">and `id` = #{id}</if>
<if test=" null != tenantId ">and `tenant_id` = #{tenantId}</if>
<if test=" null != parentTenantId ">and `parent_tenant_id` = #{parentTenantId}</if>
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != propertyContractId ">and `property_contract_id` = #{propertyContractId}</if>
<if test=" null != receivePay ">and `receive_pay` = #{receivePay}</if>
<if test=" null != pay ">and `pay` = #{pay}</if>
@@ -128,27 +132,40 @@

<select id="queryPayInfo" resultType="hashmap" parameterType="hashmap">
select IFNULL(sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id from wx_bill_property
where tenant_id=#{tenantId}
<if test=" null != parentTenantId ">and `parent_tenant_id` = #{parentTenantId}</if>
where is_preview = 0 and status!=6
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
and receive_date between #{startdate} and #{enddate}
and is_preview = 0 and status!=6
group by tenant_id, parent_tenant_id
</select>


<select id="queryPayInfoTotal" resultType="hashmap" parameterType="hashmap">
select IFNULL(sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id from wx_bill_property
where tenant_id=#{tenantId}
<if test=" null != parentTenantId ">and `parent_tenant_id` = #{parentTenantId}</if>
and receive_date between #{startdate} and #{enddate}
where receive_date between #{startdate} and #{enddate}
and is_preview = 0 and status!=6
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
</select>


<select id="queryOweInfo" resultType="hashmap" parameterType="hashmap">
select IFNULL(sum(owe),0) owe,tenant_id from wx_bill_property
where status = 1 and tenant_id=#{tenantId}
<if test=" null != parentTenantId ">and `parent_tenant_id` = #{parentTenantId}</if>
where status = 1
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
and receive_date between #{startdate} and #{enddate}
and is_preview = 0
</select>
@@ -156,10 +173,14 @@
<update id="updateNotPaidStatus" parameterType="hashmap">
update wx_bill_property b set b.status=#{notPaid},b.expired_day=
DATEDIFF(now(), b.receive_date)
where b.tenant_id=#{tenantId}
<if test=" null != parentTenantId ">and `parent_tenant_id` = #{parentTenantId}</if>
and b.status!=#{paid} and b.status!=6
where b.status!=#{paid} and b.status!=6
and DATEDIFF(now(), b.receive_date) >0
<if test=" null != tenantId and '' != tenantId">
and b.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and b.`parent_tenant_id` = #{parentTenantId}
</if>
</update>

<update id="updateWaitPayStatus" parameterType="hashmap">
@@ -168,8 +189,13 @@
select br.id,rc.receive_period,br.property_contract_id,br.receive_date
from wx_bill_property br
left join wx_property_contract rc on br.property_contract_id=rc.id
where br.tenant_id=#{tenantId}
<if test=" null != parentTenantId ">and `parent_tenant_id` = #{parentTenantId}</if>
where 1=1
<if test=" null != tenantId and '' != tenantId">
and br.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and br.`parent_tenant_id` = #{parentTenantId}
</if>
and br.status!=#{paid} and br.status != 6 and now() &lt; br.receive_date
and DATE_ADD(now(),INTERVAL 1 MONTH)>br.receive_date) a)
</update>
@@ -294,9 +320,13 @@
<update id="updateServiceCharge" parameterType="com.iformall.domain.po.WxPayAccountBill">
update wx_bill_property
set service_charge_pay=round(receive_pay*#{serviceChargeRate}/10000),owe=receive_pay + service_charge_pay + ifnull(late_pay_price,0) - pay
where tenant_id=#{tenantId}
<if test=" null != parentTenantId ">and `parent_tenant_id` = #{parentTenantId}</if>
and service_charge_pay=0 and status in(1,2,4)
where service_charge_pay=0 and status in(1,2,4)
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
</update>

<update id="updateOwe">


+ 43
- 16
mallinkService/src/main/resources/mapper/WxBillRentMapper.xml View File

@@ -62,8 +62,12 @@
<sql id="dynamicWhereConditions">
where 1=1
<if test=" null != id ">and `id` = #{id}</if>
<if test=" null != tenantId ">and `tenant_id` = #{tenantId}</if>
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != rentContractId ">and `rent_contract_id` = #{rentContractId}</if>
<if test=" null != receivePay ">and `receive_pay` = #{receivePay}</if>
<if test=" null != pay ">and `pay` = #{pay}</if>
@@ -139,45 +143,68 @@

<select id="queryPayInfo" resultType="hashmap" parameterType="hashmap">
select IFNULL(sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id from wx_bill_rent
where (tenant_id=#{tenantId} or tenant_id = #{parentTenantId})
<!--<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>-->
where is_preview = 0
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
and receive_date between #{startdate} and #{enddate}
and is_preview = 0 and status!=6
and status!=6
group by tenant_id
</select>

<select id="queryPayInfoTotal" resultType="hashmap" parameterType="hashmap">
select IFNULL(sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id from wx_bill_rent
where tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
and receive_date between #{startdate} and #{enddate}
where receive_date between #{startdate} and #{enddate}
and is_preview = 0 and status!=6
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
</select>


<select id="queryOweInfo" resultType="hashmap" parameterType="hashmap">
select IFNULL(sum(owe),0) owe,tenant_id from wx_bill_rent
where status = 1 and tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
where status = 1
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
and receive_date between #{startdate} and #{enddate} and is_preview = 0
</select>

<update id="updateNotPaidStatus" parameterType="hashmap">
update wx_bill_rent b set b.status=#{notPaid},b.expired_day=
DATEDIFF(now(), b.receive_date)
where b.tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and b.`parent_tenant_id` = #{parentTenantId} </if>
and b.status!=#{paid} and b.status!=6 and
where b.status!=#{paid} and b.status!=6 and
DATEDIFF(now(), b.receive_date) >0
<if test=" null != tenantId and '' != tenantId">
and b.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and b.`parent_tenant_id` = #{parentTenantId}
</if>
</update>

<update id="updateWaitPayStatus" parameterType="hashmap">
update wx_bill_rent set status=#{waitPay} where id in(
select a.id from (select br.id,rc.receive_period,br.rent_contract_id,br.receive_date from wx_bill_rent br
left join wx_rent_contract rc on br.rent_contract_id=rc.id
where br.tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and br.`parent_tenant_id` = #{parentTenantId} </if>
and br.status!=#{paid} and br.status!=6 and now() &lt; br.receive_date
where br.status!=#{paid}
<if test=" null != tenantId and '' != tenantId">
and br.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and br.`parent_tenant_id` = #{parentTenantId}
</if>
and br.status!=6 and now() &lt; br.receive_date
and DATE_ADD(now(),INTERVAL 1 MONTH)>br.receive_date) a)
</update>



+ 6
- 2
mallinkService/src/main/resources/mapper/WxBillSettleBillMapper.xml View File

@@ -110,8 +110,12 @@
on(bl.bill_id = bill.id)
where 1=1
<if test=" null != billId ">and bill.`id` = #{billId}</if>
<if test=" null != tenantId ">and bl.`tenant_id` = #{tenantId}</if>
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
<if test=" null != tenantId and '' != tenantId">
and bl.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and bl.`parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != settleId ">and bl.`settle_id` = #{settleId}</if>
<if test=" null != type ">and bl.`type` = #{type}</if>
</select>


+ 6
- 2
mallinkService/src/main/resources/mapper/WxBillSettleMapper.xml View File

@@ -26,8 +26,12 @@
<sql id="dynamicWhereConditions">
where 1=1
<if test=" null != id ">and tt.`id` = #{id}</if>
<if test=" null != tenantId ">and tt.`tenant_id` = #{tenantId}</if>
<if test=" null != parentTenantId "> and tt.`parent_tenant_id` = #{parentTenantId} </if>
<if test=" null != tenantId and '' != tenantId">
and tt.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and tt.`parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != merchantName and merchantName !='' ">and tt.merchantName like concat('%', #{merchantName},'%')</if>
<if test="starttime != null">
and tt.createtime &gt;= #{starttime}


+ 6
- 2
mallinkService/src/main/resources/mapper/WxBillSettleRecordMapper.xml View File

@@ -27,8 +27,12 @@
<sql id="dynamicWhereConditions">
where 1=1
<if test=" null != id ">and `id` = #{id}</if>
<if test=" null != tenantId ">and `tenant_id` = #{tenantId}</if>
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != settleId ">and `settle_id` = #{settleId}</if>

<if test=" null != ids ">


+ 18
- 6
mallinkService/src/main/resources/mapper/WxBrandMapper.xml View File

@@ -24,8 +24,12 @@
<if test=" null != name "> and `name` like concat('%',#{name},'%') </if>
<if test=" null != createtime "> and `createtime` = #{createtime} </if>
<if test=" null != updatetime "> and `updatetime` = #{updatetime} </if>
<if test=" null != tenantId "> and `tenant_id` = #{tenantId} </if>
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != ids ">
and id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
@@ -43,8 +47,12 @@
<select id="queryBrandByTenant" parameterType="com.iformall.domain.po.WxBrand" resultType="hashmap">
select id,`name` value from wx_brand
<where>
<if test=" null != tenantId "> and `tenant_id` = #{tenantId} </if>
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
</where>
</select>
@@ -52,8 +60,12 @@
select count(*) from wx_brand
<where>
<if test=" null != name "> and `name` = #{name} </if>
<if test=" null != tenantId "> and `tenant_id` = #{tenantId} </if>
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != id">
and id != #{id}
</if>


+ 14
- 8
mallinkService/src/main/resources/mapper/WxBusinessMapper.xml View File

@@ -64,10 +64,13 @@
from wx_business b
where
(select count(*) from wx_merchant m
where
m.tenant_id = #{tenantId}
<if test=" null != parentTenantId ">and m.`parent_tenant_id` = #{parentTenantId}</if>
and b.id = m.business_id
where b.id = m.business_id
<if test=" null != tenantId and '' != tenantId">
and m.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and m.`parent_tenant_id` = #{parentTenantId}
</if>
and m.status = 1
and m.is_public = 1) > 0
order by create_date asc
@@ -79,10 +82,13 @@
from wx_business b
where
(select count(*) from wx_coupon_channel cc
where
cc.tenant_id = #{tenantId}
<if test=" null != parentTenantId ">and cc.`parent_tenant_id` = #{parentTenantId}</if>
and b.id = cc.business
where b.id = cc.business
<if test=" null != tenantId and '' != tenantId">
and cc.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and cc.`parent_tenant_id` = #{parentTenantId}
</if>
and cc.status = 0
and cc.target_ad = 1) > 0
order by create_date asc


+ 136
- 80
mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml View File

@@ -26,10 +26,10 @@
</resultMap>

<sql id="allColumns">
`id`,`phone`,`birthdate`,`education`,`sex`,`email`,`address`,`poins`,`tag_id`,
`create_date`,`update_date`,`tenant_id`,`name`,`nick_name`,`credit`,`active_time`,`act_record`
cub.`id`,cub.`phone`,cub.`birthdate`,cub.`education`,cub.`sex`,cub.`email`,cub.`address`,cub.`poins`,cub.`tag_id`,
cub.`create_date`,cub.`update_date`,cub.`tenant_id`,cub.`name`,cub.`nick_name`,cub.`credit`,cub.`active_time`,cub.`act_record`
,(select level from wx_level_config
where poins >= points and tenant_id=#{tenantId}
where poins >= points and tenant_id=cub.tenant_id
order by points desc limit 1 ) level,status
</sql>

@@ -37,74 +37,77 @@
where 1 = 1

<if test=" null != id ">
and `id` = #{id}
and cub.`id` = #{id}
</if>

<if test=" null != tenantId ">
and `tenant_id` = #{tenantId}
<if test=" null != tenantId and '' != tenantId">
and cub.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and cu.`parent_tenant_id` = #{parentTenantId}
</if>

<if test=" null != phone ">
and `phone` like concat('%', #{phone},'%')
and cub.`phone` like concat('%', #{phone},'%')
</if>

<if test=" null != birthdate ">
and `birthdate` = #{birthdate}
and cub.`birthdate` = #{birthdate}
</if>

<if test=" null != education ">
and `education` like concat('%', #{education},'%')
and cub.`education` like concat('%', #{education},'%')
</if>

<if test=" null != sex ">
and `sex` = #{sex}
and cub.`sex` = #{sex}
</if>

<if test=" null != email ">
and `email` like concat('%', #{email},'%')
and cub.`email` like concat('%', #{email},'%')
</if>

<if test=" null != address ">
and `address` like concat('%', #{address},'%')
and cub.`address` like concat('%', #{address},'%')
</if>

<if test=" null != poins ">
and `poins` = #{poins}
and cub.`poins` = #{poins}
</if>

<if test=" null != credit ">
and `credit` = #{credit}
and cub.`credit` = #{credit}
</if>

<if test=" null != tagId ">
and `tag_id` = #{tagId}
and cub.`tag_id` = #{tagId}
</if>

<if test=" null != createDate ">
and `create_date` = #{createDate}
and cub.`create_date` = #{createDate}
</if>

<if test=" null != updateDate ">
and `update_date` = #{updateDate}
and cub.`update_date` = #{updateDate}
</if>

<if test=" null != actRecord ">
and `act_record` = #{actRecord}
and cub.`act_record` = #{actRecord}
</if>
<if test=" null != name ">
and `name` like concat('%', #{name},'%')
and cub.`name` like concat('%', #{name},'%')
</if>
<if test=" null != startTime and null!=endTime">
and `create_date` between #{startTime} and #{endTime}
and cub.`create_date` between #{startTime} and #{endTime}
</if>
<if test=" null != status ">
and `status` = #{status}
and cub.`status` = #{status}
</if>
<if test=" null != ids ">
and id in
and cub.id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
#{idItem}
</foreach>
@@ -116,7 +119,8 @@
select r.* from (
select
<include refid="allColumns"/>
from wx_c_user_basic_info
from wx_c_user_basic_info cub
inner join wx_c_user cu on cu.id = cub.id
<include refid="dynamicWhereConditions"/>
) r where 1=1

@@ -132,81 +136,95 @@

<update id="updateScore" parameterType="com.iformall.domain.po.WxCUserBasicInfo">
update wx_c_user_basic_info set poins=#{poins}
where phone=#{phone} and tenant_id=#{tenantId}
where phone=#{phone}
and id=#{id}
</update>

<update id="updateNewId" parameterType="com.iformall.domain.vo.CUserBaseVo">
update wx_c_user_basic_info set id=#{newId} , credit=#{credit} , poins=#{poins}
where tenant_id=#{tenantId}
and id = #{id}
where id = #{id}
</update>

<select id="findCountBySex" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long">
select count(id) from wx_c_user_basic_info
where sex =#{sex}
select count(cub.id) from wx_c_user_basic_info cub
inner join wx_c_user cu on cu.id = cub.id
where cub.sex =#{sex}
<if test=" null != startTime ">
and create_date &gt;= #{startTime}
and cub.create_date &gt;= #{startTime}
</if>
<if test=" null != endTime">
and create_date &lt;= #{endTime}
and cub.create_date &lt;= #{endTime}
</if>
<if test=" null != tenantId and '' != tenantId">
and cub.`tenant_id` = #{tenantId}
</if>
<if test="null != tenantId">
and tenant_id =#{tenantId}
<if test=" null != parentTenantId and '' != parentTenantId">
and cu.`parent_tenant_id` = #{parentTenantId}
</if>

</select>


<select id="findCountByAge" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long">
select count(id) from wx_c_user_basic_info where 1=1
select count(cub.id) from wx_c_user_basic_info cub
inner join wx_c_user cu on cu.id = cub.id
where 1=1
<if test=" null != startTime ">
and create_date &gt;= #{startTime}
and cub.create_date &gt;= #{startTime}
</if>
<if test=" null != endTime">
and create_date &lt;= #{endTime}
and cub.create_date &lt;= #{endTime}
</if>

<if test=" null != birthStartTime ">
and birthdate &gt;= #{birthStartTime}
and cub.birthdate &gt;= #{birthStartTime}
</if>

<if test=" null != birthEndTime">
and birthdate &lt;= #{birthEndTime}
and cub.birthdate &lt;= #{birthEndTime}
</if>

<if test=" null == birthStartTime and null == birthEndTime">
and birthdate is null
and cub.birthdate is null
</if>

<if test="null != tenantId">
and tenant_id =#{tenantId}
<if test=" null != tenantId and '' != tenantId">
and cub.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and cu.`parent_tenant_id` = #{parentTenantId}
</if>

</select>

<select id="findCountByScore" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long">
select count(id) from wx_c_user_basic_info where 1=1
select count(cub.id) from wx_c_user_basic_info cub
inner join wx_c_user cu on cu.id = cub.id
where 1=1
<if test=" null != startTime ">
and create_date &gt;= #{startTime}
and cub.create_date &gt;= #{startTime}
</if>
<if test=" null != endTime">
and create_date &lt;= #{endTime}
and cub.create_date &lt;= #{endTime}
</if>

<if test=" null != levelStartScore ">
and poins &gt;= #{levelStartScore}
and cub.poins &gt;= #{levelStartScore}
</if>

<if test=" null != levelEndScore">
and poins &lt; #{levelEndScore}
and cub.poins &lt; #{levelEndScore}
</if>

<if test=" null == levelStartScore and null == levelEndScore">
and poins is null
and cub.poins is null
</if>

<if test="null != tenantId">
and tenant_id =#{tenantId}
<if test=" null != tenantId and '' != tenantId">
and cub.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and cu.`parent_tenant_id` = #{parentTenantId}
</if>

</select>
@@ -235,8 +253,11 @@
and cub.poins is null
</if>

<if test="null != tenantId">
and cub.tenant_id =#{tenantId}
<if test=" null != tenantId and '' != tenantId">
and cub.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and cu.`parent_tenant_id` = #{parentTenantId}
</if>

</select>
@@ -248,29 +269,37 @@
where cub.status = 0 and cu.phone is not null
AND DATE_FORMAT(cub.birthdate,'%m-%d') &gt;= #{begin}
AND DATE_FORMAT(cub.birthdate,'%m-%d') &lt;= #{end}
<if test="null != tenantId">
and cub.tenant_id = #{tenantId}
<if test=" null != tenantId and '' != tenantId">
and cub.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and cu.`parent_tenant_id` = #{parentTenantId}
</if>
</select>

<select id="findCount" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long">
select count(id) from wx_c_user_basic_info where 1=1
select count(cub.id) from wx_c_user_basic_info cub
inner join wx_c_user cu on cu.id = cub.id
where 1=1
<if test=" null != startTime ">
and create_date &gt;= #{startTime}
and cub.create_date &gt;= #{startTime}
</if>
<if test=" null != endTime">
and create_date &lt; #{endTime}
</if>
<if test="null != tenantId">
and tenant_id =#{tenantId}
and cub.create_date &lt; #{endTime}
</if>
<if test="1 == queryImport">
and create_date like '%00:00:00'
and cub.create_date like '%00:00:00'
</if>
<if test=" null != tenantId and '' != tenantId">
and cub.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and cu.`parent_tenant_id` = #{parentTenantId}
</if>
</select>

<select id="findCountHistory" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="com.iformall.domain.vo.UserCountVo">
select count(id) as incCount,
select count(cub.id) as incCount,
<if test="1 == reportType ">
date_format(create_date, '%Y-%m-%d') as reportTime,
</if>
@@ -282,35 +311,44 @@
</if>

<if test="1 == reportType or 2 == reportType or 3 == reportType">
(select count(id) from wx_c_user_basic_info
where
(select count(cubi.id) from wx_c_user_basic_info cubi
inner join wx_c_user cu1 on cu1.id = cubi.id
where 1=1
<if test="1 == reportType ">
date_format(create_date, '%Y-%m-%d') &lt;= reportTime
and cubi.date_format(cubi.create_date, '%Y-%m-%d') &lt;= cubi.reportTime
</if>
<if test="2 == reportType ">
date_format(create_date, '%Y-%m') &lt;= reportTime
and cubi.date_format(cubi.create_date, '%Y-%m') &lt;= cubi.reportTime
</if>
<if test="3 == reportType ">
date_format(create_date, '%Y') &lt;= reportTime
and cubi.date_format(cubi.create_date, '%Y') &lt;= cubi.reportTime
</if>
<if test="null != tenantId">
and tenant_id =#{tenantId}
<if test=" null != tenantId and '' != tenantId">
and cubi.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and cu1.`parent_tenant_id` = #{parentTenantId}
</if>
) as totalCount
</if>

from wx_c_user_basic_info where 1=1
<if test="null != tenantId">
and tenant_id =#{tenantId}
from wx_c_user_basic_info cub
inner join wx_c_user cu on cu.id = cub.id
where 1=1
<if test=" null != tenantId and '' != tenantId">
and cub.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and cu.`parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != startTime ">
and create_date &gt;= #{startTime}
and cub.create_date &gt;= #{startTime}
</if>
<if test=" null != endTime">
and create_date &lt; #{endTime}
and cub.create_date &lt; #{endTime}
</if>
<if test="1 == reportType or 2 == reportType or 3 == reportType">
group by reportTime
group by cub.reportTime
</if>
</select>

@@ -348,9 +386,12 @@
and cu.`id` = #{id}
</if>

<if test=" null != tenantId ">
<if test=" null != tenantId and '' != tenantId">
and cu.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and c.`parent_tenant_id` = #{parentTenantId}
</if>

<if test=" null != phone ">
and cu.`phone` like concat('%', #{phone},'%')
@@ -415,6 +456,7 @@
select
<include refid="allVoColumns"/>
from wx_c_user_basic_info cu
inner join wx_c_user c on c.id = cu.id
left join wx_c_user_tags cut on cut.`id` = cu.`tag_id`
<include refid="dynamicVoWhereConditions"/>
</select>
@@ -423,6 +465,7 @@
select
count(*)
from wx_c_user_basic_info cu
inner join wx_c_user c on c.id = cu.id
left join wx_c_user_tags cut on cut.`id` = cu.`tag_id`
<include refid="dynamicVoWhereConditions"/>
</select>
@@ -434,8 +477,12 @@

<sql id="filterWhereConditions">
where 1=1
<if test="null != tenantId">
and cu.tenant_id =#{tenantId}

<if test=" null != tenantId and '' != tenantId">
and cu.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and c.`parent_tenant_id` = #{parentTenantId}
</if>

<if test=" null != startTime ">
@@ -503,6 +550,7 @@

<select id="findCountByFilter" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long">
select count(*) from wx_c_user_basic_info cu
inner join wx_c_user c on c.id = cu.id
<if test=" null != tagIds ">
join wx_c_user_tags cut on cut.`id` = cu.`tag_id`
</if>
@@ -512,6 +560,7 @@
<select id="findListByFilter" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultMap="BaseResultMap">
select <include refid="msgColumns"/>
from wx_c_user_basic_info cu
inner join wx_c_user c on c.id = cu.id
<if test=" null != tagIds ">
join wx_c_user_tags cut on cut.`id` = cu.`tag_id`
</if>
@@ -521,15 +570,22 @@

<select id="findImportUserCount" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long">
SELECT count(*) FROM wx_c_user_basic_info cubi left join wx_c_user cu on cubi.id=cu.id where cu.id is null
<if test="null != tenantId">
and cubi.tenant_id =#{tenantId}

<if test=" null != tenantId and '' != tenantId">
and cubi.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and cu.`parent_tenant_id` = #{parentTenantId}
</if>
</select>

<select id="findGrowUserCount" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long">
SELECT count(*) FROM wx_c_user_basic_info cubi left join wx_c_user cu on cubi.id=cu.id where cu.id is not null
<if test="null != tenantId">
and cubi.tenant_id =#{tenantId}
<if test=" null != tenantId and '' != tenantId">
and cubi.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and cu.`parent_tenant_id` = #{parentTenantId}
</if>
</select>



+ 25
- 10
mallinkService/src/main/resources/mapper/WxCUserMapper.xml View File

@@ -249,8 +249,11 @@
<if test=" null != endTime">
and create_date &lt; #{endTime}
</if>
<if test="null != tenantId">
and tenant_id =#{tenantId}
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
</select>

@@ -277,15 +280,21 @@
<if test="3 == reportType ">
date_format(create_date, '%Y') &lt;= reportTime
</if>
<if test="null != tenantId">
and tenant_id =#{tenantId}
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
) as totalCount
</if>

from wx_c_user where 1=1
<if test="null != tenantId">
and tenant_id =#{tenantId}
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != startTime ">
and create_date &gt;= #{startTime}
@@ -300,8 +309,11 @@

<select id="listByChannel" resultMap="BaseResultMap" >
select id,nick_name,phone,create_date,scene_address from wx_c_user where 1=1
<if test="null != tenantId">
and tenant_id =#{tenantId}
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != startDate ">
and create_date &gt;= #{startDate}
@@ -321,8 +333,11 @@

<select id="countByChannel" resultType="java.lang.Long" >
select count(id) from wx_c_user where 1=1
<if test="null != tenantId">
and tenant_id =#{tenantId}
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != startDate ">
and create_date &gt;= #{startDate}


+ 2
- 3
mallinkService/src/main/resources/mapper/WxCampaignMapper.xml View File

@@ -52,11 +52,10 @@
and `id` = #{id}
</if>

<if test=" null != tenantId ">
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>

<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>



+ 48
- 29
mallinkService/src/main/resources/mapper/WxCarCmdLogMapper.xml View File

@@ -22,12 +22,11 @@
<if test=" null != id ">
and `id` = #{id}
</if>
<if test=" null != tenantId ">
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>

<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
@@ -69,9 +68,13 @@
<select id="queryHistory" resultType="hashmap" parameterType="hashmap">
select count(c.id) carcount,c.create_date from (
select id,DATE_FORMAT(create_date,'%Y-%m-%d') create_date
from wx_car_cmd_log where (tenant_id = #{tenantId} or parent_tenant_id = #{tenantId})
<!--<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>-->
and cmd_type=#{cmdType}
from wx_car_cmd_log where cmd_type=#{cmdType}
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
and create_date BETWEEN #{startdate} and #{enddate}
) c
group by c.create_date
@@ -80,27 +83,39 @@
<select id="queryTodayCar" resultType="hashmap" parameterType="hashmap">
select count(c.id) carcount,c.create_time from (
select id,DATE_FORMAT(DATE_ADD(create_date,INTERVAL 1 HOUR),'%H:00') create_time
from wx_car_cmd_log where tenant_id = #{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
and cmd_type=#{cmdType}
from wx_car_cmd_log where cmd_type=#{cmdType}
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
and create_date BETWEEN #{startdate} and #{enddate}
) c group by c.create_time order by c.create_time
</select>

<select id="queryWeekCarPayCount" resultType="Long" parameterType="hashmap">
select count(id)
from wx_car_cmd_log where tenant_id = #{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
and cmd_type=#{cmdType}
from wx_car_cmd_log where cmd_type=#{cmdType}
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
and create_date BETWEEN #{startdate} and #{enddate}
</select>

<select id="queryWeekCarPay" resultType="hashmap" parameterType="hashmap">
select sum(fee) fee,c.create_time from (
select id,DATE_FORMAT(create_date,'%m/%d') create_time,CONVERT(JSON_EXTRACT(cmd_json,'$.fee'), Decimal(16,2)) fee
from wx_car_cmd_log where tenant_id = #{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
and cmd_type=#{cmdType}
from wx_car_cmd_log where cmd_type=#{cmdType}
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
and REPLACE (JSON_EXTRACT(cmd_json,'$.time'),'"','') BETWEEN #{startdate} and #{enddate}
) c group by c.create_time order by c.create_time
</select>
@@ -108,12 +123,16 @@
<select id="queryForSceneRepotyHistoryCar" resultType="com.iformall.domain.vo.MarkingSceneDataVo" parameterType="hashmap">
select DATE_FORMAT(ccl.create_date,'%Y-%m-%d') xTime, count(ccl.id) triggerCount
from wx_c_user_car cuc, wx_car_cmd_log ccl
where cuc.tenant_id = #{tenantId}
<if test=" null != parentTenantId "> and cuc`parent_tenant_id` = #{parentTenantId} </if>
and ccl.tenant_id = #{tenantId}
<if test=" null != parentTenantId "> and ccl`parent_tenant_id` = #{parentTenantId} </if>
and ccl.plateNumber = cuc.car_number
and cmd_type=#{cmdType}
where ccl.plateNumber = cuc.car_number and cmd_type=#{cmdType}
<if test=" null != tenantId and '' != tenantId">
and cuc.`tenant_id` = #{tenantId}
and ccl.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and cuc.`parent_tenant_id` = #{parentTenantId}
and ccl.`parent_tenant_id` = #{parentTenantId}
</if>

<if test=" null != startTime and null != endTime">
and create_date BETWEEN #{startTime} and #{endTime}
</if>
@@ -141,11 +160,11 @@
<select id="queryByOrderId" parameterType="com.iformall.domain.po.WxCarCmdLog" resultType="com.iformall.domain.po.WxCarCmdLog">
select *
from wx_car_cmd_log
where
<if test=" null != tenantId">
and tenant_id = #{tenantId}
where 1=1
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != cmdType">
@@ -169,10 +188,10 @@
select *
from wx_car_cmd_log
where 1=1
<if test=" null != tenantId">
and tenant_id = #{tenantId}
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != plateNumber">


+ 2
- 2
mallinkService/src/main/resources/mapper/WxCarPayRecordMapper.xml View File

@@ -51,10 +51,10 @@
<if test=" null != feeTime ">
and TIMESTAMPDIFF(MINUTE, `fee_time`, #{feeTime}) &lt;= 15
</if>
<if test=" null != tenantId ">
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>



+ 4
- 4
mallinkService/src/main/resources/mapper/WxCardInfoMapper.xml View File

@@ -32,10 +32,10 @@
<if test=" null != id ">
and `id` = #{id}
</if>
<if test=" null != tenantId ">
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != couponId ">
@@ -138,10 +138,10 @@
<if test=" null != id ">
and ci.`id` = #{id}
</if>
<if test=" null != tenantId ">
<if test=" null != tenantId and '' != tenantId">
and ci.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and ci.`parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != couponId ">


+ 12
- 12
mallinkService/src/main/resources/mapper/WxCardSpendMapper.xml View File

@@ -35,10 +35,10 @@
<if test=" null != id ">
and `id` = #{id}
</if>
<if test=" null != tenantId ">
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != cardId ">
@@ -113,10 +113,10 @@
update wx_card_spend
set `pay_status` = #{payStatus}, `update_date` = #{updateDate}
<where>
<if test=" null != tenantId ">
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != startdate and null!=enddate">
@@ -151,10 +151,10 @@
<if test=" null != ownerId ">
and cs.`owner_id` = #{ownerId}
</if>
<if test=" null != tenantId ">
<if test=" null != tenantId and '' != tenantId">
and cs.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and cs.`parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != startdate and null!=enddate">
@@ -197,10 +197,10 @@
<if test=" null != ownerId ">
and cs.`owner_id` = #{ownerId}
</if>
<if test=" null != tenantId ">
<if test=" null != tenantId and '' != tenantId">
and cs.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and cs.`parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != startdate and null!=enddate">
@@ -246,10 +246,10 @@
<if test=" null != ownerId ">
and cs.`owner_id` = #{ownerId}
</if>
<if test=" null != tenantId ">
<if test=" null != tenantId and '' != tenantId">
and cs.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and cs.`parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != startdate and null!=enddate">
@@ -332,10 +332,10 @@
<if test=" null != id ">
and cs.`id` = #{id}
</if>
<if test=" null != tenantId ">
<if test=" null != tenantId and '' != tenantId">
and cs.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and cs.`parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != cardId ">


+ 96
- 40
mallinkService/src/main/resources/mapper/WxCouponActionLogMapper.xml View File

@@ -24,11 +24,10 @@

</if>

<if test=" null != tenantId ">
and `tenant_id` = #{tenantId}
</if>

<if test=" null != parentTenantId ">
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>

@@ -83,14 +82,22 @@
(select Count(*) from wx_coupon_action_log c
where DATE_FORMAT(create_time,'%m/%d')=xTime
and c.channel_type=2
and tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
) as parkSendCount,
(select Count(*) from wx_coupon_action_log c
where DATE_FORMAT(create_time,'%m/%d')=xTime
and c.channel_type=3
and tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
) as verifySendCount,
(select Count(*) from wx_coupon_action_log c
where DATE_FORMAT(create_time,'%m/%d')=xTime
@@ -99,13 +106,21 @@
(select Count(*) from wx_coupon_action_log c
where DATE_FORMAT(create_time,'%m/%d')=xTime
and c.channel_type=5
and tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
) as orderSendCount
from wx_coupon_action_log
where tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
and channel_type in (2,3,4,5)
where channel_type in (2,3,4,5)
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
and create_time &gt;= #{startTime}
and create_time &lt;= #{endTime}
group by xTime
@@ -115,9 +130,13 @@
<select id="getSceneDataMap" resultType="com.iformall.domain.vo.MarkingSceneDataReportTVo" parameterType="hashmap">
select create_time_md as xTime, channel_type, count(create_time_md + '' + channel_type) as count
from wx_coupon_action_log
where tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
and channel_type in (2,3,4,5)
where channel_type in (2,3,4,5)
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
and create_time &gt;= #{startTime}
and create_time &lt;= #{endTime}
group by create_time_md, channel_type
@@ -127,8 +146,13 @@
<update id="updateCreateTimeMd" parameterType="hashmap">
update wx_coupon_action_log
set create_time_md = DATE_FORMAT(create_time,'%m/%d')
where tenant_id = #{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
where 1=1
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
</update>

<select id="sceneDataMapJoinCouponOrder" resultType="com.iformall.domain.vo.MarkingSceneDataReportVo" parameterType="hashmap">
@@ -136,9 +160,13 @@
COUNT(wx_coupon_order.id) as tempCount
from wx_coupon_action_log
left join wx_coupon_order on wx_coupon_action_log.coupon_order_id=wx_coupon_order.id
where wx_coupon_action_log.tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and wx_coupon_action_log.`parent_tenant_id` = #{parentTenantId} </if>
----- and wx_coupon_order.coupon_order_status = 1 ----
where 1=1
<if test=" null != tenantId and '' != tenantId">
and wx_coupon_action_log.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and wx_coupon_action_log.`parent_tenant_id` = #{parentTenantId}
</if>
and wx_coupon_action_log.create_time &gt;= #{startTime}
and wx_coupon_action_log.create_time &lt;= #{endTime}
and wx_coupon_action_log.channel_type = #{channelType}
@@ -150,9 +178,13 @@
select DATE_FORMAT(create_time,'%Y-%m-%d') as xtime,
Count(*) as sendCount
from wx_coupon_action_log
where tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
and channel_type=#{channelType}
where channel_type=#{channelType}
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != startTime ">
and create_time &gt;= #{startTime}
</if>
@@ -170,9 +202,13 @@
COUNT(co.id) as tempCount
from wx_coupon_action_log cal
left join wx_coupon_order co on cal.coupon_order_id=co.id
where cal.tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and cal.`parent_tenant_id` = #{parentTenantId} </if>
and co.coupon_order_status = 1
where co.coupon_order_status = 1
<if test=" null != tenantId and '' != tenantId">
and cal.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and cal.`parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != startTime ">
and cal.create_time &gt;= #{startTime}
</if>
@@ -187,28 +223,40 @@

<select id="getCountByDateLimit" resultType="java.lang.Integer">
select COUNT(*) FROM wx_coupon_action_log
where tenant_id = #{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
and `channel_type` != 0
where `channel_type` != 0
and `channel_type` != 1
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
and `create_time` &gt;= #{startTime}
and `create_time` &lt;= #{endTime}
</select>

<select id="getCountByChannelId" resultType="java.lang.Integer">
select COUNT(*) FROM wx_coupon_action_log
where tenant_id = #{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
and channel_type = #{channelType}
where channel_type = #{channelType}
and channel_id = #{channelId}
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
</select>

<select id="getCountByUser" resultType="java.lang.Integer" parameterType="hashmap">
select COUNT(*)
FROM wx_coupon_action_log a, wx_coupon_order o
WHERE a.coupon_order_id = o.id
AND a.tenant_id = #{tenantId}
<if test=" null != parentTenantId "> and a.`parent_tenant_id` = #{parentTenantId} </if>
<if test=" null != tenantId and '' != tenantId">
and a.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and a.`parent_tenant_id` = #{parentTenantId}
</if>
AND o.c_user_id = #{cUserId}
AND date(a.create_time) = curdate()
</select>
@@ -217,8 +265,12 @@
select COUNT(*)
FROM wx_coupon_action_log a, wx_coupon_order o
WHERE a.coupon_order_id = o.id
AND a.tenant_id = #{tenantId}
<if test=" null != parentTenantId "> and a.`parent_tenant_id` = #{parentTenantId} </if>
<if test=" null != tenantId and '' != tenantId">
and a.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and a.`parent_tenant_id` = #{parentTenantId}
</if>
AND o.c_user_id = #{cUserId}
AND a.coupon_id = #{couponId}
AND date(a.create_time) between date_sub(curdate(),interval #{dayNum} day) and curdate()
@@ -228,8 +280,12 @@
select COUNT(*)
FROM wx_coupon_action_log a, wx_coupon_order o
WHERE a.coupon_order_id = o.id
AND a.tenant_id = #{tenantId}
<if test=" null != parentTenantId "> and a.`parent_tenant_id` = #{parentTenantId} </if>
<if test=" null != tenantId and '' != tenantId">
and a.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and a.`parent_tenant_id` = #{parentTenantId}
</if>
AND o.c_user_id = #{cUserId}
<if test=" null != couponId ">
AND a.coupon_id = #{couponId}


+ 6
- 7
mallinkService/src/main/resources/mapper/WxCouponCarMapper.xml View File

@@ -22,15 +22,14 @@
<if test=" null != id ">
and `id` = #{id}
</if>
<if test=" null != tenantId ">
and `tenant_id` = #{tenantId}
</if>
</if>

<if test=" null != parentTenantId ">
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
</if>
<if test=" null != parkId ">
and `park_id` = #{parkId}


+ 4
- 5
mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml View File

@@ -40,13 +40,12 @@
and cc.`id` = #{id}
</if>

<if test=" null != tenantId ">
and (cc.`tenant_id` = #{tenantId} or cc.`parent_tenant_id` = #{tenantId})
<if test=" null != tenantId and '' != tenantId">
and cc.`tenant_id` = #{tenantId}
</if>

<!--<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and cc.`parent_tenant_id` = #{parentTenantId}
</if>-->
</if>

<if test=" null != couponId ">
and cc.`coupon_id` = #{couponId}


+ 7
- 8
mallinkService/src/main/resources/mapper/WxCouponInjectMapper.xml View File

@@ -31,15 +31,14 @@
<if test=" null != id ">
and `id` = #{id}
</if>
<if test=" null != tenantId ">
and `tenant_id`= #{tenantId}
</if>
</if>

<if test=" null != parentTenantId ">
and `parent_tenant_id`= #{parentTenantId}
</if>
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != name ">
and `name` like concat('%', #{name},'%')


+ 45
- 18
mallinkService/src/main/resources/mapper/WxCouponMapper.xml View File

@@ -114,11 +114,10 @@
and `id` = #{id}
</if>

<if test=" null != tenantId ">
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>

<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>

@@ -284,8 +283,12 @@
`remain_inventory` = #{remainInventory}, `inventory` = #{inventory},
`valid_type` = #{validType}, `valid_end_date` = #{validEndDate}, `valid_days` = #{validDays}
WHERE 1=1
<if test=" null != tenantId "> and `tenant_id` = #{tenantId} </if>
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
and id = #{id} and `remain_inventory` = #{orgRemainInventory} and `inventory` = #{orgInventory}
</update>

@@ -303,11 +306,10 @@
and c.`id` = #{id}
</if>

<if test=" null != tenantId ">
<if test=" null != tenantId and '' != tenantId">
and c.`tenant_id` = #{tenantId}
</if>

<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and c.`parent_tenant_id` = #{parentTenantId}
</if>

@@ -440,29 +442,49 @@
<if test=" null != pressModelId and 0l != pressModelId">
and if(type=8,put_apply_status =2 or c.id in (
select coupon_id from wx_coupon_channel
where status=0 and tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
where status=0
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
) ,1=1)
</if>
<if test=" null != groupModelId and 0l != groupModelId">
and if(type=9,put_apply_status =2 or c.id in (
select coupon_id from wx_coupon_channel
where status=0 and tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
where status=0
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
),1=1)
</if>
<if test=" null != cardModelId and 0l != cardModelId">
and if(type=100,put_apply_status =2 or c.id in (
select coupon_id from wx_coupon_channel
where status=0 and tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
where status=0
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
),1=1)
</if>
<if test=" null != couponModelId and 0l != couponModelId">
and if(type !=8 and type !=9 and type!=100,put_apply_status =2 or c.id in (
select coupon_id from wx_coupon_channel
where status=0 and tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
where status=0
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
),1=1)
</if>
</if>
@@ -917,7 +939,12 @@
max(case type when 11 then model_id else 0 end) groupModelId,
max(case type when 12 then model_id else 0 end) pressModelId
from wx_flow_config
where type in(9,10,11,12) and tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
where type in(9,10,11,12)
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
</select>
</mapper>

+ 2
- 3
mallinkService/src/main/resources/mapper/WxCouponMerchantMapper.xml View File

@@ -24,11 +24,10 @@
and `id` = #{id}
</if>

<if test=" null != tenantId ">
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>

<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != productId ">


+ 108
- 56
mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml View File

@@ -31,10 +31,10 @@
and `id` = #{id}
</if>

<if test=" null != tenantId ">
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>

@@ -106,9 +106,13 @@
`b_user_id` = #{bUserId},
`update_date` = #{updateDate},
`verify_type` = #{verifyType}
where `tenant_id`=#{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
and id=#{id} and `b_user_id` is null
where id=#{id} and `b_user_id` is null
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
</update>

<update id="updateVerifyCouponOrderStatus" parameterType="com.iformall.domain.po.WxCouponOrder">
@@ -117,10 +121,13 @@
`b_user_id` = #{bUserId},
`update_date` = #{updateDate},
`verify_type` = #{verifyType}
where 1=1
and `tenant_id`=#{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
and id=#{id}
where id=#{id}
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null == #{bUserId} ">
and `b_user_id` is null
</if>
@@ -146,9 +153,13 @@
`b_user_id` = null,
`update_date` = #{updateDate},
`verify_type` = null
where `tenant_id`=#{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
and id=#{id}
where id=#{id}
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
</update>

<select id="couponDataMap" resultType="com.iformall.domain.vo.MarkingCouponDataReportVo" parameterType="hashmap">
@@ -159,21 +170,34 @@
from wx_coupon_order c
where coupon_order_status=1
AND DATE_FORMAT(create_date,'%m/%d')=createTime
AND tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
AND c.update_date &gt;= #{startTime}
AND c.update_date &lt;= #{endTime}) as verifyCount,
(select Count(DISTINCT c_user_id)
from wx_coupon_order d
where coupon_order_status=1
AND DATE_FORMAT(create_date,'%m/%d')=createTime
AND tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
AND d.update_date &gt;= #{startTime}
AND d.update_date &lt;= #{endTime}) as verifyUserCount
from wx_coupon_order
where tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
where 1=1
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
AND create_date &gt;= #{startTime}
AND create_date &lt;= #{endTime}
GROUP BY createTime
@@ -217,9 +241,13 @@
<select id="queryForSceneRepotyHistoryVerified" resultType="com.iformall.domain.vo.MarkingSceneDataVo" parameterType="hashmap">
select DATE_FORMAT(update_date,'%Y-%m-%d') xTime, count(c.id) triggerCount
from wx_coupon_order c
where c.tenant_id = #{tenantId}
<if test=" null != parentTenantId "> and c.`parent_tenant_id` = #{parentTenantId} </if>
and c.coupon_order_status = 1
where c.coupon_order_status = 1
<if test=" null != tenantId and '' != tenantId">
and c.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and c.`parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != startTime and null != endTime">
and c.update_date BETWEEN #{startTime} and #{endTime}
</if>
@@ -229,8 +257,13 @@
<select id="queryForSceneRepotyHistoryOrdered" resultType="com.iformall.domain.vo.MarkingSceneDataVo" parameterType="hashmap">
select DATE_FORMAT(update_date,'%Y-%m-%d') xTime, count(c.id) triggerCount
from wx_coupon_order c
where c.tenant_id = #{tenantId}
<if test=" null != parentTenantId "> and c.`parent_tenant_id` = #{parentTenantId} </if>
where 1=1
<if test=" null != tenantId and '' != tenantId">
and c.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and c.`parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != startTime and null != endTime">
and c.create_date BETWEEN #{startTime} and #{endTime}
</if>
@@ -241,9 +274,11 @@
select DATE_FORMAT(update_date,'%Y-%m-%d') xTime, count(c.id) triggerCount
from wx_coupon_order c left join wx_coupon_action_log cal on cal.tenant_id = c.tenant_id
where cal.coupon_order_id=c.id
and c.tenant_id=#{tenantId}
<if test=" null != parentTenantId ">
and c.`parent_tenant_id` = #{parentTenantId}
<if test=" null != tenantId and '' != tenantId">
and c.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and c.`parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != channelType and null != channelType">
and cal.channel_type=#{channelType}
@@ -257,8 +292,12 @@
<select id="queryPriceTotal" parameterType="com.iformall.domain.po.WxCouponOrder" resultType="java.lang.Integer" >
SELECT IFNULL(SUM(coupon_price),0) from wx_coupon_order
where 1=1
<if test=" null != tenantId"> and tenant_id = #{tenantId} </if>
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != couponOrderStatus">
and coupon_order_status = #{couponOrderStatus}
</if>
@@ -290,12 +329,12 @@
</if>
</if>
where 1=1
<if test=" null != tenantId">
and (co.tenant_id = #{tenantId} or co.parent_tenant_id = #{tenantId})
<if test=" null != tenantId and '' != tenantId">
and co.`tenant_id` = #{tenantId}
</if>
<!--<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and co.`parent_tenant_id` = #{parentTenantId}
</if>-->
</if>
<if test=" null != couponOrderStatus">
and co.coupon_order_status = #{couponOrderStatus}
</if>
@@ -381,10 +420,10 @@
FROM wx_coupon_order co
inner join wx_coupon c on c.id = co.coupon_id
where 1=1
<if test=" null != tenantId">
and co.tenant_id = #{tenantId}
<if test=" null != tenantId and '' != tenantId">
and co.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and co.`parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != couponOrderStatus">
@@ -475,10 +514,10 @@
inner join wx_coupon c on c.id = co.coupon_id and c.business = #{businessId}
</if>
where 1=1
<if test=" null != tenantId">
and co.tenant_id = #{tenantId}
<if test=" null != tenantId and '' != tenantId">
and co.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and co.`parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != couponOrderStatus">
@@ -564,8 +603,13 @@

<select id="queryPriceTotalGroup" resultType="com.iformall.domain.vo.CUserDateAmountVo" >
SELECT DATE_FORMAT(create_date,'%Y-%m-%d') as xTime,IFNULL(SUM(coupon_price),0) as price from wx_coupon_order
where tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
where 1=1
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
AND create_date &gt;= #{startTime} and create_date &lt; #{endTime} GROUP BY xTime
</select>

@@ -749,11 +793,11 @@
and co.coupon_type &lt; 100
</otherwise>
</choose>
<if test=" null != tenantId ">
and co.tenant_id = #{tenantId}
<if test=" null != tenantId and '' != tenantId">
and co.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
and co.parent_tenant_id = #{parentTenantId}
<if test=" null != parentTenantId and '' != parentTenantId">
and co.`parent_tenant_id` = #{parentTenantId}
</if>

<if test=" null != couponOrderStatus ">
@@ -1100,10 +1144,14 @@
from wx_coupon_order co
inner join wx_coupon c on c.id = co.coupon_id
inner join wx_coupon_merchant cm on cm.product_id = co.coupon_id
where co.tenant_id = #{tenantId}
<if test=" null != parentTenantId "> and co.`parent_tenant_id` = #{parentTenantId} </if>
and co.c_user_id = #{cUserId}
where co.c_user_id = #{cUserId}
and co.coupon_order_status = 0
<if test=" null != tenantId and '' != tenantId">
and co.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and co.`parent_tenant_id` = #{parentTenantId}
</if>
and cm.merchant_id = #{merchantId}
and co.expired_time > now()
and c.type in (1, 2, 6)
@@ -1113,10 +1161,14 @@
inner join wx_coupon c on c.id = co.coupon_id
inner join wx_coupon_merchant cm on cm.product_id = co.coupon_id
inner join pos_coupon_order_verify pco on pco.coupon_order_id = co.id
where co.tenant_id = #{tenantId}
<if test=" null != parentTenantId "> and co.`parent_tenant_id` = #{parentTenantId} </if>
and co.c_user_id = #{cUserId}
where co.c_user_id = #{cUserId}
and co.coupon_order_status = 100
<if test=" null != tenantId and '' != tenantId">
and co.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and co.`parent_tenant_id` = #{parentTenantId}
</if>
and cm.merchant_id = #{merchantId}
and co.expired_time > now()
and c.type in (1, 2, 6)
@@ -1179,10 +1231,10 @@
<if test="cUserId != null">
and co.c_user_id = #{cUserId}
</if>
<if test="tenantId != null">
and co.tenant_id = #{tenantId}
<if test=" null != tenantId and '' != tenantId">
and co.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and co.`parent_tenant_id` = #{parentTenantId}
</if>
<if test="id != null">
@@ -1254,10 +1306,10 @@
coupon_order_status,create_date,update_date,'' cover_img,title,'' sub_title,'' detail,0 unit,
'' remark,amount,remain_amount as remaining_amount,0 support_transfer
from wx_card_transfer_info where 1=1
<if test="tenantId != null">
and tenant_id = #{tenantId}
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test="ownerId != null">


+ 20
- 11
mallinkService/src/main/resources/mapper/WxCouponPasswordMapper.xml View File

@@ -26,11 +26,11 @@
where 1 = 1
<if test=" null != id ">
and `id` = #{id}
</if>
<if test=" null != tenantId ">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != couponId ">
@@ -89,10 +89,10 @@
select <include refid="allColumns" />
from wx_coupon_password
<where>
<if test=" null != tenantId ">
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != couponId ">
@@ -130,8 +130,13 @@
<select id="findCouponGroupList" parameterType="com.iformall.domain.po.WxCouponPassword" resultMap="BaseResultMap">
select `coupon_id`,`coupon_short`
from wx_coupon_password
where `tenant_id` = #{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
where 1=1
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
group by `coupon_id`,`coupon_short`
</select>
@@ -149,9 +154,13 @@
(select count(*) as coupon_count,coupon_id from wx_coupon_password
where tenant_id=#{tenantId} and status=0 group by coupon_id) cp
inner join wx_coupon c on cp.coupon_id = c.id
where c.tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and c.`parent_tenant_id` = #{parentTenantId} </if>
and c.status=0 and c.put_apply_status in(0,2)
where c.status=0 and c.put_apply_status in(0,2)
<if test=" null != tenantId and '' != tenantId">
and c.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and c.`parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != couponId ">
and cp.`coupon_id` = #{couponId}
</if>


+ 2
- 2
mallinkService/src/main/resources/mapper/WxCouponPresentMapper.xml View File

@@ -22,10 +22,10 @@
<if test=" null != id ">
and `id` = #{id}
</if>
<if test=" null != tenantId ">
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != couponId ">


+ 6
- 7
mallinkService/src/main/resources/mapper/WxCouponSendConfigMapper.xml View File

@@ -22,15 +22,14 @@
<if test=" null != id ">
and `id` = #{id}
</if>
<if test=" null != tenantId ">
and `tenant_id` = #{tenantId}
</if>
</if>

<if test=" null != parentTenantId ">
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
</if>
<if test=" null != sendType ">
and `send_type` = #{sendType}


+ 4
- 5
mallinkService/src/main/resources/mapper/WxCouponSendMapper.xml View File

@@ -46,12 +46,11 @@
and cs.id = #{id}
</if>

<if test=" null != tenantId ">
and cs.tenant_id = #{tenantId}
<if test=" null != tenantId and '' != tenantId">
and cs.`tenant_id` = #{tenantId}
</if>

<if test=" null != parentTenantId ">
and cs.parent_tenant_id = #{parentTenantId}
<if test=" null != parentTenantId and '' != parentTenantId">
and cs.`parent_tenant_id` = #{parentTenantId}
</if>

<if test=" null != couponId ">


+ 17
- 13
mallinkService/src/main/resources/mapper/WxCreditHistoryMapper.xml View File

@@ -31,10 +31,10 @@
<if test=" null != id ">
and `id` = #{id}
</if>
<if test=" null != tenantId ">
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != cUserId ">
@@ -104,11 +104,11 @@
<if test=" null != endTime">
and credit.create_date &lt; #{endTime}
</if>
<if test=" null != tenantId ">
and credit.tenant_id = #{tenantId}
<if test=" null != tenantId and '' != tenantId">
and credit.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
and credit.parent_tenant_id = #{parentTenantId}
<if test=" null != parentTenantId and '' != parentTenantId">
and credit.`parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != operatorType ">
and credit.operator_type = #{operatorType}
@@ -179,10 +179,10 @@
<select id="loginCount" parameterType="com.iformall.domain.po.WxCreditHistory" resultType="java.lang.Integer">
select COUNT(0) from wx_credit_history
where 1=1
<if test=" null != tenantId ">
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != cUserId ">
@@ -218,10 +218,10 @@
select count(0)
from wx_credit_history
where 1=1
<if test=" null != tenantId ">
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != cUserId ">
@@ -235,9 +235,13 @@
<update id="updateNewId" parameterType="com.iformall.domain.vo.WxCreditHistoryNewIdVo">
update wx_credit_history
set c_user_id=#{newUserId}
where tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
and c_user_id = #{cUserId}
where c_user_id = #{cUserId}
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
</update>
<select id="getTotalCreditAmount" parameterType="com.iformall.domain.po.WxCreditHistory"


+ 4
- 5
mallinkService/src/main/resources/mapper/WxDataRuleTargetMapper.xml View File

@@ -26,12 +26,11 @@
<if test=" null != tenantId ">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parent ">
and `parent` = #{parent}
</if>

<if test=" null != parentTenantId ">
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>


+ 9
- 6
mallinkService/src/main/resources/mapper/WxDateAmountRecordMapper.xml View File

@@ -27,11 +27,10 @@
and `id` = #{id}
</if>

<if test=" null != tenantId ">
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>

<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != date ">
@@ -96,9 +95,13 @@
<update id="updateAmount" parameterType="com.iformall.domain.po.WxDateAmountRecord">
update wx_date_amount_record set pay_price=pay_price+#{payPrice}
where tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
and merchant_id=#{merchantId}
where merchant_id=#{merchantId}
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
and type=#{type} and date = #{date}
</update>


+ 2
- 3
mallinkService/src/main/resources/mapper/WxDeviceMapper.xml View File

@@ -31,11 +31,10 @@
and `id` = #{id}
</if>

<if test=" null != tenantId ">
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>

<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>



+ 6
- 2
mallinkService/src/main/resources/mapper/WxFlowConfigMapper.xml View File

@@ -21,8 +21,12 @@
<sql id="dynamicWhereConditions">
where 1=1
<if test=" null != parentId ">and `parent_id` = #{parentId}</if>
<if test=" null != tenantId ">and `tenant_id` = #{tenantId}</if>
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != id "> and `id` = #{id} </if>
<if test=" null != modelId"> and `model_id` = #{modelId} </if>
<if test="null != name and '' != name "> and `name` like concat('%', #{name},'%') </if>


+ 5
- 5
mallinkService/src/main/resources/mapper/WxFlowModelMapper.xml View File

@@ -17,10 +17,10 @@

<sql id="dynamicWhereConditions">
where 1 = 1
<if test=" null != tenantId ">
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != id "> and `id` = #{id} </if>
@@ -38,12 +38,12 @@
<select id="getModelBybusiness" parameterType="com.iformall.domain.po.WxFlowModel" resultMap="BaseResultMap">
select m.* from wx_flow_config w,wx_flow_model m
where w.model_id = m.id and w.type = #{flowType}
<if test=" null != tenantId ">
<if test=" null != tenantId and '' != tenantId">
and w.tenant_id = #{tenantId}
and m.tenant_id = #{tenantId}
</if>
<if test=" null != parentTenantId ">
and w.`parent_tenant_id` = #{parentTenantId}
<if test=" null != parentTenantId and '' != parentTenantId">
and w.`parent_tenant_id` = #{parentTenantId}
and m.`parent_tenant_id` = #{parentTenantId}
</if>



+ 3
- 3
mallinkService/src/main/resources/mapper/WxFlowRecordMapper.xml View File

@@ -41,10 +41,10 @@
<if test=" null != id ">
and `id` = #{id}
</if>
<if test=" null != tenantId ">
and `tenant_id` = #{tenantId}
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != businessId ">


+ 7
- 7
mallinkService/src/main/resources/mapper/WxGameActionLogMapper.xml View File

@@ -21,14 +21,14 @@
<if test=" null != id ">
and `id` = #{id}
</if>
<if test=" null != tenantId ">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
</if>
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
</if>
<if test=" null != gameId ">
and `game_id` = #{gameId}


+ 3
- 4
mallinkService/src/main/resources/mapper/WxGameMapper.xml View File

@@ -25,11 +25,10 @@
and `id` = #{id}
</if>

<if test=" null != tenantId ">
and `tenant_id` = #{tenantId}
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>

<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>



+ 16
- 12
mallinkService/src/main/resources/mapper/WxLevelConfigMapper.xml View File

@@ -15,47 +15,50 @@
</resultMap>

<sql id="allColumns">
`id`, `tenant_id`, `points`, `level`, `description`, `create_date`, `update_date`, `discount_enable`, `capability`,`scale`
wlc.`id`, wlc.`tenant_id`, wlc.`points`, wlc.`level`, wlc.`description`, wlc.`create_date`, wlc.`update_date`, wlc.`discount_enable`, wlc.`capability`,wlc.`scale`
</sql>

<sql id="dynamicWhereConditions">
where 1 = 1

<if test=" null != id ">
and `id` = #{id}
and wlc.`id` = #{id}
</if>

<if test=" null != tenantId ">
and `tenant_id` = #{tenantId}
<if test=" null != tenantId and '' != tenantId">
and wlc.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and wm.`parent_tenant_id` = #{parentTenantId}
</if>

<if test=" null != points ">
and `points` = #{points}
and wlc.`points` = #{points}
</if>

<if test=" null != level ">
and `level` like concat('%', #{level},'%')
and wlc.`level` like concat('%', #{level},'%')
</if>

<if test=" null != description ">
and `description` like concat('%', #{description},'%')
and wlc.`description` like concat('%', #{description},'%')
</if>

<if test=" null != createDate ">
and `create_date` = #{createDate}
and wlc.`create_date` = #{createDate}
</if>

<if test=" null != updateDate ">
and `update_date` = #{updateDate}
and wlc.`update_date` = #{updateDate}
</if>

<if test=" null != discountEnable ">
and `discount_enable` = #{discountEnable}
and wlc.`discount_enable` = #{discountEnable}
</if>


<if test=" null != ids ">
and id in
and wlc.id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
#{idItem}
</foreach>
@@ -66,7 +69,8 @@
<select id="findList" parameterType="com.iformall.domain.po.WxLevelConfig" resultMap="BaseResultMap">
select
<include refid="allColumns"/>
from wx_level_config
from wx_level_config wlc
left join wx_mall wm on wm.tenant_id = wlc.tenant_id
<include refid="dynamicWhereConditions"/>
</select>



+ 5
- 7
mallinkService/src/main/resources/mapper/WxLevelMerchantMapper.xml View File

@@ -22,11 +22,10 @@
and `id` = #{id}
</if>

<if test=" null != tenantId ">
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>

<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>

@@ -92,11 +91,10 @@
<sql id="allCVoDynamicWhereConditions">
where 1 = 1

<if test=" null != tenantId ">
and lm.tenant_id = #{tenantId}
<if test=" null != tenantId and '' != tenantId">
and lm.`tenant_id` = #{tenantId}
</if>

<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and lm.`parent_tenant_id` = #{parentTenantId}
</if>



+ 6
- 7
mallinkService/src/main/resources/mapper/WxMallBuildingMapper.xml View File

@@ -22,15 +22,14 @@
<if test=" null != id ">
and `id` = #{id}
</if>
<if test=" null != tenantId ">
and `tenant_id` = #{tenantId}
</if>
</if>

<if test=" null != parentTenantId ">
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
</if>
<if test=" null != mallId ">
and `mall_id` = #{mallId}


+ 4
- 4
mallinkService/src/main/resources/mapper/WxMallFloorMapper.xml View File

@@ -26,12 +26,12 @@
and `id` = #{id}
</if>

<if test=" null != tenantId ">
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>

<if test=" null != mallId ">
and `mall_id` = #{mallId}


+ 4
- 5
mallinkService/src/main/resources/mapper/WxMallMapper.xml View File

@@ -54,11 +54,10 @@
and `id` = #{id}
</if>

<if test=" null != tenantId ">
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>

<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>

@@ -173,10 +172,10 @@
select st.menus
from mall_sale_type st, wx_mall m
where st.type = m.sale_type
<if test=" null != tenantId ">
<if test=" null != tenantId and '' != tenantId">
and m.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and m.`parent_tenant_id` = #{parentTenantId}
</if>
</select>


+ 4
- 5
mallinkService/src/main/resources/mapper/WxMerchantBUserMapper.xml View File

@@ -28,13 +28,12 @@
and `id` = #{id}
</if>

<if test=" null != tenantId ">
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>

<if test=" null != parentTenantId ">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>

<if test=" null != phone ">
and `phone` = #{phone}


+ 7
- 3
mallinkService/src/main/resources/mapper/WxMerchantCorpMapper.xml View File

@@ -24,9 +24,13 @@

<sql id="dynamicWhereConditions">
where 1 = 1
<if test=" null != id "> and `id` = #{id} </if>
<if test=" null != tenantId "> and `tenant_id` = #{tenantId} </if>
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
<if test=" null != id "> and `id` = #{id} </if>
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != merchantId "> and `merchant_id` = #{merchantId} </if>
<if test=" null != corpPapersType "> and `corp_papers_type` = #{corpPapersType} </if>
<if test=" null != corpPapersNumber "> and `corp_papers_number` = #{corpPapersNumber} </if>


+ 7
- 8
mallinkService/src/main/resources/mapper/WxMerchantMapper.xml View File

@@ -57,10 +57,10 @@
and `id` = #{id}
</if>

<if test=" null != tenantId ">
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>

@@ -198,14 +198,13 @@
<if test=" null != id ">
and m.`id` = #{id}
</if>
<if test=" null != tenantId and '' != tenantId ">
and (m.`tenant_id` = #{tenantId} or m.`parent_tenant_id` = #{tenantId})
</if>

<!--<if test=" null != parentTenantId ">
<if test=" null != tenantId and '' != tenantId">
and m.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and m.`parent_tenant_id` = #{parentTenantId}
</if>-->
</if>
<if test=" null != imgUrl ">
and m.`img_url` like concat('%', #{imgUrl},'%')


+ 3
- 4
mallinkService/src/main/resources/mapper/WxMerchantPowerBillConfigMapper.xml View File

@@ -26,12 +26,11 @@
<if test=" null != id ">
and `id` = #{id}
</if>
<if test=" null != tenantId ">
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>

<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>


+ 5
- 6
mallinkService/src/main/resources/mapper/WxMerchantShopMapper.xml View File

@@ -23,13 +23,12 @@
<if test=" null != id ">
and `id` = #{id}
</if>
<if test=" null != tenantId ">
and `tenant_id` = #{tenantId}
</if>
</if>

<if test=" null != parentTenantId ">
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>


+ 7
- 7
mallinkService/src/main/resources/mapper/WxMerchantSubsidyMapper.xml View File

@@ -33,10 +33,10 @@
<if test=" null != id ">
and `id` = #{id}
</if>
<if test=" null != tenantId ">
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != orderId ">
@@ -113,10 +113,10 @@
update wx_merchant_subsidy
set `status` = #{status}
where 1=1
<if test=" null != tenantId ">
and `tenant_id`=#{tenantId}
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != merchantId ">
@@ -179,10 +179,10 @@
<if test=" null != id ">
and t.`id` = #{id}
</if>
<if test=" null != tenantId ">
<if test=" null != tenantId and '' != tenantId">
and t.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and t.`parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != orderId ">


+ 7
- 3
mallinkService/src/main/resources/mapper/WxMerchantTaxMapper.xml View File

@@ -27,9 +27,13 @@

<sql id="dynamicWhereConditions">
where 1 = 1
<if test=" null != id "> and `id` = #{id} </if>
<if test=" null != tenantId "> and `tenant_id` = #{tenantId} </if>
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
<if test=" null != id "> and `id` = #{id} </if>
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != merchantId "> and `merchant_id` = #{merchantId} </if>
<if test=" null != taxpayerType "> and `taxpayer_type` = #{taxpayerType} </if>
<if test=" null != taxPapersType "> and `tax_papers_type` = #{taxPapersType} </if>


+ 30
- 29
mallinkService/src/main/resources/mapper/WxMerchantTradeDailyMapper.xml View File

@@ -24,15 +24,14 @@
<if test=" null != id ">
and `id` = #{id}
</if>
<if test=" null != tenantId ">
and (`tenant_id` = #{tenantId} or `tenant_id` = #{parentTenantId})
</if>
</if>

<!--<if test=" null != parentTenantId ">
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>-->
</if>

<if test=" null != merchantId ">
and `merchant_id` = #{merchantId}
@@ -90,11 +89,10 @@
and `report_date` != #{reportDate}
</if>

<if test=" null != tenantId ">
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>

<if test=" null != parentTenantId ">
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>

@@ -143,17 +141,17 @@
left join wx_merchant_b_user mbu on mtd.b_user_id = mbu.id
where 1 = 1

<if test=" null != tenantId ">
and mtd.tenant_id = #{tenantId}
<if test=" null != tenantId and '' != tenantId">
and mtd.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and mtd.`parent_tenant_id` = #{parentTenantId}
</if>

<if test=" null != merchantId ">
and mtd.merchant_id = #{merchantId}
</if>

<if test=" null != parentTenantId ">
and mtd.`parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != merchantName and ''!=merchantName">
and m.name like concat('%', #{merchantName},'%')
</if>
@@ -168,9 +166,13 @@
select ms.merchant_id from (select merchant_id,shop_id from wx_merchant_shop where is_del=0) ms
inner join wx_merchant m on ms.merchant_id = m.id
inner join wx_shop s on s.id=ms.shop_id
where m.tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
and s.is_del=0
where s.is_del=0
<if test=" null != tenantId and '' != tenantId">
and m.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and m.`parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != businessForRule and '' != businessForRule ">
and m.business_id in (${businessForRule})
</if>
@@ -190,12 +192,11 @@
left join wx_merchant_b_user mbu on mtd.b_user_id = mbu.id
where 1 = 1

<if test=" null != tenantId ">
and mtd.tenant_id = #{tenantId}
</if>

<if test=" null != parentTenantId ">
and mtd.`parent_tenant_id` = #{parentTenantId}
<if test=" null != tenantId and '' != tenantId">
and mtd`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and mtd`parent_tenant_id` = #{parentTenantId}
</if>

<if test=" null != merchantId ">
@@ -220,10 +221,10 @@
from wx_merchant_trade_daily mtd
where 1 = 1

<if test=" null != tenantId ">
and mtd.tenant_id = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != tenantId and '' != tenantId">
and mtd.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and mtd.`parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != reportDate ">


+ 15
- 8
mallinkService/src/main/resources/mapper/WxMsgConfigMapper.xml View File

@@ -33,12 +33,14 @@
<if test=" null != id ">
and `id` = #{id}
</if>
<if test=" null != tenantId ">
and (`tenant_id` = #{tenantId} or `parent_tenant_id` = #{tenantId})
</if>
</if>

<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != secret ">
and `secret` like concat('%', #{secret},'%')
@@ -118,8 +120,13 @@
<update id="updateRemains" parameterType="com.iformall.domain.po.WxMsgConfig">
update wx_msg_config set remains = if(remains - #{remains} &lt; 0,0,remains - #{remains})
where `tenant_id` = #{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
where 1=1
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
</update>


+ 6
- 7
mallinkService/src/main/resources/mapper/WxMsgMapper.xml View File

@@ -36,15 +36,14 @@
<if test=" null != id ">
and `id` = #{id}
</if>
<if test=" null != tenantId ">
and `tenant_id` = #{tenantId}
</if>
</if>

<if test=" null != parentTenantId ">
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
</if>
<if test=" null != modelId ">
and `model_id` = #{modelId}


+ 4
- 4
mallinkService/src/main/resources/mapper/WxMsgModelMapper.xml View File

@@ -25,11 +25,11 @@
and `id` = #{id}
</if>

<if test=" null != tenantId ">
and `tenant_id`=#{tenantId}
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
and `parent_tenant_id`=#{parentTenantId}
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>

<if test=" null != name and ''!= name">


+ 4
- 4
mallinkService/src/main/resources/mapper/WxMsgRecordMapper.xml View File

@@ -39,10 +39,10 @@
<if test=" null != id ">
and `id` = #{id}
</if>
<if test=" null != tenantId ">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != receiverUserId ">


+ 6
- 7
mallinkService/src/main/resources/mapper/WxMsgSignatureMapper.xml View File

@@ -19,15 +19,14 @@
<if test=" null != id ">
and `id` = #{id}
</if>
<if test=" null != tenantId ">
and `tenant_id` = #{tenantId}
</if>
</if>

<if test=" null != parentTenantId ">
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
</if>
<if test=" null != name ">
and `name` like concat('%', #{name},'%')


+ 6
- 2
mallinkService/src/main/resources/mapper/WxMsgValidationcodeMapper.xml View File

@@ -22,8 +22,12 @@
<sql id="dynamicWhereConditions">
where 1 = 1
<if test=" null != id "> and `id` = #{id} </if>
<if test=" null != tenantId "> and `tenant_id` = #{tenantId} </if>
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != phone "> and `phone` = #{phone} </if>
<if test=" null != expiretime ">and `expiretime` = #{expiretime}</if>
<if test=" null != createtime ">and `createtime` = #{createtime}</if>


+ 9
- 3
mallinkService/src/main/resources/mapper/WxMsgValidationcodeModelMapper.xml View File

@@ -10,6 +10,7 @@
<result column="status" jdbcType="INTEGER" property="status" />
<result column="minutes" jdbcType="INTEGER" property="minutes" />
<result column="model_id" jdbcType="INTEGER" property="modelId" />
<result column="model_code" jdbcType="VARCHAR" property="modelCode" />
<result column="type" jdbcType="INTEGER" property="type" />
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
<result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" />
@@ -21,7 +22,7 @@
</resultMap>

<sql id="allColumns">
`id`,`name`,`signature`,`content`,`createtime`,`status`,`minutes`,`model_id`,`type`,`tenant_id`,`parent_tenant_id`,email_bg_img,`open`,msg_type,role_type
`id`,`name`,`signature`,`content`,`createtime`,`status`,`minutes`,`model_id`,`model_code`,`type`,`tenant_id`,`parent_tenant_id`,email_bg_img,`open`,msg_type,role_type
</sql>

<sql id="dynamicWhereConditions">
@@ -34,9 +35,14 @@
<if test=" null != status "> and `status` = #{status} </if>
<if test=" null != minutes "> and `minutes` = #{minutes} </if>
<if test=" null != modelId "> and `model_id` = #{modelId} </if>
<if test=" null != modelCode "> and `model_code` = #{modelCode} </if>
<if test=" null != type "> and `type` = #{type} </if>
<if test=" null != tenantId "> and `tenant_id` = #{tenantId} </if>
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != open "> and `open` = #{open} </if>
<if test=" null != msgType "> and `msg_type` = #{msgType} </if>
<if test=" null != roleType "> and `role_type` = #{roleType} </if>


+ 46
- 38
mallinkService/src/main/resources/mapper/WxOrderGroupMapper.xml View File

@@ -25,10 +25,10 @@
<if test=" null != id ">
and `id` = #{id}
</if>
<if test=" null != tenantId ">
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != orderId ">
@@ -58,9 +58,13 @@
c.avatar_url avatarUrl,o.id orderId,o.product_id couponId
from wx_order o
left join wx_c_user c on o.c_user_id=c.id
where o.tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and o.`parent_tenant_id` = #{parentTenantId} </if>
and o.id=#{orderId}
where o.id=#{orderId}
<if test=" null != tenantId and '' != tenantId">
and o.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and o.`parent_tenant_id` = #{parentTenantId}
</if>
</select>
@@ -75,9 +79,13 @@
left join wx_coupon c on o.product_id=c.id
left join wx_order_group g on o.order_group_id=g.id
left join wx_c_user u on o.c_user_id=u.id
where o.tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and o.`parent_tenant_id` = #{parentTenantId} </if>
and c.type=9
where c.type=9
<if test=" null != tenantId and '' != tenantId">
and o.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and o.`parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != cUserId ">
and o.c_user_id=#{cUserId}
</if>
@@ -116,12 +124,12 @@
left join (SELECT count(*) verify_count, coupon_id FROM wx_coupon_order WHERE coupon_type = 9 AND coupon_order_status = 1 group by coupon_id ) co on co.coupon_id = c.id
left join (SELECT count(*) total_people, product_id FROM wx_order WHERE order_group_id != 0 group by product_id ) o2 on o2.product_id = c.id
WHERE type = 9
<if test=" null != tenantId">
and c.tenant_id=#{tenantId}
</if>
<if test=" null != parentTenantId ">
and c.`parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != tenantId and '' != tenantId">
and c.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and c.`parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != couponId and ''!=couponId">
and c.coupon_id=#{couponId}
</if>
@@ -135,10 +143,10 @@
<select id="queryOrderGroupSuccessCountAndTime" parameterType="hashmap" resultType="hashmap">
select count(*) total,DATE_FORMAT(create_date,'%Y-%m-%d') time from wx_coupon_order
where coupon_type=9
<if test=" null != tenantId">
and tenant_id=#{tenantId}
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != startdate and null!=enddate ">
@@ -153,10 +161,10 @@
<select id="queryOrderGroupVerifyCountAndTime" parameterType="hashmap" resultType="hashmap">
select count(*) total,DATE_FORMAT(create_date,'%Y-%m-%d') time
from wx_coupon_order where coupon_type=9 and coupon_order_status=1
<if test=" null != tenantId">
and tenant_id=#{tenantId}
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != startdate and null!=enddate ">
@@ -171,10 +179,10 @@
<select id="queryOrderGroupCount" parameterType="hashmap" resultType="long">
select count(*) total from wx_order_group
<where>
<if test=" null != tenantId">
and tenant_id=#{tenantId}
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != startdate and null!=enddate ">
@@ -187,10 +195,10 @@
select DATE_FORMAT(create_date,'%Y-%m-%d') xtime,count(*) xcount
from wx_order_group
<where>
<if test=" null != tenantId">
and tenant_id=#{tenantId}
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != startdate and null!=enddate ">
@@ -202,10 +210,10 @@
<select id="queryOrderGroupSuccessCount" parameterType="hashmap" resultType="long">
select count(*) total from wx_order_group where status=11
<if test=" null != tenantId">
and tenant_id=#{tenantId}
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != startdate and null!=enddate ">
@@ -215,10 +223,10 @@
<select id="queryOrderGroupPeopleCount" parameterType="hashmap" resultType="long">
select count(*) from (select id from wx_order where order_group_id!=0
<if test=" null != tenantId">
and tenant_id=#{tenantId}
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != startdate and null!=enddate ">
@@ -229,10 +237,10 @@
<select id="queryOrderGroupVerifyCount" parameterType="hashmap" resultType="long">
select count(*) total from wx_coupon_order where coupon_type=9 and coupon_order_status=1
<if test=" null != tenantId">
and tenant_id=#{tenantId}
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != startdate and null!=enddate ">
@@ -245,10 +253,10 @@
<select id="queryOrderGroupSuccessPeopleCount" parameterType="hashmap" resultType="long">
select count(*) from wx_order where order_status=11
<if test=" null != tenantId">
and tenant_id=#{tenantId}
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != startdate and null!=enddate ">


+ 90
- 68
mallinkService/src/main/resources/mapper/WxOrderMapper.xml View File

@@ -42,11 +42,10 @@
and `order_number` = #{orderNumber}
</if>

<if test=" null != tenantId ">
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>

<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>

@@ -151,11 +150,10 @@
and o.c_user_id = #{cUserId}
</if>

<if test=" null != tenantId ">
and o.tenant_id = #{tenantId}
<if test=" null != tenantId and '' != tenantId">
and o.`tenant_id` = #{tenantId}
</if>

<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and o.`parent_tenant_id` = #{parentTenantId}
</if>

@@ -247,10 +245,10 @@
<update id="updateOrderGroupStatusByCouponId" parameterType="com.iformall.domain.po.WxOrder">
update wx_order set order_status=#{orderStatus},update_date=#{updateDate}
where product_id=#{productId} and order_status in(10,15)
<if test=" null != tenantId ">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
</update>
@@ -258,10 +256,10 @@
<update id="updateOrderGroupStatusByCouponChannelId" parameterType="com.iformall.domain.po.WxOrder">
update wx_order set order_status=#{orderStatus},update_date=#{updateDate}
where coupon_channel_id=#{couponChannelId} and order_status in(10,15)
<if test=" null != tenantId ">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
</update>
@@ -319,10 +317,10 @@
<if test="cUserId != null">
and o.c_user_id = #{cUserId}
</if>
<if test="tenantId != null">
and o.tenant_id = #{tenantId}
<if test=" null != tenantId and '' != tenantId">
and o.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and o.`parent_tenant_id` = #{parentTenantId}
</if>
<if test="orderStatus != null">
@@ -341,10 +339,10 @@
<if test="cUserId != null">
and o.c_user_id = #{cUserId}
</if>
<if test="tenantId != null">
and o.tenant_id = #{tenantId}
<if test=" null != tenantId and '' != tenantId">
and o.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and o.`parent_tenant_id` = #{parentTenantId}
</if>
<if test="id != null">
@@ -360,10 +358,10 @@
inner join wx_merchant_b_user bu on bu.id = product_id
inner join wx_merchant m on m.id = bu.merchant_id
where o.`type` = 1 and o.`order_status` = 1
<if test=" null != tenantId ">
<if test=" null != tenantId and '' != tenantId">
and o.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and o.`parent_tenant_id` = #{parentTenantId}
</if>

@@ -438,10 +436,10 @@
LEFT JOIN wx_c_user cu on cu.id = o.c_user_id
LEFT JOIN wx_c_user_basic_info cubi on cubi.id = o.c_user_id
where o.order_status = '1' and o.`type` = 1
<if test=" null != tenantId ">
<if test=" null != tenantId and '' != tenantId">
and o.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and o.`parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != merchantId ">
@@ -525,9 +523,13 @@
<select id="queryForSceneRepotyHistory" resultType="com.iformall.domain.vo.MarkingSceneDataVo" parameterType="hashmap">
select DATE_FORMAT(o.create_date,'%Y-%m-%d') xTime, count(o.id) triggerCount
from wx_order o
where o.`tenant_id` = #{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
and o.`type` = #{type}
where o.`type` = #{type}
<if test=" null != tenantId and '' != tenantId">
and o.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and o.`parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != startTime and null != endTime">
and o.`create_date` BETWEEN #{startTime} and #{endTime}
</if>
@@ -539,12 +541,12 @@
count(o.id) count,
IFNULL (SUM(o.payment),0) amount
from wx_order o
where o.`tenant_id` = #{tenantId}
<if test=" null != tenantId">
where 1=1
<if test=" null != tenantId and '' != tenantId">
and o.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
and `parent_tenant_id` = #{parentTenantId}
<if test=" null != parentTenantId and '' != parentTenantId">
and o.`parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != type">
and o.`type` = #{type}
@@ -652,17 +654,25 @@
c.title,cubi.`name` c_user_name,cubi.phone,o.create_date,1 attribute from wx_order o
left join wx_c_user_basic_info cubi on o.c_user_id=cubi.id
left join wx_coupon c on o.product_id=c.id
where o.tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and o.`parent_tenant_id` = #{parentTenantId} </if>
and c.type=100
where c.type=100
<if test=" null != tenantId and '' != tenantId">
and o.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and o.`parent_tenant_id` = #{parentTenantId}
</if>
union all
select o.id,o.order_number,o.tenant_id,o.parent_tenant_id,o.product_id,o.payment,o.order_status,
c.title,cubi.`name` c_user_name,cubi.phone,o.create_date,2 attribute from wx_order o
left join wx_c_user_basic_info cubi on o.c_user_id=cubi.id
left join wx_coupon c on o.product_id=c.id
where o.tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and o.`parent_tenant_id` = #{parentTenantId} </if>
and c.type!=100 and o.order_status in(0,1,2,3,4,5)
where c.type!=100 and o.order_status in(0,1,2,3,4,5)
<if test=" null != tenantId and '' != tenantId">
and o.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and o.`parent_tenant_id` = #{parentTenantId}
</if>
and ifnull(press_current_num,0)=0 and ifnull(order_group_id,0)=0
union all
select o.id,o.order_number,o.tenant_id,o.parent_tenant_id,o.product_id,o.payment,
@@ -671,9 +681,13 @@
c.title,cubi.`name` c_user_name,cubi.phone,o.create_date,3 attribute from wx_order o
left join wx_c_user_basic_info cubi on o.c_user_id=cubi.id
left join wx_coupon c on o.product_id=c.id
where o.tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and o.`parent_tenant_id` = #{parentTenantId} </if>
and c.type=8 and o.press_current_num>0
where c.type=8 and o.press_current_num>0
<if test=" null != tenantId and '' != tenantId">
and o.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and o.`parent_tenant_id` = #{parentTenantId}
</if>
union all
select o.id,o.order_number,o.tenant_id,o.parent_tenant_id,o.product_id,o.payment,
case o.order_status when 10 then 1 when 11 then 1
@@ -682,15 +696,19 @@
c.title,cubi.`name` c_user_name,cubi.phone,o.create_date,4 attribute from wx_order o
left join wx_c_user_basic_info cubi on o.c_user_id=cubi.id
left join wx_coupon c on o.product_id=c.id
where o.tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and o.`parent_tenant_id` = #{parentTenantId} </if>
and c.type=9 and o.order_group_id>0
where c.type=9 and o.order_group_id>0
<if test=" null != tenantId and '' != tenantId">
and o.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and o.`parent_tenant_id` = #{parentTenantId}
</if>
) o
<where>
<if test="tenantId!=null">
and o.tenant_id =#{tenantId}
<if test=" null != tenantId and '' != tenantId">
and o.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and o.`parent_tenant_id` = #{parentTenantId}
</if>
<if test="title!=null and title!=''">
@@ -739,10 +757,10 @@
left join wx_merchant m on o.merchant_id=m.id
) o
<where>
<if test="tenantId!=null">
and o.tenant_id =#{tenantId}
<if test=" null != tenantId and '' != tenantId">
and o.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and o.`parent_tenant_id` = #{parentTenantId}
</if>
<if test="startdate!=null and enddate!=null">
@@ -758,10 +776,10 @@
where o.type in (0,1,2) and o.order_status = #{order_status}
) o
<where>
<if test="tenantId!=null">
and o.tenant_id =#{tenantId}
<if test=" null != tenantId and '' != tenantId">
and o.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and o.`parent_tenant_id` = #{parentTenantId}
</if>
<if test="startdate!=null and enddate!=null">
@@ -776,12 +794,12 @@
where o.type in (0,1,2) and o.order_status = #{order_status}
) o
<where>
<if test="tenantId!=null">
and o.tenant_id =#{tenantId}
</if>
<if test=" null != parentTenantId ">
and o.`parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != tenantId and '' != tenantId">
and o.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and o.`parent_tenant_id` = #{parentTenantId}
</if>
<if test="startdate!=null and enddate!=null">
and o.create_date between #{startdate} and #{enddate}
</if>
@@ -888,10 +906,10 @@
<if test="cUserId != null">
and o.c_user_id = #{cUserId}
</if>
<if test="tenantId != null">
and o.tenant_id = #{tenantId}
<if test=" null != tenantId and '' != tenantId">
and o.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and o.`parent_tenant_id` = #{parentTenantId}
</if>
<if test="orderStatus != null">
@@ -910,10 +928,10 @@
<if test="cUserId != null">
and o.c_user_id = #{cUserId}
</if>
<if test="tenantId != null">
and o.tenant_id = #{tenantId}
<if test=" null != tenantId and '' != tenantId">
and o.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and o.`parent_tenant_id` = #{parentTenantId}
</if>
<if test="id != null">
@@ -924,9 +942,13 @@
<update id="updateStatusByOrderGroupId" parameterType="com.iformall.domain.po.WxOrder">
update wx_order set order_status=#{orderStatus}
where tenant_id=#{tenantId}
<if test=" null != parentTenantId "> and `parent_tenant_id` = #{parentTenantId} </if>
and order_group_id=#{orderGroupId} and order_status=10
where order_group_id=#{orderGroupId} and order_status=10
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
</update>
<update id="updateOrderStatusForGroup">


+ 2
- 3
mallinkService/src/main/resources/mapper/WxParkMapper.xml View File

@@ -29,11 +29,10 @@
and `id` = #{id}
</if>

<if test=" null != tenantId ">
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>

<if test=" null != parentTenantId ">
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>



Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save