|
@@ -22,12 +22,16 @@
|
22
|
22
|
SUM(tpir.intention) as intention
|
23
|
23
|
FROM
|
24
|
24
|
ta_person_intention_record tpir
|
25
|
|
- LEFT JOIN ta_person tp on tpir.person_id = tp.person_id AND tp.org_id = #{orgId}
|
26
|
|
- <where>
|
|
25
|
+ LEFT JOIN ta_person tp on tpir.person_id = tp.person_id
|
|
26
|
+ <trim prefix="where" prefixOverrides="and | or">
|
27
|
27
|
<if test="buildingId != null and buildingId != ''">
|
28
|
28
|
tpir.building_id = #{buildingId}
|
29
|
29
|
</if>
|
30
|
|
- </where>
|
|
30
|
+ <if test="orgId != null">
|
|
31
|
+ AND tpir.org_id = #{orgId}
|
|
32
|
+ AND tp.org_id = #{orgId}
|
|
33
|
+ </if>
|
|
34
|
+ </trim>
|
31
|
35
|
GROUP BY
|
32
|
36
|
tpir.person_id, tpir.building_id
|
33
|
37
|
</select>
|