SQL 修改
This commit is contained in:
parent
392c2a51fc
commit
059ef7674f
|
|
@ -6,330 +6,327 @@
|
||||||
<sql id="where">
|
<sql id="where">
|
||||||
WHERE 1=1
|
WHERE 1=1
|
||||||
<if test="params.orgId != null and params.orgId != '' and params.roleLevel < 3">
|
<if test="params.orgId != null and params.orgId != '' and params.roleLevel < 3">
|
||||||
AND ( po.id in (${params.orgAll})
|
AND ( po."id" IN (${params.orgAll})
|
||||||
or bp.company_id in (${params.orgAll})
|
OR bp."company_id" IN (${params.orgAll})
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
<if test="params.orgId != null and params.orgId != '' and params.roleLevel >= 3">
|
<if test="params.orgId != null and params.orgId != '' and params.roleLevel >= 3">
|
||||||
AND ( po.id = #{params.orgId}
|
AND ( po."id" = #{params.orgId}
|
||||||
or bp.company_id = #{params.orgId}
|
OR bp."company_id" = #{params.orgId}
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
<if test="params.companyId != null and params.companyId != ''">
|
<if test="params.companyId != null and params.companyId != ''">
|
||||||
and bp.company_id = #{params.companyId}
|
AND bp."company_id" = #{params.companyId}
|
||||||
</if>
|
</if>
|
||||||
<if test="params.proId != null and params.proId != ''">
|
<if test="params.proId != null and params.proId != ''">
|
||||||
and bp.id = #{params.proId}
|
AND bp."id" = #{params.proId}
|
||||||
</if>
|
</if>
|
||||||
<if test="params.status != null and params.status != ''">
|
<if test="params.status != null and params.status != ''">
|
||||||
and bweh.exit_status in (${params.status})
|
AND bweh."exit_status" IN (${params.status})
|
||||||
</if>
|
</if>
|
||||||
<if test="params.isForce != null and params.isForce != ''">
|
<if test="params.isForce != null and params.isForce != ''">
|
||||||
and bweh.is_force = #{params.isForce}
|
AND bweh."is_force" = #{params.isForce}
|
||||||
</if>
|
</if>
|
||||||
<if test="params.idNumber != null and params.idNumber != ''">
|
<if test="params.idNumber != null and params.idNumber != ''">
|
||||||
and bw.id_number = #{params.idNumber}
|
AND bw."id_number" = #{params.idNumber}
|
||||||
</if>
|
</if>
|
||||||
<if test="params.name != null and params.name != ''">
|
<if test="params.name != null and params.name != ''">
|
||||||
and bw.name = #{params.name}
|
AND bw."name" = #{params.name}
|
||||||
</if>
|
</if>
|
||||||
<if test="params.subId != null and params.subId !='' ">
|
<if test="params.subId != null and params.subId !='' ">
|
||||||
AND bs.id = #{params.subId}
|
AND bs."id" = #{params.subId}
|
||||||
</if>
|
</if>
|
||||||
<if test="params.teamId != null and params.teamId != ''">
|
<if test="params.teamId != null and params.teamId != ''">
|
||||||
and bst.id = #{params.teamId}
|
AND bst."id" = #{params.teamId}
|
||||||
</if>
|
</if>
|
||||||
<if test="params.keyWord != null and params.keyWord != ''">
|
<if test="params.keyWord != null and params.keyWord != ''">
|
||||||
and (
|
AND (
|
||||||
bw.name like concat('%', #{params.keyWord}, '%')
|
bw."name" LIKE ('%' || #{params.keyWord} || '%')
|
||||||
or td.`value` like concat('%', #{params.keyWord}, '%')
|
OR td."value" LIKE ('%' || #{params.keyWord} || '%')
|
||||||
or bst.team_name like concat('%', #{params.keyWord}, '%')
|
OR bst."team_name" LIKE ('%' || #{params.keyWord} || '%')
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
</sql>
|
</sql>
|
||||||
<insert id="addPersonEvaluate">
|
<insert id="addPersonEvaluate">
|
||||||
update bm_worker_ein_history set exit_performance = #{evaluate},exit_skill_evaluation = #{exitExamineRemark}
|
UPDATE "ynrealname"."bm_worker_ein_history" SET "exit_performance" = #{evaluate}, "exit_skill_evaluation" = #{exitExamineRemark}
|
||||||
where id_number = #{idNumber} and ein_time = #{einTime}
|
WHERE "id_number" = #{idNumber} AND "ein_time" = #{einTime}
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="insertOutPersonTimeOut">
|
<insert id="insertOutPersonTimeOut">
|
||||||
INSERT INTO
|
INSERT INTO "ynrealname"."bm_worker_exit_revoke"(
|
||||||
bm_worker_exit_revoke(
|
"id_number",
|
||||||
id_number,
|
"project_id",
|
||||||
project_id,
|
"sub_id",
|
||||||
sub_id,
|
"team_id",
|
||||||
team_id,
|
"upload_exit_time",
|
||||||
upload_exit_time,
|
"revoke_time"
|
||||||
revoke_time
|
|
||||||
)
|
)
|
||||||
VALUE(
|
VALUES (
|
||||||
#{idNumber},
|
#{idNumber},
|
||||||
#{proId},
|
#{proId},
|
||||||
#{subId},
|
#{subId},
|
||||||
#{TeamId},
|
#{TeamId},
|
||||||
#{exitTime},
|
#{exitTime},
|
||||||
NOW()
|
SYSDATE
|
||||||
)
|
)
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="insertAttendanceMachinePush">
|
<insert id="insertAttendanceMachinePush">
|
||||||
insert into bm_attendance_machine_push(id_number, face_path, attendance_machine_id, operate)
|
INSERT INTO "ynrealname"."bm_attendance_machine_push"("id_number", "face_path", "attendance_machine_id", "operate")
|
||||||
values (#{idNumber}, #{facePhoto}, #{attendanceMachineId}, #{operate});
|
VALUES (#{idNumber}, #{facePhoto}, #{attendanceMachineId}, #{operate});
|
||||||
|
|
||||||
replace into bm_attendance_machine_push_history(id_number, attendance_machine_id) values
|
MERGE INTO "ynrealname"."bm_attendance_machine_push_history" tgt
|
||||||
(#{idNumber}, #{attendanceMachineId})
|
USING (
|
||||||
|
SELECT #{idNumber} AS "id_number", #{attendanceMachineId} AS "attendance_machine_id" FROM DUAL
|
||||||
|
) src
|
||||||
|
ON (tgt."id_number" = src."id_number" AND tgt."attendance_machine_id" = src."attendance_machine_id")
|
||||||
|
WHEN MATCHED THEN UPDATE SET tgt."attendance_machine_id" = src."attendance_machine_id"
|
||||||
|
WHEN NOT MATCHED THEN INSERT ("id_number", "attendance_machine_id") VALUES (src."id_number", src."attendance_machine_id")
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<update id="batchPersonOutPlace">
|
<update id="batchPersonOutPlace">
|
||||||
update bm_worker_ein_history set exit_time = #{exitTime},exit_status = '0'
|
UPDATE "ynrealname"."bm_worker_ein_history" SET "exit_time" = #{exitTime},"exit_status" = '0'
|
||||||
where id_number = #{idNumber} and is_active = '1'
|
WHERE "id_number" = #{idNumber} AND "is_active" = '1'
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<!-- update bm_worker_training_result set is_active = 0 where id_number = #{idNumber};-->
|
<!-- update bm_worker_training_result set is_active = 0 where id_number = #{idNumber};-->
|
||||||
<update id="batchPersonOutCheck">
|
<update id="batchPersonOutCheck">
|
||||||
update bm_worker_ein_history set exit_status = #{exitStatus},exit_examine_user = #{userId},is_furlough_person = 0,
|
UPDATE "ynrealname"."bm_worker_ein_history" SET "exit_status" = #{exitStatus},"exit_examine_user" = #{userId},"is_furlough_person" = 0,
|
||||||
<if test="contractId != null and contractId != ''">
|
<if test="contractId != null and contractId != ''">
|
||||||
contract_id = #{contractId},
|
"contract_id" = #{contractId},
|
||||||
</if>
|
</if>
|
||||||
exit_time = #{exitTime},exit_examine_time = #{exitTime},exit_examine_remark = #{exitExamineRemark},is_force = '1'
|
"exit_time" = #{exitTime},"exit_examine_time" = #{exitTime},"exit_examine_remark" = #{exitExamineRemark},"is_force" = '1'
|
||||||
where id_number = #{idNumber} and is_active = 1;
|
WHERE "id_number" = #{idNumber} AND "is_active" = 1;
|
||||||
update bm_worker_ein_history set is_active = 0 where id_number = #{idNumber} and is_active = 1;
|
UPDATE "ynrealname"."bm_worker_ein_history" SET "is_active" = 0 WHERE "id_number" = #{idNumber} AND "is_active" = 1;
|
||||||
update bm_worker_contract set is_active = 0 where idCard = #{idNumber};
|
UPDATE "ynrealname"."bm_worker_contract" SET "is_active" = 0 WHERE "id_card" = #{idNumber};
|
||||||
update bm_worker_contract_details set is_active = 0 where id_card = #{idNumber};
|
UPDATE "ynrealname"."bm_worker_contract_details" SET "is_active" = 0 WHERE "id_card" = #{idNumber};
|
||||||
update bm_worker_contract_witness set is_active = 0 where id_number = #{idNumber};
|
UPDATE "ynrealname"."bm_worker_contract_witness" SET "is_active" = 0 WHERE "id_number" = #{idNumber};
|
||||||
update bm_worker_train set is_active = 0 where id_number = #{idNumber};
|
UPDATE "ynrealname"."bm_worker_train" SET "is_active" = 0 WHERE "id_number" = #{idNumber};
|
||||||
update bm_team_user_relation set is_active = 0 where id_number = #{idNumber} and is_regular_person = '0' and is_active = '1';
|
UPDATE "ynrealname"."bm_team_user_relation" SET "is_active" = 0 WHERE "id_number" = #{idNumber} AND "is_regular_person" = '0' AND "is_active" = '1';
|
||||||
update bm_worker set light_status = 0,is_furlough_person = 0 where id_number = #{idNumber} and is_active = 1;
|
UPDATE "ynrealname"."bm_worker" SET "light_status" = 0,"is_furlough_person" = 0 WHERE "id_number" = #{idNumber} AND "is_active" = 1;
|
||||||
update bm_worker_training_result set is_active = 0 where id_number = #{idNumber};
|
UPDATE "ynrealname"."bm_worker_training_result" SET "is_active" = 0 WHERE "id_number" = #{idNumber};
|
||||||
<if test='einStatus != "1"'>
|
<if test='einStatus != "1"'>
|
||||||
update bm_worker set ein_status = 0 where id_number = #{idNumber} and is_active = 1;
|
UPDATE "ynrealname"."bm_worker" SET "ein_status" = 0 WHERE "id_number" = #{idNumber} AND "is_active" = 1;
|
||||||
update sys_user set org_id = '',pro_id = '' where id_number = #{idNumber};
|
UPDATE "ynrealname"."sys_user" SET "org_id" = '',"pro_id" = '' WHERE "id_number" = #{idNumber};
|
||||||
</if>
|
</if>
|
||||||
<if test='einStatus == "1"'>
|
<if test='einStatus == "1"'>
|
||||||
update bm_worker set ein_status = 1,is_furlough_person = 0 where id_number = #{idNumber} and is_active = 1;
|
UPDATE "ynrealname"."bm_worker" SET "ein_status" = 1,"is_furlough_person" = 0 WHERE "id_number" = #{idNumber} AND "is_active" = 1;
|
||||||
</if>
|
</if>
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<update id="updateOutPersonTimeout">
|
<update id="updateOutPersonTimeout">
|
||||||
UPDATE
|
UPDATE
|
||||||
bm_worker_ein_history bweh
|
"ynrealname"."bm_worker_ein_history" bweh
|
||||||
SET bweh.exit_time = NULL ,
|
SET bweh."exit_time" = NULL ,
|
||||||
bweh.exit_status = '-1'
|
bweh."exit_status" = '-1'
|
||||||
WHERE bweh.id_number = #{idNumber}
|
WHERE bweh."id_number" = #{idNumber}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<update id="updateFurloughById">
|
<update id="updateFurloughById">
|
||||||
<foreach collection="list" item="item">
|
<foreach collection="list" item="item">
|
||||||
update bm_worker_furlough_history set rework_time = #{item.reworkTime} where id = #{item.id};
|
UPDATE "ynrealname"."bm_worker_furlough_history" SET "rework_time" = #{item.reworkTime} WHERE "id" = #{item.id};
|
||||||
</foreach>
|
</foreach>
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<update id="updateRedLightById">
|
<update id="updateRedLightById">
|
||||||
<foreach collection="list" item="item">
|
<foreach collection="list" item="item">
|
||||||
update bm_worker_red_history set end_time = #{item.endTime} where id = #{item.id};
|
UPDATE "ynrealname"."bm_worker_red_history" SET "end_time" = #{item.endTime} WHERE "id" = #{item.id};
|
||||||
</foreach>
|
</foreach>
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<update id="bindContractId">
|
<update id="bindContractId">
|
||||||
update bm_worker_ein_history set contract_id = #{contractId} where id_number = #{idNumber} and ein_time = #{einTime}
|
UPDATE "ynrealname"."bm_worker_ein_history" SET "contract_id" = #{contractId} WHERE "id_number" = #{idNumber} AND "ein_time" = #{einTime}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
|
||||||
<select id="count" resultType="int">
|
<select id="count" resultType="int">
|
||||||
select count(1) from (
|
SELECT COUNT(1) FROM (
|
||||||
SELECT
|
SELECT
|
||||||
bweh.id_number AS idNumber
|
bweh."id_number" AS "id_number"
|
||||||
FROM
|
FROM
|
||||||
bm_worker_ein_history AS bweh
|
"ynrealname"."bm_worker_ein_history" AS bweh
|
||||||
LEFT JOIN bm_worker AS bw ON bweh.id_number = bw.id_number AND bw.IS_ACTIVE = '1'
|
LEFT JOIN "ynrealname"."bm_worker" AS bw ON bweh."id_number" = bw."id_number" AND bw."is_active" = '1'
|
||||||
LEFT JOIN t_dict AS td ON bweh.post_id = td.id AND td.type = 'postType' AND td.is_active = '1'
|
LEFT JOIN "ynrealname"."t_dict" AS td ON bweh."post_id" = td."id" AND td."type" = 'postType' AND td."is_active" = '1'
|
||||||
LEFT JOIN bm_project AS bp ON bweh.project_id = bp.id AND bp.is_active = '1'
|
LEFT JOIN "ynrealname"."bm_project" AS bp ON bweh."project_id" = bp."id" AND bp."is_active" = '1'
|
||||||
LEFT JOIN pm_organization po ON po.id = bp.two_com_id and po.is_active = '1'
|
LEFT JOIN "ynrealname"."pm_organization" po ON po."id" = bp."two_com_id" AND po."is_active" = '1'
|
||||||
LEFT JOIN pm_company as pc ON pc.id = bp.company_id AND bp.is_active = '1'
|
LEFT JOIN "ynrealname"."pm_company" AS pc ON pc."id" = bp."company_id" AND bp."is_active" = '1'
|
||||||
LEFT JOIN bm_subcontractor AS bs ON bweh.sub_id = bs.id AND bs.is_active = '1'
|
LEFT JOIN "ynrealname"."bm_subcontractor" AS bs ON bweh."sub_id" = bs."id" AND bs."is_active" = '1'
|
||||||
LEFT JOIN bm_sub_team AS bst ON bst.id = bweh.team_id AND bst.is_active = '1'
|
LEFT JOIN "ynrealname"."bm_sub_team" AS bst ON bst."id" = bweh."team_id" AND bst."is_active" = '1'
|
||||||
<include refid="where"/>
|
<include refid="where"/>
|
||||||
group by idNumber
|
GROUP BY "id_number"
|
||||||
) a
|
) a
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="list" resultType="com.bonus.bmw.person.entity.BasePersonBean">
|
<select id="list" resultType="com.bonus.bmw.person.entity.BasePersonBean">
|
||||||
select * from (
|
SELECT * FROM (
|
||||||
SELECT
|
SELECT DISTINCT
|
||||||
DISTINCT
|
bweh."id_number" AS "id_number",
|
||||||
bweh.id_number AS idNumber,
|
bw."name" AS "name",
|
||||||
bw.`name`,
|
td."value" AS "postname",
|
||||||
td.`value` AS postName,
|
bst."team_name" AS "teamname",
|
||||||
bst.team_name AS teamName,
|
po."name" AS "companyname",
|
||||||
po.`name` as companyName,
|
bp."name" AS "proname",
|
||||||
bp.`name` AS proName,
|
bs."sub_name" AS "subname",
|
||||||
bs.sub_name AS subName,
|
bweh."ein_time" AS "eintime",
|
||||||
bweh.ein_time AS einTime,
|
bweh."exit_time" AS "exittime",
|
||||||
bweh.exit_time AS exitTime,
|
bweh."exit_status" AS "exitstatus",
|
||||||
bweh.exit_status AS exitStatus,
|
bweh."is_force" AS "isforce",
|
||||||
bweh.is_force as isForce,
|
bweh."is_furlough_person" AS "is_furlough_person",
|
||||||
bweh.is_furlough_person,
|
CASE WHEN (bweh."exit_status" = '1' AND bweh."exit_performance" IS NULL AND (TRUNC(SYSDATE) - TRUNC(bweh."exit_time")) < 4) THEN 1 ELSE 0 END AS "evaluate"
|
||||||
if(bweh.exit_status = '1' and bweh.exit_performance is null and
|
|
||||||
TIMESTAMPDIFF( DAY, bweh.exit_time, DATE_FORMAT( NOW( ), '%Y-%m-%d' )) < 4,1,0 ) as evaluate
|
|
||||||
FROM
|
FROM
|
||||||
bm_worker_ein_history AS bweh
|
"ynrealname"."bm_worker_ein_history" AS bweh
|
||||||
LEFT JOIN bm_worker AS bw ON bweh.id_number = bw.id_number AND bw.IS_ACTIVE = '1'
|
LEFT JOIN "ynrealname"."bm_worker" AS bw ON bweh."id_number" = bw."id_number" AND bw."is_active" = '1'
|
||||||
LEFT JOIN t_dict AS td ON bweh.post_id = td.id AND td.type = 'postType' AND td.is_active = '1'
|
LEFT JOIN "ynrealname"."t_dict" AS td ON bweh."post_id" = td."id" AND td."type" = 'postType' AND td."is_active" = '1'
|
||||||
LEFT JOIN bm_project AS bp ON bweh.project_id = bp.id AND bp.is_active = '1'
|
LEFT JOIN "ynrealname"."bm_project" AS bp ON bweh."project_id" = bp."id" AND bp."is_active" = '1'
|
||||||
LEFT JOIN pm_organization po ON po.id = bp.two_com_id and po.is_active = '1'
|
LEFT JOIN "ynrealname"."pm_organization" po ON po."id" = bp."two_com_id" AND po."is_active" = '1'
|
||||||
LEFT JOIN pm_company as pc ON pc.id = bp.company_id AND bp.is_active = '1'
|
LEFT JOIN "ynrealname"."pm_company" AS pc ON pc."id" = bp."company_id" AND bp."is_active" = '1'
|
||||||
LEFT JOIN bm_subcontractor AS bs ON bweh.sub_id = bs.id AND bs.is_active = '1'
|
LEFT JOIN "ynrealname"."bm_subcontractor" AS bs ON bweh."sub_id" = bs."id" AND bs."is_active" = '1'
|
||||||
LEFT JOIN bm_sub_team AS bst ON bst.id = bweh.team_id AND bst.is_active = '1'
|
LEFT JOIN "ynrealname"."bm_sub_team" AS bst ON bst."id" = bweh."team_id" AND bst."is_active" = '1'
|
||||||
<include refid="where"/>
|
<include refid="where"/>
|
||||||
ORDER BY ein_time DESC
|
ORDER BY "ein_time" DESC
|
||||||
) a
|
) a
|
||||||
group by idNumber
|
|
||||||
<if test="offset != null and offset >= 0 and limit != null and limit >= 0">
|
<if test="offset != null and offset >= 0 and limit != null and limit >= 0">
|
||||||
limit #{offset}, #{limit}
|
OFFSET #{offset} ROWS FETCH NEXT #{limit} ROWS ONLY
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getCount" resultType="java.lang.Integer">
|
<select id="getCount" resultType="java.lang.Integer">
|
||||||
SELECT
|
SELECT
|
||||||
count(1)
|
COUNT(1)
|
||||||
FROM
|
FROM
|
||||||
bm_worker_ein_history AS bweh
|
"ynrealname"."bm_worker_ein_history" AS bweh
|
||||||
LEFT JOIN bm_worker AS bw ON bweh.id_number = bw.id_number AND bw.IS_ACTIVE = '1'
|
LEFT JOIN "ynrealname"."bm_worker" AS bw ON bweh."id_number" = bw."id_number" AND bw."is_active" = '1'
|
||||||
LEFT JOIN t_dict AS td ON bweh.post_id = td.id AND td.type = 'postType' AND td.is_active = '1'
|
LEFT JOIN "ynrealname"."t_dict" AS td ON bweh."post_id" = td."id" AND td."type" = 'postType' AND td."is_active" = '1'
|
||||||
LEFT JOIN bm_project AS bp ON bweh.project_id = bp.id AND bp.is_active = '1'
|
LEFT JOIN "ynrealname"."bm_project" AS bp ON bweh."project_id" = bp."id" AND bp."is_active" = '1'
|
||||||
LEFT JOIN bm_subcontractor AS bs ON bweh.sub_id = bs.id AND bs.is_active = '1'
|
LEFT JOIN "ynrealname"."bm_subcontractor" AS bs ON bweh."sub_id" = bs."id" AND bs."is_active" = '1'
|
||||||
LEFT JOIN bm_sub_team AS bst ON bst.id = bweh.team_id AND bst.is_active = '1'
|
LEFT JOIN "ynrealname"."bm_sub_team" AS bst ON bst."id" = bweh."team_id" AND bst."is_active" = '1'
|
||||||
<include refid="where"/>
|
<include refid="where"/>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getRecord" resultType="com.bonus.bmw.person.entity.BasePersonBean">
|
<select id="getRecord" resultType="com.bonus.bmw.person.entity.BasePersonBean">
|
||||||
SELECT
|
SELECT
|
||||||
bw.`id_number`,
|
bw."id_number" AS "id_number",
|
||||||
bw.`name`,
|
bw."name" AS "name",
|
||||||
td.`value` AS postName,
|
td."value" AS "postname",
|
||||||
bst.team_name AS teamName,
|
bst."team_name" AS "teamname",
|
||||||
pc.name as companyName,
|
pc."name" AS "companyname",
|
||||||
bp.`name` AS proName,
|
bp."name" AS "proname",
|
||||||
bs.sub_name AS subName,
|
bs."sub_name" AS "subname",
|
||||||
bweh.ein_time AS einTime,
|
bweh."ein_time" AS "eintime",
|
||||||
if(bweh.exit_status>'0',exit_time,'') AS exitTime,
|
CASE WHEN (bweh."exit_status" > '0') THEN bweh."exit_time" ELSE '' END AS "exittime",
|
||||||
bweh.contract_id,
|
bweh."contract_id" AS "contract_id",
|
||||||
bweh.exit_status AS exitStatus
|
bweh."exit_status" AS "exitstatus"
|
||||||
FROM
|
FROM
|
||||||
bm_worker_ein_history AS bweh
|
"ynrealname"."bm_worker_ein_history" AS bweh
|
||||||
LEFT JOIN bm_worker AS bw ON bweh.id_number = bw.id_number AND bw.IS_ACTIVE = '1'
|
LEFT JOIN "ynrealname"."bm_worker" AS bw ON bweh."id_number" = bw."id_number" AND bw."is_active" = '1'
|
||||||
LEFT JOIN t_dict AS td ON bweh.post_id = td.id AND td.type = 'postType' AND td.is_active = '1'
|
LEFT JOIN "ynrealname"."t_dict" AS td ON bweh."post_id" = td."id" AND td."type" = 'postType' AND td."is_active" = '1'
|
||||||
LEFT JOIN bm_project AS bp ON bweh.project_id = bp.id AND bp.is_active = '1'
|
LEFT JOIN "ynrealname"."bm_project" AS bp ON bweh."project_id" = bp."id" AND bp."is_active" = '1'
|
||||||
LEFT JOIN pm_organization as pc ON pc.id = bp.two_com_id AND bp.is_active = '1'
|
LEFT JOIN "ynrealname"."pm_organization" AS pc ON pc."id" = bp."two_com_id" AND bp."is_active" = '1'
|
||||||
LEFT JOIN bm_subcontractor AS bs ON bweh.sub_id = bs.id AND bs.is_active = '1'
|
LEFT JOIN "ynrealname"."bm_subcontractor" AS bs ON bweh."sub_id" = bs."id" AND bs."is_active" = '1'
|
||||||
LEFT JOIN bm_sub_team AS bst ON bst.id = bweh.team_id
|
LEFT JOIN "ynrealname"."bm_sub_team" AS bst ON bst."id" = bweh."team_id"
|
||||||
<include refid="where"/>
|
<include refid="where"/>
|
||||||
ORDER BY ein_time DESC
|
ORDER BY "ein_time" DESC
|
||||||
<if test="offset != null and offset >= 0 and limit != null and limit >= 0">
|
<if test="offset != null and offset >= 0 and limit != null and limit >= 0">
|
||||||
limit #{offset}, #{limit}
|
OFFSET #{offset} ROWS FETCH NEXT #{limit} ROWS ONLY
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getProjectSelect" resultType="com.bonus.bmw.basic.entity.ProjectBean">
|
<select id="getProjectSelect" resultType="com.bonus.bmw.basic.entity.ProjectBean">
|
||||||
SELECT DISTINCT
|
SELECT DISTINCT
|
||||||
bp.id AS id,bp.`name` AS name
|
bp."id" AS "id", bp."name" AS "name"
|
||||||
FROM
|
FROM
|
||||||
bm_worker_ein_history AS bweh
|
"ynrealname"."bm_worker_ein_history" AS bweh
|
||||||
LEFT JOIN bm_worker AS bw ON bweh.id_number = bw.id_number AND bw.IS_ACTIVE = '1'
|
LEFT JOIN "ynrealname"."bm_worker" AS bw ON bweh."id_number" = bw."id_number" AND bw."is_active" = '1'
|
||||||
LEFT JOIN t_dict AS td ON bweh.post_id = td.id AND td.type = 'postType' AND td.is_active = '1'
|
LEFT JOIN "ynrealname"."t_dict" AS td ON bweh."post_id" = td."id" AND td."type" = 'postType' AND td."is_active" = '1'
|
||||||
LEFT JOIN bm_project AS bp ON bweh.project_id = bp.id AND bp.is_active = '1'
|
LEFT JOIN "ynrealname"."bm_project" AS bp ON bweh."project_id" = bp."id" AND bp."is_active" = '1'
|
||||||
<!--LEFT JOIN pm_company as pc ON pc.id = bp.company_id AND bp.is_active = '1'-->
|
WHERE 1 = 1
|
||||||
where 1 = 1
|
|
||||||
<!--<if test="params.companyId!=null and params.companyId!='' and params.companyId!= '-1' ">
|
|
||||||
and FIND_IN_SET(pc.ID, getChildList (#{params.companyId}))
|
|
||||||
</if>-->
|
|
||||||
</select>
|
</select>
|
||||||
<select id="getOutPersonTimeout" resultType="com.bonus.bmw.person.entity.OutPersonTimeoutBean">
|
<select id="getOutPersonTimeout" resultType="com.bonus.bmw.person.entity.OutPersonTimeoutBean">
|
||||||
SELECT
|
SELECT
|
||||||
bweh.id_number AS idNumber,
|
bweh."id_number" AS "id_number",
|
||||||
bweh.project_id AS proId,
|
bweh."project_id" AS "pro_id",
|
||||||
bweh.sub_id AS subId,
|
bweh."sub_id" AS "sub_id",
|
||||||
bweh.team_id AS TeamId,
|
bweh."team_id" AS "team_id",
|
||||||
bweh.exit_time AS exitTime
|
bweh."exit_time" AS "exit_time"
|
||||||
FROM bm_worker_ein_history bweh
|
FROM "ynrealname"."bm_worker_ein_history" bweh
|
||||||
WHERE bweh.is_active = '1'
|
WHERE bweh."is_active" = '1'
|
||||||
AND bweh.exit_status = '0'
|
AND bweh."exit_status" = '0'
|
||||||
AND TIMESTAMPDIFF(HOUR, bweh.exit_time, NOW()) >= 24
|
AND (SYSDATE - bweh."exit_time") >= 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getFurloughByIdNumber" resultType="com.bonus.bmw.team.entity.FurloughHisBean">
|
<select id="getFurloughByIdNumber" resultType="com.bonus.bmw.team.entity.FurloughHisBean">
|
||||||
SELECT
|
SELECT
|
||||||
id
|
"id"
|
||||||
FROM
|
FROM
|
||||||
bm_worker_furlough_history
|
"ynrealname"."bm_worker_furlough_history"
|
||||||
WHERE
|
WHERE
|
||||||
id_number = #{idNumber}
|
"id_number" = #{idNumber}
|
||||||
and rework_time is NULL
|
AND "rework_time" IS NULL
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getRedLightByIdNumber" resultType="com.bonus.bmw.person.entity.RedLightHisBean">
|
<select id="getRedLightByIdNumber" resultType="com.bonus.bmw.person.entity.RedLightHisBean">
|
||||||
SELECT
|
SELECT
|
||||||
id
|
"id"
|
||||||
FROM
|
FROM
|
||||||
bm_worker_red_history
|
"ynrealname"."bm_worker_red_history"
|
||||||
WHERE
|
WHERE
|
||||||
id_number = #{idNumber}
|
"id_number" = #{idNumber}
|
||||||
and end_time is NULL
|
AND "end_time" IS NULL
|
||||||
</select>
|
</select>
|
||||||
<select id="getContractIdByIdNumber" resultType="java.lang.String">
|
<select id="getContractIdByIdNumber" resultType="java.lang.String">
|
||||||
SELECT
|
SELECT
|
||||||
id
|
"id"
|
||||||
FROM
|
FROM
|
||||||
bm_worker_contract
|
"ynrealname"."bm_worker_contract"
|
||||||
WHERE
|
WHERE
|
||||||
idCard = #{idNumber}
|
"id_card" = #{idNumber}
|
||||||
AND is_active = '1'
|
AND "is_active" = '1'
|
||||||
GROUP BY
|
ORDER BY
|
||||||
upload_time DESC
|
"upload_time" DESC
|
||||||
LIMIT 1
|
FETCH FIRST 1 ROWS ONLY
|
||||||
</select>
|
</select>
|
||||||
<select id="getPersonIsEinByIdNumber" resultType="com.bonus.bmw.person.entity.InOutSpaceNewBean">
|
<select id="getPersonIsEinByIdNumber" resultType="com.bonus.bmw.person.entity.InOutSpaceNewBean">
|
||||||
SELECT
|
SELECT
|
||||||
id_number,
|
"id_number" AS "id_number",
|
||||||
project_id AS proId,
|
"project_id" AS "pro_id",
|
||||||
sub_id
|
"sub_id" AS "sub_id"
|
||||||
FROM
|
FROM
|
||||||
bm_worker_ein_history
|
"ynrealname"."bm_worker_ein_history"
|
||||||
WHERE
|
WHERE
|
||||||
id_number = #{idNumber}
|
"id_number" = #{idNumber}
|
||||||
AND is_active = '1'
|
AND "is_active" = '1'
|
||||||
AND exit_status != '1'
|
AND "exit_status" != '1'
|
||||||
ORDER BY
|
ORDER BY
|
||||||
ein_time DESC
|
"ein_time" DESC
|
||||||
LIMIT 1
|
FETCH FIRST 1 ROWS ONLY
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getPersonPlanByIdNumber" resultType="java.lang.Integer">
|
<select id="getPersonPlanByIdNumber" resultType="java.lang.Integer">
|
||||||
select count(idNumber) from
|
SELECT COUNT("idNumber") FROM
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
idNumber
|
"idNumber"
|
||||||
FROM
|
FROM
|
||||||
ynoperationplan.smz_plan_worker_all
|
"ynoperationplan"."smz_plan_worker_all"
|
||||||
WHERE
|
WHERE
|
||||||
idNumber = #{idNumber}
|
"idNumber" = #{idNumber}
|
||||||
union
|
UNION
|
||||||
SELECT
|
SELECT
|
||||||
idNumber
|
"idNumber"
|
||||||
FROM
|
FROM
|
||||||
ynoperationplan.smz_plan_worker_tomorrow_all
|
"ynoperationplan"."smz_plan_worker_tomorrow_all"
|
||||||
WHERE
|
WHERE
|
||||||
idNumber = #{idNumber}
|
"idNumber" = #{idNumber}
|
||||||
) a
|
) a
|
||||||
</select>
|
</select>
|
||||||
<select id="getProIdByIdNumber" resultType="java.lang.String">
|
<select id="getProIdByIdNumber" resultType="java.lang.String">
|
||||||
SELECT project_id FROM bm_worker_ein_history where id_number = #{idNumber} and is_active = '1' limit 1
|
SELECT "project_id" FROM "ynrealname"."bm_worker_ein_history" WHERE "id_number" = #{idNumber} AND "is_active" = '1' FETCH FIRST 1 ROWS ONLY
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectAttendanceMachineArr" resultType="java.lang.String">
|
<select id="selectAttendanceMachineArr" resultType="java.lang.String">
|
||||||
select bam.id from bm_attendance_machine bam
|
SELECT bam."id" FROM "ynrealname"."bm_attendance_machine" bam
|
||||||
left join bm_attendance_machine_pro_relation bampr on
|
LEFT JOIN "ynrealname"."bm_attendance_machine_pro_relation" bampr ON
|
||||||
bampr.attendance_machine_id = bam.id and bampr.is_active = 1
|
bampr."attendance_machine_id" = bam."id" AND bampr."is_active" = 1
|
||||||
where bam.is_active = 1 and bampr.pro_id = #{proId}
|
WHERE bam."is_active" = 1 AND bampr."pro_id" = #{proId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getOneYearNotInPlace" resultType="com.bonus.bmw.person.entity.OutPersonTimeoutBean">
|
<select id="getOneYearNotInPlace" resultType="com.bonus.bmw.person.entity.OutPersonTimeoutBean">
|
||||||
|
|
|
||||||
|
|
@ -3,16 +3,16 @@
|
||||||
<mapper namespace="com.bonus.bmw.subeva.dao.SubCompareDao">
|
<mapper namespace="com.bonus.bmw.subeva.dao.SubCompareDao">
|
||||||
<select id="comParelist" resultType="com.bonus.bmw.subeva.entity.SubEvaBean" >
|
<select id="comParelist" resultType="com.bonus.bmw.subeva.entity.SubEvaBean" >
|
||||||
SELECT
|
SELECT
|
||||||
eva."id" as uuid,
|
MAX(eva."id") as uuid,
|
||||||
bm."sub_name" AS subName,
|
MAX(bm."sub_name") AS subName,
|
||||||
td."value" AS evaMonth,
|
MAX(td."value") AS evaMonth,
|
||||||
bm."id",
|
bm."id",
|
||||||
eva."eva_grade" AS evaScore,
|
MAX(eva."eva_grade") AS evaScore,
|
||||||
eva."eva_name" AS evaName,
|
MAX(eva."eva_name") AS evaName,
|
||||||
eva."eva_date" AS evaDate,
|
MAX(eva."eva_date") AS evaDate,
|
||||||
eva."eva_toal" AS evaToal,
|
MAX(eva."eva_toal") AS evaToal,
|
||||||
eva."eva_id" as evaId,
|
MAX(eva."eva_id") as evaId,
|
||||||
eva."eva_year" as evaYear
|
MAX(eva."eva_year") as evaYear
|
||||||
FROM
|
FROM
|
||||||
"ynrealname"."bm_subcontractor" bm
|
"ynrealname"."bm_subcontractor" bm
|
||||||
LEFT JOIN "ynrealname"."t_dict" td ON td."type" = 'quartercheck' and td."value"=#{params.reasonSelect}
|
LEFT JOIN "ynrealname"."t_dict" td ON td."type" = 'quartercheck' and td."value"=#{params.reasonSelect}
|
||||||
|
|
@ -54,21 +54,23 @@
|
||||||
</select>
|
</select>
|
||||||
<select id="rankList" resultType="com.bonus.bmw.subeva.entity.SubEvaBean" >
|
<select id="rankList" resultType="com.bonus.bmw.subeva.entity.SubEvaBean" >
|
||||||
SELECT
|
SELECT
|
||||||
eva."id" as uuid,
|
MAX(eva."id") as uuid,
|
||||||
bm."sub_name" AS subName,
|
MAX(bm."sub_name") AS subName,
|
||||||
eva."eva_quarter" AS evaMonth,
|
MAX(eva."eva_quarter") AS evaMonth,
|
||||||
bm."id",
|
bm."id",
|
||||||
eva."eva_grade" AS evaScore,
|
MAX(eva."eva_grade") AS evaScore,
|
||||||
eva."eva_name" AS evaName,
|
MAX(eva."eva_name") AS evaName,
|
||||||
eva."eva_date" AS evaDate,
|
MAX(eva."eva_date") AS evaDate,
|
||||||
eva."eva_toal" AS evaToal,
|
MAX(eva."eva_toal") AS evaToal,
|
||||||
eva."eva_id" as evaId,
|
MAX(eva."eva_id") as evaId,
|
||||||
case WHEN FORMAT(sum(eva."eva_grade")/ COUNT(bm."sub_name"),2) > 90 then 1
|
CASE
|
||||||
when FORMAT(sum(eva."eva_grade")/ COUNT(bm."sub_name"),2) > 80 then 2
|
WHEN COUNT(bm."sub_name") = 0 THEN 0
|
||||||
when FORMAT(sum(eva."eva_grade")/ COUNT(bm."sub_name"),2) > 60 then 3
|
WHEN ROUND(SUM(eva."eva_grade") / NULLIF(COUNT(bm."sub_name"), 0), 2) > 90 THEN 1
|
||||||
when FORMAT(sum(eva."eva_grade")/ COUNT(bm."sub_name"),2) < 61 then 4
|
WHEN ROUND(SUM(eva."eva_grade") / NULLIF(COUNT(bm."sub_name"), 0), 2) > 80 THEN 2
|
||||||
else 0
|
WHEN ROUND(SUM(eva."eva_grade") / NULLIF(COUNT(bm."sub_name"), 0), 2) > 60 THEN 3
|
||||||
End as status
|
WHEN ROUND(SUM(eva."eva_grade") / NULLIF(COUNT(bm."sub_name"), 0), 2) < 61 THEN 4
|
||||||
|
ELSE 0
|
||||||
|
END as status
|
||||||
FROM
|
FROM
|
||||||
"ynrealname"."bm_subcontractor" bm
|
"ynrealname"."bm_subcontractor" bm
|
||||||
LEFT JOIN "ynrealname"."t_dict" td ON td."type" = 'quartercheck'
|
LEFT JOIN "ynrealname"."t_dict" td ON td."type" = 'quartercheck'
|
||||||
|
|
@ -76,23 +78,30 @@
|
||||||
LEFT JOIN "ynrealname"."fbeva_compare_eva" eva ON eva."contract_id" = bm."id"
|
LEFT JOIN "ynrealname"."fbeva_compare_eva" eva ON eva."contract_id" = bm."id"
|
||||||
AND eva."eva_year" = #{params.year}
|
AND eva."eva_year" = #{params.year}
|
||||||
<if test="params.reasonSelect != null and params.reasonSelect != ''">
|
<if test="params.reasonSelect != null and params.reasonSelect != ''">
|
||||||
AND eva."eva_quarter" LIKE concat ('%',#{params.reasonSelect},'%')
|
AND eva."eva_quarter" LIKE '%' || #{params.reasonSelect} || '%'
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
WHERE
|
WHERE
|
||||||
bm."is_active" = '1' and eva."eva_date" is not null
|
bm."is_active" = '1'
|
||||||
|
AND eva."eva_date" IS NOT NULL
|
||||||
<if test="params != null and params != ''">
|
<if test="params != null and params != ''">
|
||||||
<if test="params.subName != null and params.subName != ''">
|
<if test="params.subName != null and params.subName != ''">
|
||||||
AND bm."sub_name" LIKE concat ('%',#{params.subName},'%')
|
AND bm."sub_name" LIKE '%' || #{params.subName} || '%'
|
||||||
</if>
|
</if>
|
||||||
</if>
|
</if>
|
||||||
GROUP BY
|
GROUP BY
|
||||||
bm."id"
|
bm."id"
|
||||||
<if test="params.status != null and params.status != '' ">
|
<if test="params.status != null and params.status != ''">
|
||||||
having status = #{params.status}
|
HAVING
|
||||||
|
CASE
|
||||||
|
WHEN COUNT(bm."sub_name") = 0 THEN 0
|
||||||
|
WHEN ROUND(SUM(eva."eva_grade") / NULLIF(COUNT(bm."sub_name"), 0), 2) > 90 THEN 1
|
||||||
|
WHEN ROUND(SUM(eva."eva_grade") / NULLIF(COUNT(bm."sub_name"), 0), 2) > 80 THEN 2
|
||||||
|
WHEN ROUND(SUM(eva."eva_grade") / NULLIF(COUNT(bm."sub_name"), 0), 2) > 60 THEN 3
|
||||||
|
WHEN ROUND(SUM(eva."eva_grade") / NULLIF(COUNT(bm."sub_name"), 0), 2) < 61 THEN 4
|
||||||
|
ELSE 0
|
||||||
|
END = #{params.status}
|
||||||
</if>
|
</if>
|
||||||
order by status
|
ORDER BY status
|
||||||
|
|
||||||
<if test="offset != null and offset >= 0 and limit != null and limit >= 0">
|
<if test="offset != null and offset >= 0 and limit != null and limit >= 0">
|
||||||
OFFSET #{offset} ROWS FETCH NEXT #{limit} ROWS ONLY
|
OFFSET #{offset} ROWS FETCH NEXT #{limit} ROWS ONLY
|
||||||
</if>
|
</if>
|
||||||
|
|
|
||||||
|
|
@ -4,47 +4,57 @@
|
||||||
<select id="rankList" resultType="com.bonus.bmw.subeva.entity.SubEvaBean" >
|
<select id="rankList" resultType="com.bonus.bmw.subeva.entity.SubEvaBean" >
|
||||||
SELECT
|
SELECT
|
||||||
bsc."id" as id,
|
bsc."id" as id,
|
||||||
bp."NAME" as proName,
|
MAX(bp."name") as proName,
|
||||||
bs."sub_name" as subName,
|
MAX(bs."sub_name") as subName,
|
||||||
bsc."contract_name" as contractName,
|
MAX(bsc."contract_name") as contractName,
|
||||||
COUNT(bsr."id") AS teamNumber,
|
COUNT(bsr."id") AS teamNumber,
|
||||||
td."value" AS evaMonth,
|
MAX(td."value") AS evaMonth,
|
||||||
fcpe."eva_grade" AS evaGrade,
|
MAX(fcpe."eva_grade") AS evaGrade,
|
||||||
fcpe."eva_name" AS evaName,
|
MAX(fcpe."eva_name") AS evaName,
|
||||||
fcpe."eva_date" AS evaDate,
|
MAX(fcpe."eva_date") AS evaDate,
|
||||||
fcpe."eva_id" as evaId,
|
MAX(fcpe."eva_id") as evaId,
|
||||||
fcpe."eva_year" as evaYear,
|
MAX(fcpe."eva_year") as evaYear,
|
||||||
case WHEN ROUND(sum(fcpe."eva_grade")/ COUNT(bs."sub_name"),2) > 90 then 1
|
CASE
|
||||||
when ROUND(sum(fcpe."eva_grade")/ COUNT(bs."sub_name"),2) > 80 then 2
|
WHEN COUNT(bs."sub_name") = 0 THEN 0 -- 处理除数为0的情况
|
||||||
when ROUND(sum(fcpe."eva_grade")/ COUNT(bs."sub_name"),2) > 60 then 3
|
WHEN ROUND(SUM(fcpe."eva_grade") / COUNT(bs."sub_name"), 2) > 90 THEN 1
|
||||||
when ROUND(sum(fcpe."eva_grade")/ COUNT(bs."sub_name"),2) < 61 then 4
|
WHEN ROUND(SUM(fcpe."eva_grade") / COUNT(bs."sub_name"), 2) > 80 THEN 2
|
||||||
else 0
|
WHEN ROUND(SUM(fcpe."eva_grade") / COUNT(bs."sub_name"), 2) > 60 THEN 3
|
||||||
End as status
|
WHEN ROUND(SUM(fcpe."eva_grade") / COUNT(bs."sub_name"), 2) < 61 THEN 4
|
||||||
|
ELSE 0
|
||||||
|
END as status
|
||||||
FROM
|
FROM
|
||||||
"ynrealname"."bm_sub_contract" bsc
|
"ynrealname"."bm_sub_contract" bsc
|
||||||
LEFT JOIN "ynrealname"."bm_project" bp on bp."id" = bsc."pro_id" and bp."is_active" = '1'
|
LEFT JOIN "ynrealname"."bm_project" bp ON bp."id" = bsc."pro_id" AND bp."is_active" = '1'
|
||||||
LEFT JOIN "ynrealname"."bm_subcontractor" bs on bs."id" = bsc."sub_id" and bs."is_active" = '1'
|
LEFT JOIN "ynrealname"."bm_subcontractor" bs ON bs."id" = bsc."sub_id" AND bs."is_active" = '1'
|
||||||
LEFT JOIN "ynrealname"."bm_sub_relation" bsr ON bsr."sub_contract_id" = bsc."id" AND bsr."type" = '3' and bsr."is_active" = '1'
|
LEFT JOIN "ynrealname"."bm_sub_relation" bsr ON bsr."sub_contract_id" = bsc."id" AND bsr."type" = '3' AND bsr."is_active" = '1'
|
||||||
LEFT JOIN "ynrealname"."t_dict" td ON td."type" = 'monthcheck' and td."is_active" = '1'
|
LEFT JOIN "ynrealname"."t_dict" td ON td."type" = 'monthcheck' AND td."is_active" = '1'
|
||||||
LEFT JOIN "ynrealname"."fbeva_core_person_evalu" fcpe ON fcpe."eva_month" = td."value" AND bsc."id" = fcpe."contract_id" and fcpe."eva_year" = #{params.year}
|
LEFT JOIN "ynrealname"."fbeva_core_person_evalu" fcpe ON fcpe."eva_month" = td."value" AND bsc."id" = fcpe."contract_id" AND fcpe."eva_year" = #{params.year}
|
||||||
|
WHERE
|
||||||
WHERE bsc."is_active" = '1' and td."value" = #{params.month} and fcpe."eva_date" is not null
|
bsc."is_active" = '1'
|
||||||
|
AND td."value" = #{params.month}
|
||||||
|
AND fcpe."eva_date" IS NOT NULL
|
||||||
<if test="params != null and params != ''">
|
<if test="params != null and params != ''">
|
||||||
<if test="params.proId != null and params.proId != ''">
|
<if test="params.proId != null and params.proId != ''">
|
||||||
AND bp."id" =#{params.proId}
|
AND bp."id" = #{params.proId}
|
||||||
</if>
|
</if>
|
||||||
<if test="params.subName != null and params.subName != ''">
|
<if test="params.subName != null and params.subName != ''">
|
||||||
AND bs."sub_name" LIKE concat('%', #{params.subName}, '%')
|
AND bs."sub_name" LIKE concat('%', #{params.subName}, '%')
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
</if>
|
</if>
|
||||||
GROUP BY
|
GROUP BY
|
||||||
bsc."id", bp."NAME", bs."sub_name", bsc."contract_name", td."value",
|
bsc."id"
|
||||||
fcpe."eva_grade", fcpe."eva_name", fcpe."eva_date", fcpe."eva_id", fcpe."eva_year"
|
<if test="params.status != null and params.status != ''">
|
||||||
order by status
|
HAVING
|
||||||
<if test="params.status != null and params.status != '' ">
|
CASE
|
||||||
having status = #{params.status}
|
WHEN COUNT(bs."sub_name") = 0 THEN 0
|
||||||
|
WHEN ROUND(SUM(fcpe."eva_grade") / COUNT(bs."sub_name"), 2) > 90 THEN 1
|
||||||
|
WHEN ROUND(SUM(fcpe."eva_grade") / COUNT(bs."sub_name"), 2) > 80 THEN 2
|
||||||
|
WHEN ROUND(SUM(fcpe."eva_grade") / COUNT(bs."sub_name"), 2) > 60 THEN 3
|
||||||
|
WHEN ROUND(SUM(fcpe."eva_grade") / COUNT(bs."sub_name"), 2) < 61 THEN 4
|
||||||
|
ELSE 0
|
||||||
|
END = #{params.status}
|
||||||
</if>
|
</if>
|
||||||
|
ORDER BY status
|
||||||
<if test="offset != null and offset >= 0 and limit != null and limit >= 0">
|
<if test="offset != null and offset >= 0 and limit != null and limit >= 0">
|
||||||
OFFSET #{offset} ROWS FETCH NEXT #{limit} ROWS ONLY
|
OFFSET #{offset} ROWS FETCH NEXT #{limit} ROWS ONLY
|
||||||
</if>
|
</if>
|
||||||
|
|
@ -52,7 +62,7 @@
|
||||||
|
|
||||||
<select id="rankCount" resultType="java.lang.Integer">
|
<select id="rankCount" resultType="java.lang.Integer">
|
||||||
SELECT
|
SELECT
|
||||||
count(1)
|
count(DISTINCT bsc."id")
|
||||||
FROM
|
FROM
|
||||||
"ynrealname"."bm_sub_contract" bsc
|
"ynrealname"."bm_sub_contract" bsc
|
||||||
LEFT JOIN "ynrealname"."bm_project" bp on bp."id" = bsc."pro_id" and bp."is_active" = '1'
|
LEFT JOIN "ynrealname"."bm_project" bp on bp."id" = bsc."pro_id" and bp."is_active" = '1'
|
||||||
|
|
@ -62,6 +72,19 @@
|
||||||
LEFT JOIN "ynrealname"."fbeva_core_person_evalu" fcpe ON fcpe."eva_month" = td."value" AND bsc."id" = fcpe."contract_id" and fcpe."eva_year" = #{params.year}
|
LEFT JOIN "ynrealname"."fbeva_core_person_evalu" fcpe ON fcpe."eva_month" = td."value" AND bsc."id" = fcpe."contract_id" and fcpe."eva_year" = #{params.year}
|
||||||
|
|
||||||
WHERE bsc."is_active" = '1' and td."value" = #{params.month} and fcpe."eva_date" is not null
|
WHERE bsc."is_active" = '1' and td."value" = #{params.month} and fcpe."eva_date" is not null
|
||||||
|
GROUP BY
|
||||||
|
bsc."id"
|
||||||
|
<if test="params.status != null and params.status != ''">
|
||||||
|
HAVING
|
||||||
|
CASE
|
||||||
|
WHEN COUNT(bs."sub_name") = 0 THEN 0
|
||||||
|
WHEN ROUND(SUM(fcpe."eva_grade") / COUNT(bs."sub_name"), 2) > 90 THEN 1
|
||||||
|
WHEN ROUND(SUM(fcpe."eva_grade") / COUNT(bs."sub_name"), 2) > 80 THEN 2
|
||||||
|
WHEN ROUND(SUM(fcpe."eva_grade") / COUNT(bs."sub_name"), 2) > 60 THEN 3
|
||||||
|
WHEN ROUND(SUM(fcpe."eva_grade") / COUNT(bs."sub_name"), 2) < 61 THEN 4
|
||||||
|
ELSE 0
|
||||||
|
END = #{params.status}
|
||||||
|
</if>
|
||||||
</select>
|
</select>
|
||||||
<select id="list" resultType="com.bonus.bmw.subeva.entity.SubEvaBean" >
|
<select id="list" resultType="com.bonus.bmw.subeva.entity.SubEvaBean" >
|
||||||
SELECT
|
SELECT
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
eva."id" as uuid,
|
eva."id" as uuid,
|
||||||
b."id",
|
b."id",
|
||||||
b."value",
|
b."value",
|
||||||
b."subName",
|
b.subName,
|
||||||
#{params.reasonSelect} as evaQuarter,
|
#{params.reasonSelect} as evaQuarter,
|
||||||
eva."eva_score" AS evaScore,
|
eva."eva_score" AS evaScore,
|
||||||
eva."eva_name" AS evaName,
|
eva."eva_name" AS evaName,
|
||||||
|
|
@ -28,7 +28,7 @@
|
||||||
</if>
|
</if>
|
||||||
where 1=1
|
where 1=1
|
||||||
<if test="params.subName != null and params.subName != ''">
|
<if test="params.subName != null and params.subName != ''">
|
||||||
AND b."subName" LIKE concat('%', #{params.subName}, '%')
|
AND b.subName LIKE concat('%', #{params.subName}, '%')
|
||||||
</if>
|
</if>
|
||||||
ORDER BY b."id"
|
ORDER BY b."id"
|
||||||
<if test="offset != null and offset >= 0 and limit != null and limit >= 0">
|
<if test="offset != null and offset >= 0 and limit != null and limit >= 0">
|
||||||
|
|
@ -42,7 +42,7 @@
|
||||||
eva."id" as uuid,
|
eva."id" as uuid,
|
||||||
b."id",
|
b."id",
|
||||||
b."value",
|
b."value",
|
||||||
b."subName",
|
b.subName,
|
||||||
NVL(CONCAT(eva."eva_years",b."value",'半年') ,CONCAT(EXTRACT(YEAR FROM SYSDATE),b."value",'半年')) as evaQuarter,
|
NVL(CONCAT(eva."eva_years",b."value",'半年') ,CONCAT(EXTRACT(YEAR FROM SYSDATE),b."value",'半年')) as evaQuarter,
|
||||||
eva."eva_score" AS evaScore,
|
eva."eva_score" AS evaScore,
|
||||||
eva."eva_name" AS evaName,
|
eva."eva_name" AS evaName,
|
||||||
|
|
@ -52,8 +52,7 @@
|
||||||
from (
|
from (
|
||||||
SELECT bs."id",bs."sub_name" as subName,a."value" from "ynrealname"."bm_subcontractor" bs
|
SELECT bs."id",bs."sub_name" as subName,a."value" from "ynrealname"."bm_subcontractor" bs
|
||||||
LEFT JOIN (
|
LEFT JOIN (
|
||||||
select * from "ynrealname"."t_dict" td where td."type" = 'yeartype'
|
select * from "ynrealname"."t_dict" td where td."type" = 'yeartype' AND td."is_active" = '1'
|
||||||
AND td."is_active" = '1'
|
|
||||||
)a on 1=1
|
)a on 1=1
|
||||||
where bs."is_active" = '1'
|
where bs."is_active" = '1'
|
||||||
ORDER BY bs."id"
|
ORDER BY bs."id"
|
||||||
|
|
@ -64,7 +63,7 @@
|
||||||
</if>
|
</if>
|
||||||
where 1=1
|
where 1=1
|
||||||
<if test="params.subName != null and params.subName != ''">
|
<if test="params.subName != null and params.subName != ''">
|
||||||
AND b."subName" LIKE concat('%', #{params.subName}, '%')
|
AND b.subName LIKE concat('%', #{params.subName}, '%')
|
||||||
</if>
|
</if>
|
||||||
ORDER BY b."id"
|
ORDER BY b."id"
|
||||||
)c
|
)c
|
||||||
|
|
@ -116,7 +115,7 @@
|
||||||
eva."id" as uuid,
|
eva."id" as uuid,
|
||||||
b."id",
|
b."id",
|
||||||
b."value",
|
b."value",
|
||||||
b."subName",
|
b.subName,
|
||||||
NVL(CONCAT(eva."eva_years",b."value",'半年') ,CONCAT(EXTRACT(YEAR FROM SYSDATE),b."value",'半年')) as evaQuarter,
|
NVL(CONCAT(eva."eva_years",b."value",'半年') ,CONCAT(EXTRACT(YEAR FROM SYSDATE),b."value",'半年')) as evaQuarter,
|
||||||
eva."eva_score" AS evaScore,
|
eva."eva_score" AS evaScore,
|
||||||
eva."eva_name" AS evaName,
|
eva."eva_name" AS evaName,
|
||||||
|
|
@ -138,7 +137,7 @@
|
||||||
</if>
|
</if>
|
||||||
where 1=1 and eva."eva_date" is not null
|
where 1=1 and eva."eva_date" is not null
|
||||||
<if test="params.subName != null and params.subName != ''">
|
<if test="params.subName != null and params.subName != ''">
|
||||||
AND b."subName" LIKE concat('%', #{params.subName}, '%')
|
AND b.subName LIKE concat('%', #{params.subName}, '%')
|
||||||
</if>
|
</if>
|
||||||
ORDER BY b."id"
|
ORDER BY b."id"
|
||||||
)c
|
)c
|
||||||
|
|
|
||||||
|
|
@ -127,11 +127,17 @@
|
||||||
MAX(fsp."eva_month") as evaMonth,
|
MAX(fsp."eva_month") as evaMonth,
|
||||||
MAX(fsp."eva_score") AS evaScore,
|
MAX(fsp."eva_score") AS evaScore,
|
||||||
COUNT(bs."sub_name") as proNum,
|
COUNT(bs."sub_name") as proNum,
|
||||||
SUM(fsp."eva_score") / COUNT(bs."sub_name") as evaScore,
|
case
|
||||||
case WHEN ROUND(SUM(fsp."eva_score") / COUNT(bs."sub_name"),2) > 90 then 1
|
WHEN
|
||||||
when ROUND(SUM(fsp."eva_score") / COUNT(bs."sub_name"),2) > 80 then 2
|
COUNT(bm."sub_name") = 0 THEN 0
|
||||||
when ROUND(SUM(fsp."eva_score") / COUNT(bs."sub_name"),2) > 60 then 3
|
ELSE SUM(fsp."eva_score") / COUNT(bs."sub_name")
|
||||||
when ROUND(SUM(fsp."eva_score") / COUNT(bs."sub_name"),2) < 61 then 4
|
END as evaScore
|
||||||
|
case
|
||||||
|
WHEN COUNT(bm."sub_name") = 0 THEN 0
|
||||||
|
WHEN ROUND(SUM(fsp."eva_score") / NULLIF(COUNT(bm."sub_name"), 0), 2) > 90 THEN 1
|
||||||
|
when ROUND(SUM(fsp."eva_score") / NULLIF(COUNT(bm."sub_name"), 0), 2) > 80 THEN 2
|
||||||
|
when ROUND(SUM(fsp."eva_score") / NULLIF(COUNT(bm."sub_name"), 0), 2) > 60 THEN 3
|
||||||
|
when ROUND(SUM(fsp."eva_score") / NULLIF(COUNT(bm."sub_name"), 0), 2) < 61 THEN 4
|
||||||
else 0
|
else 0
|
||||||
End as status
|
End as status
|
||||||
FROM
|
FROM
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue