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
ca7e9143
Commit
ca7e9143
authored
Nov 21, 2024
by
李秀明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
人员统计优化
parent
eaef1c40
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
71 additions
and
121 deletions
+71
-121
OrgUsrMapper.xml
...ule-common-api/src/main/resources/mapper/OrgUsrMapper.xml
+71
-121
No files found.
amos-boot-module/amos-boot-module-api/amos-boot-module-common-api/src/main/resources/mapper/OrgUsrMapper.xml
View file @
ca7e9143
...
...
@@ -1757,131 +1757,81 @@
<select
id=
"getCenterPersonInfoPage"
resultType=
"Map"
>
SELECT
LEFT (
a.biz_org_code,
18) AS bizOrgCode,
(
CASE
WHEN LENGTH( a.biz_org_code ) > 18 THEN
( SELECT cou.biz_org_name FROM cb_org_usr cou WHERE cou.biz_org_code = LEFT ( a.biz_org_code, 18 ) AND
cou.biz_org_type = 'COMPANY' ) ELSE ( SELECT cou.biz_org_name FROM cb_org_usr cou WHERE cou.biz_org_code = LEFT
( a.biz_org_code, 6 ) AND cou.biz_org_type = 'COMPANY' )
END
) AS bizOrgName,
SUM(
IF
( a.peopleType = '1601', 1, 0 )) AS fireNum,
SUM(
IF
( a.peopleType = '1602', 1, 0 )) AS ywNum,
ibsi.station_type AS stationType,
SUM(
IF
(
a.peopleType = '1601'
AND (
concat( fp.post_qualification_code, ',' ) REGEXP concat( REPLACE ( '1823,1824,1825,1826,1827', ',', ',|' ), ',') > 0
OR concat( fp.post_qualification_code, ',' ) REGEXP concat( REPLACE ( '1421,1422,1423,1424,1425', ',', ',|' ), ',' ) > 0
OR concat( fp.post_qualification_code, ',' ) REGEXP concat( REPLACE ( '1426,1427,1428,1429,1430,1431', ',', ',|' ), ',' ) > 0
),
1,
0
)) AS fireIsOk,
(
SUM(
IF
( a.peopleType = '1601', 1, 0 )) - SUM(
IF
(
a.peopleType = '1601'
AND (
concat( fp.post_qualification_code, ',' ) REGEXP concat( REPLACE ( '1823,1824,1825,1826,1827', ',', ',|' ), ',') > 0
OR concat( fp.post_qualification_code, ',' ) REGEXP concat( REPLACE ( '1421,1422,1423,1424,1425', ',', ',|' ), ',' ) > 0
OR concat( fp.post_qualification_code, ',' ) REGEXP concat( REPLACE ( '1426,1427,1428,1429,1430,1431', ',', ',|' ), ',' ) > 0
),
1,
0
))
) AS fireNoCard,
SUM(
IF
((
a.peopleType = '1602'
AND (
SELECT
concat( fp.post_qualification_code, ',' ) REGEXP concat( REPLACE ( '1427,1428,1429,1430,1431', ',', ',|' ), ','
)) = 0
OR (
SELECT
concat( fp.post_qualification_code, ',' ) REGEXP concat( REPLACE ( '1427,1428,1429,1430,1431', ',', ',|' ), ','
) IS NULL
AND a.peopleType = '1602'
)
),
1,
0
)) AS ywNotOk,
SUM(
IF
((
a.peopleType = '1602'
AND concat( fp.post_qualification_code, ',' ) REGEXP concat( REPLACE ( '1427', ',', ',|' ), ',' ) > 0
),
1,
0
)) AS ywCJ,
SUM(
IF
((
a.peopleType = '1602'
AND (
SELECT
concat( fp.post_qualification_code, ',' ) REGEXP concat( REPLACE ( '1428', ',', ',|' ), ',' )) > 0
),
1,
0
)) AS ywZJ
FROM
(
SELECT
*
LEFT(a.biz_org_code,18) AS bizOrgCode,
(
CASE WHEN LENGTH(a.biz_org_code) > 18
THEN (SELECT cou.biz_org_name FROM cb_org_usr cou WHERE cou.biz_org_code = LEFT(a.biz_org_code, 18) AND cou.biz_org_type = 'COMPANY')
ELSE (SELECT cou.biz_org_name FROM cb_org_usr cou WHERE cou.biz_org_code = LEFT(a.biz_org_code, 6) AND cou.biz_org_type = 'COMPANY')
END
) AS bizOrgName,
ibsi.station_type AS stationType,
SUM(IF(a.peopleType = '1601', 1, 0)) AS fireNum,
SUM(IF(a.peopleType = '1602', 1, 0)) AS ywNum,
SUM(
IF(a.peopleType = '1601' AND (
CONCAT(fp.post_qualification_code, ',') REGEXP CONCAT(REPLACE('1823,1824,1825,1826,1827', ',', ',|'), ',') > 0
OR CONCAT(fp.post_qualification_code, ',') REGEXP CONCAT(REPLACE('1421,1422,1423,1424,1425', ',', ',|'), ',') > 0
OR CONCAT(fp.post_qualification_code, ',') REGEXP CONCAT(REPLACE('1426,1427,1428,1429,1430,1431', ',', ',|'), ',') > 0
),1,0)
) AS fireIsOk,
(
SUM(IF(a.peopleType = '1601', 1, 0)) -
SUM(
IF(a.peopleType = '1601' AND (
CONCAT(fp.post_qualification_code, ',') REGEXP CONCAT(REPLACE('1823,1824,1825,1826,1827', ',', ',|'), ',') > 0
OR CONCAT(fp.post_qualification_code, ',') REGEXP CONCAT(REPLACE('1421,1422,1423,1424,1425', ',', ',|'), ',' ) > 0
OR CONCAT(fp.post_qualification_code, ',') REGEXP CONCAT(REPLACE('1426,1427,1428,1429,1430,1431', ',', ',|'), ',' ) > 0
), 1, 0)
)
) AS fireNoCard,
SUM(
IF((a.peopleType = '1602' AND (SELECT CONCAT(fp.post_qualification_code, ',') REGEXP CONCAT(REPLACE('1427,1428,1429,1430,1431', ',', ',|'), ',')) > 0), 1, 0)
) AS ywIsOk,
(
SUM(IF(a.peopleType = '1602', 1, 0)) -
SUM(
IF((a.peopleType = '1602' AND (SELECT CONCAT(fp.post_qualification_code, ',') REGEXP CONCAT(REPLACE ('1427,1428,1429,1430,1431', ',', ',|'), ',')) > 0), 1, 0)
)
) AS ywNoCard
FROM
(
SELECT
ou.sequence_nbr,
ou.biz_org_type,
ou.biz_org_name,
ou.biz_org_code,
IFNULL( MAX( CASE WHEN cfi.field_code = 'peopleType' THEN field_value END ), '' ) AS peopleType,
ou.is_delete
FROM
cb_org_usr ou
LEFT JOIN cb_dynamic_form_instance cfi ON ou.sequence_nbr = cfi.instance_id
WHERE
ou.is_delete = '0'
GROUP BY
ou.sequence_nbr
) c
WHERE
c.peopleType IN ( '1601', '1602' )
SELECT
*
FROM
(
SELECT
ou.sequence_nbr,
ou.biz_org_type,
ou.biz_org_name,
ou.biz_org_code,
IFNULL(MAX(CASE WHEN cfi.field_code = 'peopleType' THEN field_value END ), '') AS peopleType,
ou.is_delete
FROM
cb_org_usr ou
LEFT JOIN cb_dynamic_form_instance cfi ON ou.sequence_nbr = cfi.instance_id
WHERE
ou.is_delete = '0'
GROUP BY
ou.sequence_nbr
) c
WHERE
c.peopleType IN ('1601', '1602')
) a
LEFT JOIN cb_firefighters_post fp ON a.sequence_nbr = fp.org_usr_id
LEFT JOIN idx_biz_station_info ibsi ON LEFT ( a.biz_org_code, 18
) = ibsi.biz_org_code
LEFT JOIN cb_firefighters_post fp ON a.sequence_nbr = fp.org_usr_id
LEFT JOIN idx_biz_station_info ibsi ON LEFT (a.biz_org_code, 18
) = ibsi.biz_org_code
WHERE
a.biz_org_name IS NOT NULL
AND a.is_delete = 0
AND a.biz_org_type = 'PERSON'
AND fp.is_delete = 0
AND LENGTH( a.biz_org_code ) > 18
<if
test=
'bizOrgCode!=null and bizOrgCode!=""'
>
and LEFT(a.biz_org_code,18) like concat
(#{bizOrgCode},'%')
</if>
<if
test=
'stationType != null and stationType != ""'
>
and ibsi.station_type like concat
('%', #{stationType},'%')
</if>
a.biz_org_name IS NOT NULL
AND a.is_delete = 0
AND a.biz_org_type = 'PERSON'
AND fp.is_delete = 0
AND LENGTH( a.biz_org_code ) > 18
<if
test=
'bizOrgCode!=null and bizOrgCode!=""'
>
AND LEFT(a.biz_org_code,18) LIKE CONCAT
(#{bizOrgCode},'%')
</if>
<if
test=
'stationType != null and stationType != ""'
>
AND ibsi.station_type LIKE CONCAT
('%', #{stationType},'%')
</if>
GROUP BY
LEFT (
a.biz_org_code,
18)
LEFT(a.biz_org_code, 18)
</select>
</mapper>
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