Commit 495b6eeb authored by 张森's avatar 张森

人员bug修改

parent ae75eee4
......@@ -1724,117 +1724,131 @@
<select id="getCenterPersonInfoPage" resultType="Map">
SELECT
a.biz_org_code 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' )
a.biz_org_code 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 (
SELECT
concat( fp.post_qualification_code, ',' ) REGEXP concat( REPLACE ( '1421,1422,1423,1424,1425,1823,1824,1825,1826,1827', ',', ',|' ), ',' )) > 0
),
1,
0
)) AS fireIsOk,
SUM(
IF
((
a.peopleType = '1601'
AND (
SELECT
concat( fp.post_qualification_code, ',' ) REGEXP concat( REPLACE ( '1421,1422,1423,1424,1425,1823,1824,1825,1826,1827', ',', ',|' ), ',' )) = 0
OR (
SELECT
concat( fp.post_qualification_code, ',' ) REGEXP concat( REPLACE ( '1421,1422,1423,1424,1425,1823,1824,1825,1826,1827', ',', ',|' ), ',' ) IS NULL
AND a.peopleType = '1601'
)),
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 (
SELECT
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
*
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
WHERE
a.biz_org_name IS NOT NULL
AND a.is_delete = 0
AND a.biz_org_type = 'PERSON'
<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)
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
AND concat( fp.post_qualification_code, ',' ) REGEXP concat( REPLACE ( '1421,1422,1423,1424,1425', ',', ',|' ),
',' ) > 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
AND concat( fp.post_qualification_code, ',' ) REGEXP concat( REPLACE ( '1421,1422,1423,1424,1425', ',', ',|' ),
',' ) > 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
*
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
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 LEFT ( a.biz_org_code, 18 ) LIKE concat ( 'LSHLZ1wYXL3mJmHZyG', '%' )
<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)
</select>
</mapper>
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