weichaochao 5 years ago
parent
commit
aad505b535

+ 1
- 1
src/main/resources/mapper/TaPersonBuildingMapper.xml View File

8
         left join ta_person b on t.user_id = b.user_id
8
         left join ta_person b on t.user_id = b.user_id
9
         left join ta_share_count c on b.person_id = c.person_id
9
         left join ta_share_count c on b.person_id = c.person_id
10
         LEFT JOIN ta_building d on a.building_id = d.building_id
10
         LEFT JOIN ta_building d on a.building_id = d.building_id
11
-        where t.org_id = #{orgId}
11
+        where t.org_id = #{orgId} and t.is_consultant = 1
12
             <if test="buildingId != null and buildingId != ''">
12
             <if test="buildingId != null and buildingId != ''">
13
               and a.building_id = #{buildingId}
13
               and a.building_id = #{buildingId}
14
             </if>
14
             </if>

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

613
         if(a.sex = 1, '男', if(a.sex = 2, '女', '未知')) as sex,
613
         if(a.sex = 1, '男', if(a.sex = 2, '女', '未知')) as sex,
614
         CASE
614
         CASE
615
         WHEN b.NAME IS NULL THEN
615
         WHEN b.NAME IS NULL THEN
616
-        c.NAME ELSE b.NAME
616
+        d.user_name ELSE b.NAME
617
         END AS consultantName,
617
         END AS consultantName,
618
         CASE
618
         CASE
619
         WHEN b.tel IS NULL THEN
619
         WHEN b.tel IS NULL THEN
620
-        c.tel ELSE b.tel
620
+        d.phone ELSE b.tel
621
         END AS consultTel,
621
         END AS consultTel,
622
         t.building_name
622
         t.building_name
623
         FROM
623
         FROM

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

31
         from ta_share_count t
31
         from ta_share_count t
32
         left join ta_building_dynamic a on t.be_share = a.dynamic_id and t.tagert_type = 'activity'
32
         left join ta_building_dynamic a on t.be_share = a.dynamic_id and t.tagert_type = 'activity'
33
         left join ta_help_activity b on t.be_share = b.help_activity_id and t.tagert_type = 'help'
33
         left join ta_help_activity b on t.be_share = b.help_activity_id and t.tagert_type = 'help'
34
-        left join ta_share_activity c on t.be_share = c.share_id and t.tagert_type = 'group'
34
+        left join ta_share_activity c on t.be_share = c.group_activity_id and t.tagert_type = 'group'
35
         LEFT JOIN ta_drainage d on t.be_share = d.drainage_id and t.tagert_type = 'h5'
35
         LEFT JOIN ta_drainage d on t.be_share = d.drainage_id and t.tagert_type = 'h5'
36
         left join ta_building e on t.be_share = e.building_id and t.tagert_type = 'project'
36
         left join ta_building e on t.be_share = e.building_id and t.tagert_type = 'project'
37
         LEFT JOIN ta_news f on t.be_share = f.news_id and t.tagert_type = 'news'
37
         LEFT JOIN ta_news f on t.be_share = f.news_id and t.tagert_type = 'news'
67
                 when a.`name` != null || a.`name` != '' then a.`name`
67
                 when a.`name` != null || a.`name` != '' then a.`name`
68
                 else '空'
68
                 else '空'
69
                 end as shareTitle,
69
                 end as shareTitle,
70
-                        a.phone as personPhone,
71
-                        a.nickName as personName,
70
+                        z.phone as personPhone,
71
+                        z.nickName as personName,
72
                         t.create_date
72
                         t.create_date
73
 
73
 
74
         FROM
74
         FROM
81
                 left join ta_building e on t.target_id = e.building_id and t.target_type = 'building_share'
81
                 left join ta_building e on t.target_id = e.building_id and t.target_type = 'building_share'
82
                 LEFT JOIN ta_news f on t.target_id = f.news_id and t.target_type = 'news_share'
82
                 LEFT JOIN ta_news f on t.target_id = f.news_id and t.target_type = 'news_share'
83
 
83
 
84
-        LEFT JOIN ta_person a ON t.person_id = a.person_id and t.target_type = 'card_share'
84
+        LEFT JOIN ta_person a ON t.share_person = a.person_id or t.share_person = a.user_id
85
+        LEFT JOIN ta_person z ON t.person_id = z.person_id
85
         WHERE
86
         WHERE
86
             (t.share_person = (select user_id from ta_person where person_id = #{personId}) or t.share_person = #{personId})
87
             (t.share_person = (select user_id from ta_person where person_id = #{personId}) or t.share_person = #{personId})
87
         AND t.org_id = #{orgId}
88
         AND t.org_id = #{orgId}