Commit 1466aa02 authored by 麻笑宇's avatar 麻笑宇

sql优化

parent 6844858f
......@@ -1126,6 +1126,7 @@
SELECT code, name FROM tz_equipment_category
),
filtered_data AS (
<if test="treeValue != null or dto.businessTypeCode == 'sy_dj'">
SELECT
tjur.sequence_nbr AS sequenceNbr,
'使用登记' AS businessType,
......@@ -1167,12 +1168,17 @@
<if test="dto.equCategoryCode != null and dto.equCategoryCode != ''">
AND ri.EQU_CATEGORY = #{dto.equCategoryCode}
</if>
<if test="dto.status != null and dto.status != ''">
AND tjur.status = #{dto.status}
<if test="dto.status != null and dto.status != '' and dto.status != '6616'">
and tjur.status != '已完成'
</if>
<if test="dto.status != null and dto.status != '' and dto.status == '6616'">
and tjur.status = '已完成'
</if>
</if>
<if test="treeValue != null">
UNION ALL
</if>
<if test="treeValue != null or dto.businessTypeCode == 'car_cyl_dj'">
SELECT DISTINCT
tjvi.sequence_nbr AS sequenceNbr,
'车用气瓶登记' AS businessType,
......@@ -1213,8 +1219,12 @@
<if test="dto.equCategoryCode != null and dto.equCategoryCode != ''">
AND ri.EQU_CATEGORY = #{dto.equCategoryCode}
</if>
<if test="dto.status != null and dto.status != ''">
AND tjvi.status = #{dto.status}
<if test="dto.status != null and dto.status != '' and dto.status != '6616'">
and tjvi.status != '已完成'
</if>
<if test="dto.status != null and dto.status != '' and dto.status == '6616'">
and tjvi.status = '已完成'
</if>
</if>
)
SELECT * FROM filtered_data ORDER BY createDate DESC
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment