diff --git a/mallinkAdmin/src/main/resources/db/migration/V2020070131031__GROUP__ADD_001.sql b/mallinkAdmin/src/main/resources/db/migration/V2020070131031__GROUP__ADD_001.sql
new file mode 100644
index 000000000..5bf81edb6
--- /dev/null
+++ b/mallinkAdmin/src/main/resources/db/migration/V2020070131031__GROUP__ADD_001.sql
@@ -0,0 +1,2 @@
+ALTER TABLE `wx_c_user_basic_info`
+ADD COLUMN `parent_tenant_id` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '父租户ID' AFTER `tenant_id`;
\ No newline at end of file
diff --git a/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml b/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml
index 659df49d5..d5da0055c 100644
--- a/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml
+++ b/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml
@@ -14,6 +14,7 @@
+
@@ -27,9 +28,9 @@
`id`,`phone`,`birthdate`,`education`,`sex`,`email`,`address`,`poins`,`tag_id`,
- `create_date`,`update_date`,`tenant_id`,`name`,`nick_name`,`credit`,`active_time`,`act_record`
+ `create_date`,`update_date`,`tenant_id`,`parent_tenant_id`,`name`,`nick_name`,`credit`,`active_time`,`act_record`
,(select level from wx_level_config
- where poins >= points and tenant_id=#{tenantId}
+ where poins >= points and tenant_id=wcubi.tenant_id
order by points desc limit 1 ) level,status
@@ -40,9 +41,12 @@
and `id` = #{id}
-
+
and `tenant_id` = #{tenantId}
+
+ and `parent_tenant_id` = #{parentTenantId}
+
and `phone` like concat('%', #{phone},'%')
@@ -116,7 +120,7 @@
select r.* from (
select
- from wx_c_user_basic_info
+ from wx_c_user_basic_info wcubi
) r where 1=1
@@ -132,14 +136,13 @@
update wx_c_user_basic_info set poins=#{poins}
- where phone=#{phone} and tenant_id=#{tenantId}
+ where phone=#{phone}
and id=#{id}
update wx_c_user_basic_info set id=#{newId} , credit=#{credit} , poins=#{poins}
- where tenant_id=#{tenantId}
- and id = #{id}
+ where id = #{id}
@@ -178,8 +184,11 @@
and birthdate is null
-
- and tenant_id =#{tenantId}
+
+ and `tenant_id` = #{tenantId}
+
+
+ and `parent_tenant_id` = #{parentTenantId}
@@ -205,8 +214,11 @@
and poins is null
-
- and tenant_id =#{tenantId}
+
+ and `tenant_id` = #{tenantId}
+
+
+ and `parent_tenant_id` = #{parentTenantId}
@@ -235,8 +247,11 @@
and cub.poins is null
-
- and cub.tenant_id =#{tenantId}
+
+ and cub.`tenant_id` = #{tenantId}
+
+
+ and cub.`parent_tenant_id` = #{parentTenantId}
@@ -248,8 +263,11 @@
where cub.status = 0 and cu.phone is not null
AND DATE_FORMAT(cub.birthdate,'%m-%d') >= #{begin}
AND DATE_FORMAT(cub.birthdate,'%m-%d') <= #{end}
-
- and cub.tenant_id = #{tenantId}
+
+ and cub.`tenant_id` = #{tenantId}
+
+
+ and cub.`parent_tenant_id` = #{parentTenantId}
@@ -261,8 +279,11 @@
and create_date < #{endTime}
-
- and tenant_id =#{tenantId}
+
+ and `tenant_id` = #{tenantId}
+
+
+ and `parent_tenant_id` = #{parentTenantId}
and create_date like '%00:00:00'
@@ -293,15 +314,21 @@
date_format(create_date, '%Y') <= reportTime
-
- and tenant_id =#{tenantId}
+
+ and `tenant_id` = #{tenantId}
+
+
+ and `parent_tenant_id` = #{parentTenantId}
) as totalCount
from wx_c_user_basic_info where 1=1
-
- and tenant_id =#{tenantId}
+
+ and `tenant_id` = #{tenantId}
+
+
+ and `parent_tenant_id` = #{parentTenantId}
and create_date >= #{startTime}
@@ -348,9 +375,12 @@
and cu.`id` = #{id}
-
+
and cu.`tenant_id` = #{tenantId}
+
+ and cu.`parent_tenant_id` = #{parentTenantId}
+
and cu.`phone` like concat('%', #{phone},'%')
@@ -434,8 +464,11 @@
where 1=1
-
- and cu.tenant_id =#{tenantId}
+
+ and cu.`tenant_id` = #{tenantId}
+
+
+ and cu.`parent_tenant_id` = #{parentTenantId}
@@ -521,15 +554,21 @@
diff --git a/mallinkService/src/main/resources/mapper/WxCUserCarMapper.xml b/mallinkService/src/main/resources/mapper/WxCUserCarMapper.xml
index 1f4a2a63e..4316f7a1d 100644
--- a/mallinkService/src/main/resources/mapper/WxCUserCarMapper.xml
+++ b/mallinkService/src/main/resources/mapper/WxCUserCarMapper.xml
@@ -4,6 +4,7 @@
+
@@ -13,7 +14,7 @@
- `id`,`tenant_id`,`c_user_id`,`car_number`,`create_date`,`update_date`,`vendor_type`,`vendor_params`
+ `id`,`tenant_id`,`parent_tenant_id`,`c_user_id`,`car_number`,`create_date`,`update_date`,`vendor_type`,`vendor_params`
@@ -22,12 +23,14 @@
and `id` = #{id}
-
-
-
- and `tenant_id` = #{tenantId}
-
-
+
+
+
+ and `tenant_id` = #{tenantId}
+
+
+ and `parent_tenant_id` = #{parentTenantId}
+
and `c_user_id` = #{cUserId}
@@ -82,10 +85,14 @@
diff --git a/mallinkService/src/main/resources/mapper/WxCUserMapper.xml b/mallinkService/src/main/resources/mapper/WxCUserMapper.xml
index e7f20e98d..b00fab155 100644
--- a/mallinkService/src/main/resources/mapper/WxCUserMapper.xml
+++ b/mallinkService/src/main/resources/mapper/WxCUserMapper.xml
@@ -66,8 +66,11 @@
and `id` = #{id}
-
- and `tenant_id`= #{tenantId}
+
+ and `tenant_id` = #{tenantId}
+
+
+ and `parent_tenant_id` = #{parentTenantId}