333 lines
15 KiB
XML
333 lines
15 KiB
XML
<?xml version="1.0" encoding="UTF-8" ?>
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
|
<mapper namespace="com.sercurityControl.proteam.dutyTask.mapper.WorkPermitMapper">
|
|
<!--导入骨干成绩-->
|
|
<insert id="addBackboneScore">
|
|
REPLACE INTO tb_core_grade(user_code,user_name,id_number,unit,part,score,qualified,test_time,effective_time,
|
|
work_type,people_type,people_status,create_time,update_time) VALUES (
|
|
#{userCode},#{userName},#{idNumber},#{unit},#{part},#{score},#{qualified},#{testTime},#{effectiveTime},
|
|
#{workType},#{peopleType},'正常',#{createTime},#{updateTime}
|
|
)
|
|
</insert>
|
|
<!--编辑状态-->
|
|
<insert id="editPeopleStatus">
|
|
REPLACE INTO tb_backbone_status(id_number,people_status) VALUES (
|
|
#{params.idNumber},#{params.peopleStatus}
|
|
)
|
|
</insert>
|
|
<!--新增/修改人员骨干-->
|
|
<insert id="addOrEditPeople">
|
|
<if test="type == 1">
|
|
REPLACE INTO tb_core_grade(user_code,user_name,id_number,unit,part,score,qualified,test_time,effective_time,
|
|
work_type,people_type,people_status,create_time,update_time) VALUES (
|
|
#{userCode},#{userName},#{idNumber},#{unit},#{part},#{score},#{qualified},#{testTime},#{effectiveTime},
|
|
#{workType},#{peopleType},'正常',#{createTime},#{updateTime}
|
|
)
|
|
</if>
|
|
<if test="type == 2">
|
|
UPDATE tb_core_grade SET user_code = #{userCode},user_name = #{userName},unit = #{unit},part = #{part},
|
|
score = #{score},qualified = #{qualified},test_time = #{testTime},effective_time = #{effectiveTime},work_type = #{workType},
|
|
people_type = #{peopleType},update_time = #{updateTime} WHERE id_number = #{idNumber} AND del_status = '0'
|
|
</if>
|
|
</insert>
|
|
<update id="delPeople">
|
|
<if test="type == 1">
|
|
UPDATE tb_core_grade SET del_status = '1' WHERE id_number = #{idNumber}
|
|
</if>
|
|
<if test="type == 2">
|
|
UPDATE tb_backbone_status SET del_flag = '1' WHERE id_number = #{idNumber}
|
|
</if>
|
|
</update>
|
|
<!--更新作业许可及销号-->
|
|
<update id="updateTicketEssenCondition">
|
|
<if test="type == 1 or type == 2">
|
|
INSERT INTO tb_ticket_essen_condition (ticket_no,radio_one,radio_two,radio_three,radio_four,radio_five,permit_user,permit_time,cancel_status,create_date)
|
|
VALUES (
|
|
#{ticketNo},#{radioOne},#{radioTwo},#{radioThree},#{radioFour},#{radioFive},
|
|
#{permitUser},#{permitTime},#{cancelStatus},CURRENT_DATE
|
|
)
|
|
</if>
|
|
<if test="type == 3">
|
|
UPDATE tb_ticket_essen_condition SET cancel_time = #{cancelTime},cancel_user = #{cancelUser},cancel_status = #{cancelStatus}
|
|
WHERE ticket_no = #{ticketNo} AND del_flag = '0'
|
|
</if>
|
|
</update>
|
|
<!--删除作业销号及许可-->
|
|
<update id="delData">
|
|
UPDATE tb_ticket_essen_condition SET del_flag = '1' WHERE id = #{id}
|
|
</update>
|
|
|
|
<!--骨干成绩列表-->
|
|
<select id="getBackboneScoreList"
|
|
resultType="com.sercurityControl.proteam.dutyTask.domain.BackboneScoreEntity">
|
|
SELECT
|
|
tbs.user_name AS userName,
|
|
tbs.id_number AS idNumber,
|
|
tbs.score,
|
|
tbs.qualified,
|
|
tbs.people_type AS peopleType,
|
|
IFNULL(tbst.people_status,tbs.people_status) AS peopleStatus
|
|
FROM tb_core_grade tbs
|
|
LEFT JOIN tb_backbone_status tbst ON tbs.id_number = tbst.id_number AND tbst.del_flag = '0'
|
|
WHERE tbs.del_status = '0'
|
|
<if test="userName!=null and userName!=''">
|
|
AND INSTR(tbs.user_name,#{userName}) > 0
|
|
</if>
|
|
<if test="idNumber!=null and idNumber!=''">
|
|
AND INSTR(tbs.id_number,#{idNumber}) > 0
|
|
</if>
|
|
<if test="qualified!=null and qualified!=''">
|
|
AND tbs.qualified = #{qualified}
|
|
</if>
|
|
<if test="peopleStatus!=null and peopleStatus!=''">
|
|
AND IFNULL(tbst.people_status,tbs.people_status) = #{peopleStatus}
|
|
</if>
|
|
ORDER BY tbs.create_time DESC
|
|
</select>
|
|
<!--人员骨干是否存在-->
|
|
<select id="peopleIsExist" resultType="java.lang.Integer">
|
|
SELECT COUNT(*) FROM tb_core_grade WHERE id_number = #{idNumber} AND del_status = '0'
|
|
</select>
|
|
<!--骨干人员详情-->
|
|
<select id="getPeopleById" resultType="com.sercurityControl.proteam.dutyTask.domain.BackboneScoreEntity">
|
|
SELECT
|
|
user_code AS userCode,
|
|
user_name AS userName,
|
|
id_number AS idNumber,
|
|
unit,
|
|
part,
|
|
score,
|
|
qualified,
|
|
test_time AS testTime,
|
|
effective_time AS effectiveTime,
|
|
work_type AS workType,
|
|
people_type AS peopleType
|
|
FROM tb_core_grade WHERE id_number = #{idNumber} AND del_status = '0'
|
|
</select>
|
|
<!--作业许可及销号必备条件详情-->
|
|
<select id="queryTicketEssenCondition"
|
|
resultType="com.sercurityControl.proteam.dutyTask.domain.TicketEssenCondition">
|
|
SELECT
|
|
ticket_no AS ticketNo,
|
|
radio_one AS radioOne,
|
|
radio_two AS radioTwo,
|
|
radio_three AS radioThree,
|
|
radio_four AS radioFour,
|
|
radio_five AS radioFive,
|
|
permit_user AS permitUser,
|
|
permit_time AS permitTime,
|
|
cancel_time AS cancelTime
|
|
FROM tb_ticket_essen_condition
|
|
WHERE ticket_no = #{ticketNo} AND del_flag = '0'
|
|
</select>
|
|
|
|
<!--根据作业票id获取班组骨干-->
|
|
<select id="getBackboneByIdList" resultType="java.util.Map">
|
|
SELECT
|
|
ttip.real_name AS `name`,
|
|
jdc.`value` AS workType,
|
|
CASE tbc.qualified
|
|
WHEN '优秀' THEN '1'
|
|
WHEN '合格' THEN '1' WHEN '不合格' THEN '2' WHEN '缺考' THEN '2' END AS isPass
|
|
FROM jj_ticket_people ttip
|
|
left join jj_data_code jdc on jdc.code_value=ttip.position_code AND jdc.code='POSITION_CODE'
|
|
INNER JOIN tb_core_grade tbc ON ttip.id_card = tbc.id_number
|
|
WHERE ttip.ticket_id = #{ticketId}
|
|
</select>
|
|
<!--根据作业票id获取准入人员-->
|
|
<select id="getAccessPeopleByIdList" resultType="java.util.Map">
|
|
SELECT
|
|
ttip.real_name AS `name`,
|
|
IF(a.personnel_id IS NULL,'2' , '1') AS accessInfo
|
|
FROM jj_ticket_people ttip
|
|
LEFT JOIN (
|
|
SELECT DISTINCT personnel_id FROM jj_user
|
|
WHERE delete_flag = '0'
|
|
GROUP BY personnel_id
|
|
) a ON ttip.personnel_id = a.personnel_id
|
|
WHERE ttip.ticket_id = #{ticketId}
|
|
</select>
|
|
<!--作业票列表-->
|
|
<select id="getTicketList" resultType="com.sercurityControl.proteam.dutyTask.domain.TicketVo">
|
|
SELECT
|
|
so.city_name AS cityName,
|
|
tti.ticket_type AS jobType,
|
|
tti.ticket_no AS jobNum,
|
|
tti.bidding_section_name AS projectName,
|
|
tti.ticket_name AS jobName,
|
|
tti.working_team_name AS jobTeam,
|
|
jtp.real_name AS jobLeader,
|
|
tti.re_assessment_risk_level AS riskLevel,
|
|
CASE tti.ticket_status
|
|
WHEN '01' THEN '撤回'
|
|
WHEN '02' THEN '驳回'
|
|
WHEN '03' THEN '提交审核中'
|
|
WHEN '04' THEN '待执行'
|
|
WHEN '05' THEN '执行中'
|
|
WHEN '06' THEN '已结束'
|
|
WHEN '07' THEN '作废'
|
|
WHEN '08' THEN '删除'
|
|
ELSE '其他' END AS jobCurrentState,
|
|
tti.create_time AS createTime,
|
|
tti.update_time AS updateTime
|
|
FROM jj_ticket tti
|
|
left join jj_ticket_people jtp on jtp.ticket_id=tti.id and jtp.position_code='0900101'
|
|
LEFT JOIN sys_org so ON tti.build_unit_code = so.org_id
|
|
<where>
|
|
<if test="keyWord!=null and keyWord!= ''">
|
|
(
|
|
INSTR(tti.ticket_no,#{keyWord}) > 0 OR
|
|
INSTR(tti.bidding_section_name,#{keyWord}) > 0 OR
|
|
INSTR(tti.working_team_name,#{keyWord}) > 0 OR
|
|
INSTR(jtp.real_name,#{keyWord}) > 0
|
|
)
|
|
</if>
|
|
<if test="riskLevel!=null and riskLevel!=''">
|
|
AND tti.re_assessment_risk_level IN (
|
|
<foreach collection="riskLevelList" item="item" separator=",">
|
|
#{item}
|
|
</foreach>
|
|
)
|
|
</if>
|
|
<if test="cityName!=null and cityName!=''">
|
|
AND so.org_id IN (
|
|
<foreach collection="cityNameList" item="item" separator=",">
|
|
#{item}
|
|
</foreach>
|
|
)
|
|
</if>
|
|
<if test="jobCurrentState!=''">
|
|
AND tti.ticket_status = #{jobCurrentState}
|
|
</if>
|
|
AND tti.delete_flag = '0'
|
|
</where>
|
|
</select>
|
|
<!--地市作业票占比-->
|
|
<select id="getOrgNumAndRate" resultType="java.util.Map">
|
|
SELECT so.org_id AS `code`, so.city_name AS `name` ,IFNULL(a.num,0) AS num
|
|
FROM sys_org so
|
|
LEFT JOIN (
|
|
SELECT tti.build_unit_code build_org_no,COUNT(tti.build_unit_code) AS num
|
|
FROM jj_ticket tti
|
|
left join jj_ticket_people jtp on jtp.ticket_id=tti.id and jtp.position_code='0900101'
|
|
<where>
|
|
<if test="keyWord!=null and keyWord!= ''">
|
|
(
|
|
INSTR(tti.ticket_no,#{keyWord}) > 0 OR
|
|
INSTR(tti.bidding_section_name,#{keyWord}) > 0 OR
|
|
INSTR(tti.working_team_name,#{keyWord}) > 0 OR
|
|
INSTR(jtp.real_name,#{keyWord}) > 0
|
|
)
|
|
</if>
|
|
<if test="riskLevel!=null and riskLevel!=''">
|
|
AND tti.re_assessment_risk_level IN (
|
|
<foreach collection="riskLevelList" item="item" separator=",">
|
|
#{item}
|
|
</foreach>
|
|
)
|
|
</if>
|
|
<if test="jobCurrentState!=''">
|
|
AND tti.ticket_status = #{jobCurrentState}
|
|
</if>
|
|
AND tti.delete_flag = '0'
|
|
</where>
|
|
GROUP BY tti.build_unit_code
|
|
)a ON a.build_org_no = so.org_id
|
|
ORDER BY num DESC
|
|
</select>
|
|
<!--作业许可-> 许可和不许可数量-->
|
|
<select id="getWorkPermitAndXhNum" resultType="java.util.Map">
|
|
SELECT
|
|
COUNT(IF(ttec.cancel_status = '1' AND tti.ticket_status IN ('04','05','09'),1,NULL)) AS permit,
|
|
COUNT(IF(ttec.cancel_status = '2',1,NULL)) AS notPermit,
|
|
COUNT(IF(ttec.cancel_status = '3',1,NULL)) AS cancel,
|
|
COUNT(IF(ttec.cancel_status = '1' AND tti.ticket_status in('06','09'),1,NULL)) AS notCancel
|
|
FROM tb_ticket_essen_condition ttec
|
|
LEFT JOIN jj_ticket tti ON tti.ticket_no = ttec.ticket_no AND tti.delete_flag = '0'
|
|
WHERE ttec.del_flag = '0' AND tti.re_assessment_risk_level IN ('2','3') AND ttec.cancel_status IN ('1','2','3')
|
|
<if test="isSup == 3">
|
|
AND tti.build_unit_code = #{currentUserOrgId}
|
|
</if>
|
|
</select>
|
|
<!--许可及销号作业票列表-->
|
|
<select id="getTicketEssenConditionList"
|
|
resultType="com.sercurityControl.proteam.dutyTask.domain.TicketEssenConVo">
|
|
SELECT
|
|
ttec.id AS id,
|
|
ttec.ticket_no AS ticketNo,
|
|
ttec.permit_user AS permitUser,
|
|
permit_time AS permitTime,
|
|
cancel_time AS cancelTime,
|
|
CASE cancel_status
|
|
WHEN '1' THEN '许可'
|
|
WHEN '2' THEN '不许可'
|
|
WHEN '3' THEN '已销号'
|
|
END AS cancelStatus,
|
|
cancel_user AS cancelUser,
|
|
tti.ticket_no AS ticketNo2,
|
|
CASE tti.ticket_status
|
|
WHEN '01' THEN '撤回'
|
|
WHEN '02' THEN '驳回'
|
|
WHEN '03' THEN '提交审核中'
|
|
WHEN '04' THEN '待执行'
|
|
WHEN '05' THEN '执行中'
|
|
WHEN '06' THEN '已结束'
|
|
WHEN '07' THEN '作废'
|
|
WHEN '08' THEN '删除'
|
|
ELSE '其他' END AS jobCurrentState
|
|
FROM tb_ticket_essen_condition ttec
|
|
LEFT JOIN jj_ticket tti ON ttec.ticket_no = tti.ticket_no AND tti.delete_flag = '0'
|
|
WHERE ttec.del_flag = '0'
|
|
<if test="cancelStatus != null and cancelStatus != ''">
|
|
AND cancel_status = #{cancelStatus}
|
|
</if>
|
|
<if test="ticketNo != null and ticketNo != ''">
|
|
AND INSTR(ttec.ticket_no,#{ticketNo}) > 0
|
|
</if>
|
|
</select>
|
|
<!--作业许可及风险销号数据-->
|
|
<select id="getWorkPermitAndXhList2"
|
|
resultType="com.sercurityControl.proteam.dutyTask.domain.WorkPermitAndXhEntity">
|
|
SELECT
|
|
tti.id AS ticketId,
|
|
tti.ticket_no AS ticketNo,
|
|
tti.re_assessment_risk_level AS riskLevel,
|
|
jtp.real_name AS workManager,
|
|
tti.bidding_section_name AS projectName,
|
|
tti.bidding_section_code AS bidNo,
|
|
|
|
<if test="type == 1">
|
|
CASE ttec.cancel_status WHEN '1' THEN '许可' WHEN '2' THEN '不许可' ELSE '新开票' END AS status
|
|
</if>
|
|
<if test="type == 2">
|
|
CASE ttec.cancel_status WHEN '1' THEN '未销号' WHEN '3' THEN '已销号' END AS status
|
|
</if>
|
|
FROM jj_ticket tti
|
|
left join jj_ticket_people jtp on jtp.ticket_id=tti.id and jtp.position_code='0900101'
|
|
LEFT JOIN tb_ticket_essen_condition ttec ON tti.ticket_no = ttec.ticket_no AND ttec.del_flag = '0'
|
|
<if test="type == 1">
|
|
WHERE tti.delete_flag = '0' AND tti.re_assessment_risk_level IN ('2','3')
|
|
<if test="status != '' and status != null">
|
|
<if test="status == 0">
|
|
AND tti.ticket_status = '04' AND ttec.cancel_status IS NULL
|
|
</if>
|
|
<if test="status == 1">
|
|
AND tti.ticket_status IN ('04','05','09') AND ttec.cancel_status = #{status}
|
|
</if>
|
|
<if test="status == 2">
|
|
AND tti.ticket_status IN ('04','05','06','09') AND ttec.cancel_status = #{status}
|
|
</if>
|
|
</if>
|
|
</if>
|
|
<if test="type == 2">
|
|
WHERE tti.ticket_status IN ('06','09') AND tti.delete_flag = '0' AND ttec.cancel_status IN ('1','3') AND tti.re_assessment_risk_level IN ('2','3')
|
|
<if test="status!='' and status!=null">
|
|
AND ttec.cancel_status = #{status}
|
|
</if>
|
|
</if>
|
|
<if test="isSup == 3">
|
|
AND tti.build_unit_code = #{currentUserOrgId}
|
|
</if>
|
|
ORDER BY ttec.cancel_status,tti.re_assessment_risk_level
|
|
</select>
|
|
</mapper> |