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
b22a9115
Commit
b22a9115
authored
Sep 02, 2025
by
tianbo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor(jg): 重构使用登记查询 SQL
- 优化了字段别名的定义 - 调整了排序字段的引用
parent
e54465bb
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
74 deletions
+6
-74
JgUseRegistrationMapper.xml
...api/src/main/resources/mapper/JgUseRegistrationMapper.xml
+6
-74
No files found.
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/resources/mapper/JgUseRegistrationMapper.xml
View file @
b22a9115
...
@@ -519,89 +519,21 @@
...
@@ -519,89 +519,21 @@
JOIN idx_biz_jg_other_info other ON jri."RECORD" = other."RECORD"
JOIN idx_biz_jg_other_info other ON jri."RECORD" = other."RECORD"
WHERE re.equip_transfer_id = md.sequenceNbr) AS supervisoryCode
WHERE re.equip_transfer_id = md.sequenceNbr) AS supervisoryCode
FROM main_data md
FROM main_data md
GROUP BY md.sequenceNbr
WITH filtered_main_ids AS (
SELECT fu.sequence_nbr
FROM tzs_jg_use_registration fu
WHERE fu.is_delete = '0'
AND exists(
SELECT 1 FROM tzs_jg_use_registration_eq re
INNER JOIN idx_biz_jg_register_info jri ON re.equ_id = jri."RECORD"
LEFT JOIN idx_biz_jg_other_info other ON jri."RECORD" = other."RECORD"
WHERE re.equip_transfer_id = fu.sequence_nbr
)
)
SELECT
fu.sequence_nbr AS sequenceNbr,
fu.audit_status AS auditStatus,
DATE_FORMAT(fu.reg_date,'%Y-%m-%d') AS regDate,
fu.use_unit_name AS useUnitName,
fu.supervision_org_code AS supervisionOrgCode,
fu.status,
fu.receive_org_name AS receiveOrgName,
fu.use_address AS place,
fu.instance_id AS instanceId,
fu.apply_no AS applyNo,
fu.next_execute_ids AS nextExecuteIds,
fu.promoter,
fu.use_registration_code AS useRegistrationCode,
DATE_FORMAT(fu.audit_pass_date,'%Y-%m-%d') AS auditPassDate,
DATE_FORMAT(fu.create_date,'%Y-%m-%d') AS createDate,
fu.receive_org_name AS receiveOrgName,
fu.next_execute_user_ids AS nextExecuteUserIds,
fu.next_task_id AS nextTaskId,
fu.create_user_id AS createUserId,
fu.rec_date AS recDate,
fu.manage_type AS manageType,
fu.reg_type AS regType,
fu.is_delete,
fu.create_date,
fu.receive_company_code,
fu.use_unit_credit_code,
fu.transfer_to_user_ids,
fu.supervision_org_code,
fu.use_address AS fullAddress,
fu.cancel_reason AS cancelReason,
fu.project_contraption_id AS projectContraptionId,
(select company_name from privilege_company where org_code = fu.supervision_org_code and is_deleted = false limit 1) AS orgBranchName,
COALESCE(STRING_AGG(DISTINCT re.equ_id, ','), '') AS equipId,
COALESCE(STRING_AGG(DISTINCT other.supervisory_code, ','), '') AS supervisoryCode,
COALESCE(STRING_AGG(DISTINCT other.CODE96333, ','), '') AS code96333,
COALESCE(STRING_AGG(DISTINCT jri.PRODUCT_NAME, ','), '') AS productName,
COALESCE(STRING_AGG(DISTINCT jri.EQU_CODE, ','), '') AS equCode,
COALESCE(STRING_AGG(DISTINCT jri.EQU_LIST, ','), '') AS equListCode,
COALESCE(STRING_AGG(DISTINCT jri.EQU_CATEGORY, ','), '') AS equCategoryCode,
COALESCE(STRING_AGG(DISTINCT jri.EQU_DEFINE, ','), '') AS equDefineCode,
COALESCE(STRING_AGG(DISTINCT c_list.name, ','), '') AS equListName,
COALESCE(STRING_AGG(DISTINCT c_cate.name, ','), '') AS equCategory,
COALESCE(STRING_AGG(DISTINCT c_def.name, ','), '') AS equDefine
FROM filtered_main_ids fm
JOIN tzs_jg_use_registration fu ON fm.sequence_nbr = fu.sequence_nbr
LEFT JOIN tzs_jg_use_registration_eq re ON fu.sequence_nbr = re.equip_transfer_id
LEFT JOIN idx_biz_jg_register_info jri ON re.equ_id = jri."RECORD"
LEFT JOIN idx_biz_jg_other_info other ON jri."RECORD" = other."RECORD"
LEFT JOIN tz_equipment_category c_list ON jri.EQU_LIST = c_list.code
LEFT JOIN tz_equipment_category c_cate ON jri.EQU_CATEGORY = c_cate.code
LEFT JOIN tz_equipment_category c_def ON jri.EQU_DEFINE = c_def.code
GROUP BY fu.sequence_nbr
ORDER BY
ORDER BY
<choose>
<choose>
<when
test=
"sort != null and sort.field != null and sort.sortType != null"
>
<when
test=
"sort != null and sort.field != null and sort.sortType != null"
>
<choose>
<choose>
<when
test=
"sort.field == 'create_date'"
>
fu
.create_date
</when>
<when
test=
"sort.field == 'create_date'"
>
md
.create_date
</when>
<when
test=
"sort.field == 'apply_no'"
>
fu.apply_n
o
</when>
<when
test=
"sort.field == 'apply_no'"
>
md.applyN
o
</when>
<when
test=
"sort.field == 'reg_date'"
>
fu.reg_dat
e
</when>
<when
test=
"sort.field == 'reg_date'"
>
md.regTyp
e
</when>
<when
test=
"sort.field == 'audit_pass_date'"
>
fu.audit
_pass_d
ate
</when>
<when
test=
"sort.field == 'audit_pass_date'"
>
fu.audit
PassD
ate
</when>
<otherwise>
${sort.field}
</otherwise>
<otherwise>
${sort.field}
</otherwise>
</choose>
</choose>
${sort.sortType}
${sort.sortType}
</when>
</when>
<otherwise>
<otherwise>
fu.create_date DESC, fu.apply_n
o DESC
md.create_date DESC, md.applyN
o DESC
</otherwise>
</otherwise>
</choose>
</choose>
LIMIT #{size} OFFSET #{offset}
LIMIT #{size} OFFSET #{offset}
...
...
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