多租户层级查询优化
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
FROM orders o
|
||||
LEFT JOIN tourisms t ON o.tourism_id = t.id
|
||||
<where>
|
||||
<!-- 业务筛选条件 -->
|
||||
<if test="p.orderNo != null and p.orderNo != ''">
|
||||
AND o.order_no LIKE CONCAT('%', #{p.orderNo}, '%')
|
||||
</if>
|
||||
@@ -20,15 +21,33 @@
|
||||
<if test="p.deviceSn != null and p.deviceSn != ''">
|
||||
AND o.device_sn LIKE CONCAT('%', #{p.deviceSn}, '%')
|
||||
</if>
|
||||
<!-- 兼容 dashboard 透传的 qrcodeId 与现有 codeId 参数名 -->
|
||||
<if test="p.codeId != null and p.codeId != ''">
|
||||
AND o.code_id LIKE CONCAT('%', #{p.codeId}, '%')
|
||||
</if>
|
||||
<if test="p.qrcodeId != null and p.qrcodeId != ''">
|
||||
AND o.code_id LIKE CONCAT('%', #{p.qrcodeId}, '%')
|
||||
</if>
|
||||
<if test="p.userId != null and p.userId != ''">
|
||||
AND o.user_id LIKE CONCAT('%', #{p.userId}, '%')
|
||||
</if>
|
||||
<if test="p.mobile != null and p.mobile != ''">
|
||||
AND o.mobile LIKE CONCAT('%', #{p.mobile}, '%')
|
||||
</if>
|
||||
|
||||
<!-- 时间范围(与仪表盘统计口径一致) -->
|
||||
<if test="p.startTime != null and p.startTime != ''">
|
||||
AND o.create_time >= #{p.startTime}
|
||||
</if>
|
||||
<if test="p.endTime != null and p.endTime != ''">
|
||||
AND o.create_time <= #{p.endTime}
|
||||
</if>
|
||||
|
||||
<!-- 景区集合过滤(由租户+子孙→景区ID集合的去重结果提供) -->
|
||||
<if test="p.tourismIds != null and p.tourismIds.size > 0">
|
||||
AND o.tourism_id IN
|
||||
<foreach collection="p.tourismIds" item="tid" open="(" separator="," close=")">#{tid}</foreach>
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY o.create_time DESC
|
||||
</select>
|
||||
|
||||
Reference in New Issue
Block a user