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

sql优化

parent 6844858f
...@@ -1126,6 +1126,7 @@ ...@@ -1126,6 +1126,7 @@
SELECT code, name FROM tz_equipment_category SELECT code, name FROM tz_equipment_category
), ),
filtered_data AS ( filtered_data AS (
<if test="treeValue != null or dto.businessTypeCode == 'sy_dj'">
SELECT SELECT
tjur.sequence_nbr AS sequenceNbr, tjur.sequence_nbr AS sequenceNbr,
'使用登记' AS businessType, '使用登记' AS businessType,
...@@ -1167,12 +1168,17 @@ ...@@ -1167,12 +1168,17 @@
<if test="dto.equCategoryCode != null and dto.equCategoryCode != ''"> <if test="dto.equCategoryCode != null and dto.equCategoryCode != ''">
AND ri.EQU_CATEGORY = #{dto.equCategoryCode} AND ri.EQU_CATEGORY = #{dto.equCategoryCode}
</if> </if>
<if test="dto.status != null and dto.status != ''"> <if test="dto.status != null and dto.status != '' and dto.status != '6616'">
AND tjur.status = #{dto.status} and tjur.status != '已完成'
</if> </if>
<if test="dto.status != null and dto.status != '' and dto.status == '6616'">
and tjur.status = '已完成'
</if>
</if>
<if test="treeValue != null">
UNION ALL UNION ALL
</if>
<if test="treeValue != null or dto.businessTypeCode == 'car_cyl_dj'">
SELECT DISTINCT SELECT DISTINCT
tjvi.sequence_nbr AS sequenceNbr, tjvi.sequence_nbr AS sequenceNbr,
'车用气瓶登记' AS businessType, '车用气瓶登记' AS businessType,
...@@ -1213,8 +1219,12 @@ ...@@ -1213,8 +1219,12 @@
<if test="dto.equCategoryCode != null and dto.equCategoryCode != ''"> <if test="dto.equCategoryCode != null and dto.equCategoryCode != ''">
AND ri.EQU_CATEGORY = #{dto.equCategoryCode} AND ri.EQU_CATEGORY = #{dto.equCategoryCode}
</if> </if>
<if test="dto.status != null and dto.status != ''"> <if test="dto.status != null and dto.status != '' and dto.status != '6616'">
AND tjvi.status = #{dto.status} and tjvi.status != '已完成'
</if>
<if test="dto.status != null and dto.status != '' and dto.status == '6616'">
and tjvi.status = '已完成'
</if>
</if> </if>
) )
SELECT * FROM filtered_data ORDER BY createDate DESC 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