ソースを参照

意向用户 org_id

魏熙美 5 年 前
コミット
bd3a2ebcb8
共有1 個のファイルを変更した7 個の追加3 個の削除を含む
  1. 7
    3
      src/main/resources/mapper/TaPersonIntentionRecordMapper.xml

+ 7
- 3
src/main/resources/mapper/TaPersonIntentionRecordMapper.xml ファイルの表示

@@ -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>