Commit 5d271498 authored by tianyiming's avatar tianyiming

修改一码通总览数据相关问题

parent f3186a51
......@@ -179,23 +179,150 @@
<select id="getCategoryData" resultType="java.util.Map">
SELECT
elevator,
lifting,
vehicle,
boiler,
vessel,
pipeline,
rides,
ropeway
FROM
biz_jg_equipment_category_data bjecd
WHERE
<if test="level == 'company'">
bjecd."unit_code" LIKE CONCAT('%',#{companyCode},'%')
</if>
<if test="level != 'company'">
bjecd."org_branch_code" LIKE CONCAT('%',#{orgCode},'%')
</if>
(SELECT
to_json ( b ) :: json
FROM
(SELECT
SUM ( int4 ( ( elevator :: json -> 'waitClaim' ) ) ) waitClaim,
SUM ( int4 ( ( elevator :: json -> 'alreadyClaim' ) ) ) alreadyClaim,
SUM ( int4 ( ( elevator :: json -> 'refuseClaim' ) ) ) refuseClaim
FROM
biz_jg_equipment_category_data bjecd
WHERE
<if test="level == 'company'">
bjecd."unit_code" LIKE CONCAT('%',#{companyCode},'%')
</if>
<if test="level != 'company'">
bjecd."org_branch_code" LIKE CONCAT('%',#{orgCode},'%')
</if>
) b
) elevator,
(SELECT
to_json ( b ) :: json
FROM
(SELECT
SUM ( int4 ( ( vehicle :: json -> 'waitClaim' ) ) ) waitClaim,
SUM ( int4 ( ( vehicle :: json -> 'alreadyClaim' ) ) ) alreadyClaim,
SUM ( int4 ( ( vehicle :: json -> 'refuseClaim' ) ) ) refuseClaim
FROM
biz_jg_equipment_category_data bjecd
WHERE
<if test="level == 'company'">
bjecd."unit_code" LIKE CONCAT('%',#{companyCode},'%')
</if>
<if test="level != 'company'">
bjecd."org_branch_code" LIKE CONCAT('%',#{orgCode},'%')
</if>
) b
) vehicle,
(SELECT
to_json ( b ) :: json
FROM
(SELECT
SUM ( int4 ( ( ropeway :: json -> 'waitClaim' ) ) ) waitClaim,
SUM ( int4 ( ( ropeway :: json -> 'alreadyClaim' ) ) ) alreadyClaim,
SUM ( int4 ( ( ropeway :: json -> 'refuseClaim' ) ) ) refuseClaim
FROM
biz_jg_equipment_category_data bjecd
WHERE
<if test="level == 'company'">
bjecd."unit_code" LIKE CONCAT('%',#{companyCode},'%')
</if>
<if test="level != 'company'">
bjecd."org_branch_code" LIKE CONCAT('%',#{orgCode},'%')
</if>
) b
) ropeway,
(SELECT
to_json ( b ) :: json
FROM
(SELECT
SUM ( int4 ( ( rides :: json -> 'waitClaim' ) ) ) waitClaim,
SUM ( int4 ( ( rides :: json -> 'alreadyClaim' ) ) ) alreadyClaim,
SUM ( int4 ( ( rides :: json -> 'refuseClaim' ) ) ) refuseClaim
FROM
biz_jg_equipment_category_data bjecd
WHERE
<if test="level == 'company'">
bjecd."unit_code" LIKE CONCAT('%',#{companyCode},'%')
</if>
<if test="level != 'company'">
bjecd."org_branch_code" LIKE CONCAT('%',#{orgCode},'%')
</if>
) b
) rides,
(SELECT
to_json ( b ) :: json
FROM
(SELECT
SUM ( int4 ( ( boiler :: json -> 'waitClaim' ) ) ) waitClaim,
SUM ( int4 ( ( boiler :: json -> 'alreadyClaim' ) ) ) alreadyClaim,
SUM ( int4 ( ( boiler :: json -> 'refuseClaim' ) ) ) refuseClaim
FROM
biz_jg_equipment_category_data bjecd
WHERE
<if test="level == 'company'">
bjecd."unit_code" LIKE CONCAT('%',#{companyCode},'%')
</if>
<if test="level != 'company'">
bjecd."org_branch_code" LIKE CONCAT('%',#{orgCode},'%')
</if>
) b
) boiler,
(SELECT
to_json ( b ) :: json
FROM
(SELECT
SUM ( int4 ( ( vessel :: json -> 'waitClaim' ) ) ) waitClaim,
SUM ( int4 ( ( vessel :: json -> 'alreadyClaim' ) ) ) alreadyClaim,
SUM ( int4 ( ( vessel :: json -> 'refuseClaim' ) ) ) refuseClaim
FROM
biz_jg_equipment_category_data bjecd
WHERE
<if test="level == 'company'">
bjecd."unit_code" LIKE CONCAT('%',#{companyCode},'%')
</if>
<if test="level != 'company'">
bjecd."org_branch_code" LIKE CONCAT('%',#{orgCode},'%')
</if>
) b
) vessel,
(SELECT
to_json ( b ) :: json
FROM
(SELECT
SUM ( int4 ( ( pipeline :: json -> 'waitClaim' ) ) ) waitClaim,
SUM ( int4 ( ( pipeline :: json -> 'alreadyClaim' ) ) ) alreadyClaim,
SUM ( int4 ( ( pipeline :: json -> 'refuseClaim' ) ) ) refuseClaim
FROM
biz_jg_equipment_category_data bjecd
WHERE
<if test="level == 'company'">
bjecd."unit_code" LIKE CONCAT('%',#{companyCode},'%')
</if>
<if test="level != 'company'">
bjecd."org_branch_code" LIKE CONCAT('%',#{orgCode},'%')
</if>
) b
) pipeline,
(SELECT
to_json ( b ) :: json
FROM
(SELECT
SUM ( int4 ( ( lifting :: json -> 'waitClaim' ) ) ) waitClaim,
SUM ( int4 ( ( lifting :: json -> 'alreadyClaim' ) ) ) alreadyClaim,
SUM ( int4 ( ( lifting :: json -> 'refuseClaim' ) ) ) refuseClaim
FROM
biz_jg_equipment_category_data bjecd
WHERE
<if test="level == 'company'">
bjecd."unit_code" LIKE CONCAT('%',#{companyCode},'%')
</if>
<if test="level != 'company'">
bjecd."org_branch_code" LIKE CONCAT('%',#{orgCode},'%')
</if>
) b
) lifting
</select>
<select id="getUnitCodeByRecord" resultType="java.lang.String">
......
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