Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
项目统一框架
amos-boot-biz
Commits
1466aa02
Commit
1466aa02
authored
Nov 13, 2024
by
麻笑宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sql优化
parent
6844858f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
97 additions
and
87 deletions
+97
-87
JGStatisticsMapper.xml
...tics-api/src/main/resources/mapper/JGStatisticsMapper.xml
+97
-87
No files found.
amos-boot-system-tzs/amos-boot-module-statistics/amos-boot-module-statistics-api/src/main/resources/mapper/JGStatisticsMapper.xml
View file @
1466aa02
...
...
@@ -1126,95 +1126,105 @@
SELECT code, name FROM tz_equipment_category
),
filtered_data AS (
SELECT
tjur.sequence_nbr AS sequenceNbr,
'使用登记' AS businessType,
tjur.apply_no AS applyNo,
ec_equ_list.name AS equList,
ec_equ_category.name AS equCategory,
tjur.use_unit_name AS unitName,
tjur.receive_org_name AS receiveOrgName,
tjur.create_date AS createDate,
tjur.audit_pass_date AS handleDate,
CASE
WHEN tjur.status = '已完成' THEN '已完成'
ELSE '进行中'
END AS status
FROM tzs_jg_use_registration tjur
LEFT JOIN tzs_jg_use_registration_eq tne ON tjur.sequence_nbr = tne.equip_transfer_id
LEFT JOIN idx_biz_jg_register_info ri ON tne.equ_id = ri.RECORD
LEFT JOIN equipment_category ec_equ_list ON ec_equ_list.code = ri.EQU_LIST
LEFT JOIN equipment_category ec_equ_category ON ec_equ_category.code = ri.EQU_CATEGORY
WHERE
receive_company_org_code LIKE CONCAT(#{orgCode}, '%')
AND tjur.status != '已作废'
AND tjur.is_delete = 0
<if
test=
"dto.beginDate != null and dto.beginDate != ''"
>
and date_ge(CAST(audit_pass_date as date),#{dto.beginDate})
</if>
<if
test=
"dto.endDate != null and dto.endDate != ''"
>
and date_le(CAST(audit_pass_date as date),#{dto.endDate})
</if>
<if
test=
"dto.companyName != null and dto.companyName != ''"
>
AND tjur.use_unit_name LIKE CONCAT('%', #{dto.companyName}, '%')
</if>
<if
test=
"dto.superviseUnitName != null and dto.superviseUnitName != ''"
>
AND tjur.receive_org_name LIKE CONCAT('%', #{dto.superviseUnitName}, '%')
</if>
<if
test=
"dto.equListCode != null and dto.equListCode != ''"
>
AND ri.EQU_LIST = #{dto.equListCode}
</if>
<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>
UNION ALL
SELECT DISTINCT
tjvi.sequence_nbr AS sequenceNbr,
'车用气瓶登记' AS businessType,
tjvi.apply_no AS applyNo,
ec_equ_list.name AS equList,
ec_equ_category.name AS equCategory,
tjvi.install_unit_name AS unitName,
tjvi.receive_org_name AS receiveOrgName,
tjvi.create_date AS createDate,
tjvi.audit_pass_date AS handleDate,
CASE
WHEN tjvi.status = '已完成' THEN '已完成'
ELSE '进行中'
END AS status
FROM tzs_jg_vehicle_information tjvi
LEFT JOIN tzs_jg_vehicle_information_eq tjvie ON tjvi.sequence_nbr = tjvie.vehicle_id
LEFT JOIN idx_biz_jg_register_info ri ON tjvie.equ_id = ri.RECORD
LEFT JOIN equipment_category ec_equ_list ON ec_equ_list.code = ri.EQU_LIST
LEFT JOIN equipment_category ec_equ_category ON ec_equ_category.code = ri.EQU_CATEGORY
WHERE
tjvi.org_branch_code LIKE CONCAT(#{orgCode}, '%')
AND tjvi.status != '已作废'
<if
test=
"dto.beginDate != null and dto.beginDate != ''"
>
and date_ge(CAST(audit_pass_date as date),#{dto.beginDate})
</if>
<if
test=
"dto.endDate != null and dto.endDate != ''"
>
and date_le(CAST(audit_pass_date as date),#{dto.endDate})
</if>
<if
test=
"dto.companyName != null and dto.companyName != ''"
>
AND tjvi.use_unit_name LIKE CONCAT('%', #{dto.companyName}, '%')
</if>
<if
test=
"dto.superviseUnitName != null and dto.superviseUnitName != ''"
>
AND tjvi.receive_org_name LIKE CONCAT('%', #{dto.superviseUnitName}, '%')
</if>
<if
test=
"dto.equListCode != null and dto.equListCode != ''"
>
AND ri.EQU_LIST = #{dto.equListCode}
<if
test=
"treeValue != null or dto.businessTypeCode == 'sy_dj'"
>
SELECT
tjur.sequence_nbr AS sequenceNbr,
'使用登记' AS businessType,
tjur.apply_no AS applyNo,
ec_equ_list.name AS equList,
ec_equ_category.name AS equCategory,
tjur.use_unit_name AS unitName,
tjur.receive_org_name AS receiveOrgName,
tjur.create_date AS createDate,
tjur.audit_pass_date AS handleDate,
CASE
WHEN tjur.status = '已完成' THEN '已完成'
ELSE '进行中'
END AS status
FROM tzs_jg_use_registration tjur
LEFT JOIN tzs_jg_use_registration_eq tne ON tjur.sequence_nbr = tne.equip_transfer_id
LEFT JOIN idx_biz_jg_register_info ri ON tne.equ_id = ri.RECORD
LEFT JOIN equipment_category ec_equ_list ON ec_equ_list.code = ri.EQU_LIST
LEFT JOIN equipment_category ec_equ_category ON ec_equ_category.code = ri.EQU_CATEGORY
WHERE
receive_company_org_code LIKE CONCAT(#{orgCode}, '%')
AND tjur.status != '已作废'
AND tjur.is_delete = 0
<if
test=
"dto.beginDate != null and dto.beginDate != ''"
>
and date_ge(CAST(audit_pass_date as date),#{dto.beginDate})
</if>
<if
test=
"dto.endDate != null and dto.endDate != ''"
>
and date_le(CAST(audit_pass_date as date),#{dto.endDate})
</if>
<if
test=
"dto.companyName != null and dto.companyName != ''"
>
AND tjur.use_unit_name LIKE CONCAT('%', #{dto.companyName}, '%')
</if>
<if
test=
"dto.superviseUnitName != null and dto.superviseUnitName != ''"
>
AND tjur.receive_org_name LIKE CONCAT('%', #{dto.superviseUnitName}, '%')
</if>
<if
test=
"dto.equListCode != null and dto.equListCode != ''"
>
AND ri.EQU_LIST = #{dto.equListCode}
</if>
<if
test=
"dto.equCategoryCode != null and dto.equCategoryCode != ''"
>
AND ri.EQU_CATEGORY = #{dto.equCategoryCode}
</if>
<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=
"
dto.equCategoryCode != null and dto.equCategoryCode != ''
"
>
AND ri.EQU_CATEGORY = #{dto.equCategoryCode}
<if
test=
"
treeValue != null
"
>
UNION ALL
</if>
<if
test=
"dto.status != null and dto.status != ''"
>
AND tjvi.status = #{dto.status}
<if
test=
"treeValue != null or dto.businessTypeCode == 'car_cyl_dj'"
>
SELECT DISTINCT
tjvi.sequence_nbr AS sequenceNbr,
'车用气瓶登记' AS businessType,
tjvi.apply_no AS applyNo,
ec_equ_list.name AS equList,
ec_equ_category.name AS equCategory,
tjvi.install_unit_name AS unitName,
tjvi.receive_org_name AS receiveOrgName,
tjvi.create_date AS createDate,
tjvi.audit_pass_date AS handleDate,
CASE
WHEN tjvi.status = '已完成' THEN '已完成'
ELSE '进行中'
END AS status
FROM tzs_jg_vehicle_information tjvi
LEFT JOIN tzs_jg_vehicle_information_eq tjvie ON tjvi.sequence_nbr = tjvie.vehicle_id
LEFT JOIN idx_biz_jg_register_info ri ON tjvie.equ_id = ri.RECORD
LEFT JOIN equipment_category ec_equ_list ON ec_equ_list.code = ri.EQU_LIST
LEFT JOIN equipment_category ec_equ_category ON ec_equ_category.code = ri.EQU_CATEGORY
WHERE
tjvi.org_branch_code LIKE CONCAT(#{orgCode}, '%')
AND tjvi.status != '已作废'
<if
test=
"dto.beginDate != null and dto.beginDate != ''"
>
and date_ge(CAST(audit_pass_date as date),#{dto.beginDate})
</if>
<if
test=
"dto.endDate != null and dto.endDate != ''"
>
and date_le(CAST(audit_pass_date as date),#{dto.endDate})
</if>
<if
test=
"dto.companyName != null and dto.companyName != ''"
>
AND tjvi.use_unit_name LIKE CONCAT('%', #{dto.companyName}, '%')
</if>
<if
test=
"dto.superviseUnitName != null and dto.superviseUnitName != ''"
>
AND tjvi.receive_org_name LIKE CONCAT('%', #{dto.superviseUnitName}, '%')
</if>
<if
test=
"dto.equListCode != null and dto.equListCode != ''"
>
AND ri.EQU_LIST = #{dto.equListCode}
</if>
<if
test=
"dto.equCategoryCode != null and dto.equCategoryCode != ''"
>
AND ri.EQU_CATEGORY = #{dto.equCategoryCode}
</if>
<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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment