魏超 пре 5 година
родитељ
комит
edcd8c4638
1 измењених фајлова са 28 додато и 25 уклоњено
  1. 28
    25
      src/main/resources/mapper/TaPersonVisitRecordMapper.xml

+ 28
- 25
src/main/resources/mapper/TaPersonVisitRecordMapper.xml Прегледај датотеку

@@ -120,31 +120,34 @@
120 120
     </select>
121 121
 
122 122
     <select id="getDrainageVisitRecord" resultType="com.huiju.estateagents.entity.TaPersonVisitRecord">
123
-        select
124
-        <include refid="columnSql"></include>,
125
-        b.name as activityName,
126
-        b.drainage_id
127
-        from ta_person_visit_record t
128
-        left join ta_drainage b on t.target_id = b.drainage_id
129
-        left join ta_person c on t.share_person_id = c.person_id
130
-        where
131
-        t.event_type = 'h5'
132
-        and t.share_person_id is not null
133
-        <if test="orgId != null and orgId != ''">
134
-            and t.org_id = #{orgId}
135
-        </if>
136
-        <if test="drainageId !=null and drainageId != ''">
137
-            and b.drainage_Id = #{drainageId}
138
-        </if>
139
-        <if test="activityName !=null and activityName != ''">
140
-            and b.name like concat('%',#{activityName},'%')
141
-        </if>
142
-        <if test="shareName !=null and shareName != ''">
143
-            and c.nickname like concat('%',#{shareName},'%')
144
-        </if>
145
-        <if test="shareTel !=null and shareTel != ''">
146
-            and c.phone = #{shareTel}
147
-        </if>
123
+        select * from (
124
+            select
125
+            <include refid="columnSql"></include>,
126
+            b.name as activityName,
127
+            b.drainage_id
128
+            from ta_person_visit_record t
129
+            left join ta_drainage b on t.target_id = b.drainage_id
130
+            left join ta_person c on t.share_person_id = c.person_id
131
+            where
132
+            t.event_type = 'h5'
133
+            and t.share_person_id is not null
134
+            <if test="orgId != null and orgId != ''">
135
+                and t.org_id = #{orgId}
136
+            </if>
137
+            <if test="drainageId !=null and drainageId != ''">
138
+                and b.drainage_Id = #{drainageId}
139
+            </if>
140
+            <if test="activityName !=null and activityName != ''">
141
+                and b.name like concat('%',#{activityName},'%')
142
+            </if>
143
+            <if test="shareName !=null and shareName != ''">
144
+                and c.nickname like concat('%',#{shareName},'%')
145
+            </if>
146
+            <if test="shareTel !=null and shareTel != ''">
147
+                and c.phone = #{shareTel}
148
+            </if>
149
+            order by t.visit_time desc
150
+        ) t
148 151
         group by t.person_id, t.share_person_id
149 152
         order by t.visit_time desc
150 153
     </select>