diff --git a/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml b/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml
index f29ed171b..6c59e1e2e 100644
--- a/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml
+++ b/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml
@@ -26,10 +26,10 @@
- `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
@@ -37,74 +37,77 @@
where 1 = 1
- and `id` = #{id}
+ and cub.`id` = #{id}
-
- and `tenant_id` = #{tenantId}
+
+ and cub.`tenant_id` = #{tenantId}
+
+
+ and cu.`parent_tenant_id` = #{parentTenantId}
- and `phone` like concat('%', #{phone},'%')
+ and cub.`phone` like concat('%', #{phone},'%')
- and `birthdate` = #{birthdate}
+ and cub.`birthdate` = #{birthdate}
- and `education` like concat('%', #{education},'%')
+ and cub.`education` like concat('%', #{education},'%')
- and `sex` = #{sex}
+ and cub.`sex` = #{sex}
- and `email` like concat('%', #{email},'%')
+ and cub.`email` like concat('%', #{email},'%')
- and `address` like concat('%', #{address},'%')
+ and cub.`address` like concat('%', #{address},'%')
- and `poins` = #{poins}
+ and cub.`poins` = #{poins}
- and `credit` = #{credit}
+ and cub.`credit` = #{credit}
- and `tag_id` = #{tagId}
+ and cub.`tag_id` = #{tagId}
- and `create_date` = #{createDate}
+ and cub.`create_date` = #{createDate}
- and `update_date` = #{updateDate}
+ and cub.`update_date` = #{updateDate}
- and `act_record` = #{actRecord}
+ and cub.`act_record` = #{actRecord}
- and `name` like concat('%', #{name},'%')
+ and cub.`name` like concat('%', #{name},'%')
- and `create_date` between #{startTime} and #{endTime}
+ and cub.`create_date` between #{startTime} and #{endTime}
- and `status` = #{status}
+ and cub.`status` = #{status}
- and id in
+ and cub.id in
#{idItem}
@@ -116,7 +119,8 @@
select r.* from (
select
- from wx_c_user_basic_info
+ from wx_c_user_basic_info cub
+ inner join wx_c_user cu on cu.id = cub.id
) r where 1=1
@@ -132,81 +136,95 @@
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}
@@ -235,8 +253,11 @@
and cub.poins is null
-
- and cub.tenant_id =#{tenantId}
+
+ and cub.`tenant_id` = #{tenantId}
+
+
+ and cu.`parent_tenant_id` = #{parentTenantId}
@@ -248,29 +269,37 @@
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 cu.`parent_tenant_id` = #{parentTenantId}
- (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
- date_format(create_date, '%Y-%m-%d') <= reportTime
+ and cubi.date_format(create_date, '%Y-%m-%d') <= reportTime
- date_format(create_date, '%Y-%m') <= reportTime
+ and cubi.date_format(create_date, '%Y-%m') <= reportTime
- date_format(create_date, '%Y') <= reportTime
+ and cubi.date_format(create_date, '%Y') <= reportTime
-
- and tenant_id =#{tenantId}
+
+ and cubi.`tenant_id` = #{tenantId}
+
+
+ and cu1.`parent_tenant_id` = #{parentTenantId}
) as totalCount
- from wx_c_user_basic_info where 1=1
-
- 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
+
+ and cub.`tenant_id` = #{tenantId}
+
+
+ and cu.`parent_tenant_id` = #{parentTenantId}
- and create_date >= #{startTime}
+ and cub.create_date >= #{startTime}
- and create_date < #{endTime}
+ and cub.create_date < #{endTime}
- group by reportTime
+ group by cub.reportTime
@@ -348,9 +386,12 @@
and cu.`id` = #{id}
-
+
and cu.`tenant_id` = #{tenantId}
+
+ and c.`parent_tenant_id` = #{parentTenantId}
+
and cu.`phone` like concat('%', #{phone},'%')
@@ -415,6 +456,7 @@
select
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`
@@ -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`
@@ -434,8 +477,12 @@
where 1=1
-
- and cu.tenant_id =#{tenantId}
+
+
+ and cu.`tenant_id` = #{tenantId}
+
+
+ and c.`parent_tenant_id` = #{parentTenantId}
@@ -503,6 +550,7 @@