<?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.gkhy.safePlatform.specialWork.repository.WorkApplyInfoRepository" >
|
<resultMap id="WorkApplyInfo" type="com.gkhy.safePlatform.specialWork.entity.WorkApplyInfo" >
|
<id column="id" property="id" jdbcType="BIGINT" />
|
<result column="eid" property="eid" jdbcType="BIGINT"/>
|
<result column="dep_id" property="depId" jdbcType="BIGINT"/>
|
<result column="dep_name" property="depName" jdbcType="VARCHAR"/>
|
<result column="apply_uid" property="applyUid" jdbcType="BIGINT"/>
|
<result column="apply_uname" property="applyUname" jdbcType="VARCHAR"/>
|
<result column="work_permit_no" property="workPermitNo" jdbcType="VARCHAR"/>
|
<result column="work_type" property="workType" jdbcType="TINYINT"/>
|
<result column="work_level" property="workLevel" jdbcType="TINYINT"/>
|
<result column="work_content" property="workContent" jdbcType="VARCHAR"/>
|
<result column="work_location" property="workLocation" jdbcType="VARCHAR"/>
|
<result column="hazard_identification" property="hazardIdentification" jdbcType="VARCHAR"/>
|
<result column="work_detail_id" property="workDetailId" jdbcType="BIGINT"/>
|
<result column="status" property="status" jdbcType="TINYINT"/>
|
<result column="approval_step" property="approvalStep" jdbcType="INTEGER"/>
|
<result column="apply_time" property="applyTime" jdbcType="TIMESTAMP"/>
|
<result column="operator_uid" property="operatorUid" jdbcType="TINYINT"/>
|
<result column="operator_uname" property="operatorUname" jdbcType="VARCHAR"/>
|
<result column="exp_start_time" property="expStartTime" jdbcType="TIMESTAMP"/>
|
<result column="exp_end_time" property="expEndTime" jdbcType="TIMESTAMP"/>
|
<result column="gmt_create" property="gmtCreate" jdbcType="TIMESTAMP"/>
|
<result column="gmt_modified" property="gmtModified" jdbcType="TIMESTAMP"/>
|
<result column="ma_base_id" property="maBaseId" jdbcType="BIGINT"/>
|
<result column="material_status" property="materialStatus" jdbcType="TINYINT"/>
|
</resultMap>
|
|
<resultMap id="WorkApplyInfoBO" type="com.gkhy.safePlatform.specialWork.model.bo.WorkApplyPendingInfoBO" >
|
<id column="id" property="workApplyId" jdbcType="BIGINT" />
|
<result column="eid" property="eid" jdbcType="BIGINT"/>
|
<result column="dep_id" property="depId" jdbcType="BIGINT"/>
|
<result column="dep_name" property="depName" jdbcType="VARCHAR"/>
|
<result column="apply_uid" property="applyUid" jdbcType="BIGINT"/>
|
<result column="apply_uname" property="applyUname" jdbcType="VARCHAR"/>
|
<result column="work_permit_no" property="workPermitNo" jdbcType="VARCHAR"/>
|
<result column="work_type" property="workType" jdbcType="TINYINT"/>
|
<result column="work_level" property="workLevel" jdbcType="TINYINT"/>
|
<result column="work_content" property="workContent" jdbcType="VARCHAR"/>
|
<result column="work_location" property="workLocation" jdbcType="VARCHAR"/>
|
<result column="hazard_identification" property="hazardIdentification" jdbcType="VARCHAR"/>
|
<result column="work_detail_id" property="workDetailId" jdbcType="BIGINT"/>
|
<result column="status" property="status" jdbcType="TINYINT"/>
|
<result column="approval_step" property="approvalStep" jdbcType="INTEGER"/>
|
<result column="apply_time" property="applyTime" jdbcType="TIMESTAMP"/>
|
<result column="operator_uid" property="operatorUid" jdbcType="TINYINT"/>
|
<result column="operator_uname" property="operatorUname" jdbcType="VARCHAR"/>
|
<result column="exp_start_time" property="expStartTime" jdbcType="TIMESTAMP"/>
|
<result column="exp_end_time" property="expEndTime" jdbcType="TIMESTAMP"/>
|
<result column="gmt_create" property="gmtCreate" jdbcType="TIMESTAMP"/>
|
<result column="gmt_modified" property="gmtModified" jdbcType="TIMESTAMP"/>
|
<result column="step_id" property="stepId" jdbcType="BIGINT"/>
|
<result column="step_type" property="stepType" jdbcType="TINYINT"/>
|
<result column="step_approval_result" property="stepApprovalResult" jdbcType="TINYINT"/>
|
<result column="step_serial" property="stepSerial" jdbcType="INTEGER"/>
|
<result column="step_start_approval_time" property="stepStartApprovalTime" jdbcType="TIMESTAMP"/>
|
<result column="step_finish_approval_time" property="stepFinishApprovalTime" jdbcType="TIMESTAMP"/>
|
<result column="step_exp_finish_approval_time" property="stepExpFinishApprovalTime" jdbcType="TIMESTAMP"/>
|
<result column="pre_step_id" property="preStepId" jdbcType="BIGINT"/>
|
<result column="next_step_id" property="nextStepId" jdbcType="BIGINT"/>
|
<result column="is_contain_item" property="containItem" jdbcType="TINYINT"/>
|
<result column="unit_id" property="unitId" jdbcType="BIGINT"/>
|
<result column="unit_approval_uid" property="unitApprovalUid" jdbcType="BIGINT"/>
|
<result column="unit_approval_uname" property="unitApprovalUname" jdbcType="VARCHAR"/>
|
<result column="unit_result" property="unitResult" jdbcType="TINYINT"/>
|
<result column="unit_approval_start_time" property="unitApprovalStartTime" jdbcType="TIMESTAMP"/>
|
<result column="unit_approval_end_time" property="unitApprovalEndTime" jdbcType="TIMESTAMP"/>
|
<result column="unit_approval_actual_time" property="unitApprovalActualTime" jdbcType="TIMESTAMP"/>
|
<result column="unit_fill_content" property="unitFillContent" jdbcType="VARCHAR"/>
|
<result column="material_status" property="materialStatus" jdbcType="TINYINT"/>
|
|
</resultMap>
|
|
|
<resultMap id="WorkApplyReportableDO" type="com.gkhy.safePlatform.specialWork.entity.WorkApplyReportableDO">
|
<result column="id" property="id" />
|
<result column="work_type" property="workType" />
|
<result column="work_level" property="workLevel" />
|
<result column="work_permit_no" property="workPermitNo" />
|
<result column="work_content" property="workContent" />
|
<result column="work_location" property="workLocation" />
|
<result column="exp_start_time" property="expStartTime" />
|
<result column="exp_end_time" property="expEndTime" />
|
<result column="hazard_identification" property="hazardIdentification" />
|
<result column="status" property="status" />
|
</resultMap>
|
|
<insert id="insertWorkApplyInfo"
|
parameterType="com.gkhy.safePlatform.specialWork.entity.WorkApplyInfo">
|
insert
|
into work_apply
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="id != null">
|
id,
|
</if>
|
<if test="depId != null">
|
dep_id,
|
</if>
|
<if test="applyUid != null">
|
apply_uid,
|
</if>
|
<if test="workType != null">
|
work_type,
|
</if>
|
<if test="workLevel != null">
|
work_level,
|
</if>
|
<if test="status != null">
|
status,
|
</if>
|
<if test="approvalStep != null">
|
approval_step,
|
</if>
|
<if test="applyTime != null">
|
apply_time,
|
</if>
|
<if test="expStartTime != null">
|
exp_start_time,
|
</if>
|
<if test="expEndTime != null">
|
exp_end_time,
|
</if>
|
<if test="gmtCreate != null">
|
gmt_create,
|
</if>
|
<if test="approvalStepId != null">
|
approval_step_id,
|
</if>
|
<if test="operatorUname != null">
|
operator_uname,
|
</if>
|
<if test="applyUname != null">
|
apply_uname,
|
</if>
|
<if test="depName != null">
|
dep_name,
|
</if>
|
<if test="operatorUid != null">
|
operator_uid,
|
</if>
|
<if test="workPermitNo != null">
|
work_permit_no,
|
</if>
|
<if test="workContent != null">
|
work_content,
|
</if>
|
<if test="workLocation != null">
|
work_location,
|
</if>
|
<if test="hazardIdentification != null">
|
hazard_identification,
|
</if>
|
<if test="workDetailId != null">
|
work_detail_id,
|
</if>
|
<if test="maBaseId != null">
|
ma_base_id,
|
</if>
|
<if test="materialStatus != null">
|
material_status,
|
</if>
|
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="id != null">
|
#{id},
|
</if>
|
<if test="depId != null">
|
#{depId},
|
</if>
|
<if test="applyUid != null">
|
#{applyUid},
|
</if>
|
<if test="workType != null">
|
#{workType},
|
</if>
|
<if test="workLevel != null">
|
#{workLevel},
|
</if>
|
<if test="status != null">
|
#{status},
|
</if>
|
<if test="approvalStep != null">
|
#{approvalStep},
|
</if>
|
<if test="applyTime != null">
|
#{applyTime},
|
</if>
|
<if test="expStartTime != null">
|
#{expStartTime},
|
</if>
|
<if test="expEndTime != null">
|
#{expEndTime},
|
</if>
|
<if test="gmtCreate != null">
|
#{gmtCreate},
|
</if>
|
<if test="approvalStepId != null">
|
#{approvalStepId},
|
</if>
|
<if test="operatorUname != null">
|
#{operatorUname},
|
</if>
|
<if test="applyUname != null">
|
#{applyUname},
|
</if>
|
<if test="depName != null">
|
#{depName},
|
</if>
|
<if test="operatorUid != null">
|
#{operatorUid},
|
</if>
|
<if test="workPermitNo != null">
|
#{workPermitNo},
|
</if>
|
<if test="workContent != null">
|
#{workContent},
|
</if>
|
<if test="workLocation != null">
|
#{workLocation},
|
</if>
|
<if test="hazardIdentification != null">
|
#{hazardIdentification},
|
</if>
|
<if test="workDetailId != null">
|
#{workDetailId},
|
</if>
|
<if test="maBaseId != null">
|
#{maBaseId},
|
</if>
|
<if test="materialStatus != null">
|
#{materialStatus},
|
</if>
|
</trim>
|
|
</insert>
|
<update id="updateStatusById">
|
update work_apply
|
set status = #{status}
|
where id = #{workApplyId}
|
|
</update>
|
<update id="updateApprovalStepIdById">
|
update work_apply
|
set approval_step_id = #{nextStepId}
|
where id = #{workApplyId}
|
|
</update>
|
|
<update id="updateApprovalStepIdToNull">
|
update work_apply
|
set approval_step_id = null
|
where id = #{workApplyId}
|
</update>
|
|
<select id="listWorkApplyInfoByPage"
|
parameterType="com.gkhy.safePlatform.specialWork.model.query.db.WorkApplyApplyingPageDBQuery"
|
resultMap="WorkApplyInfo">
|
select
|
workApply.id,
|
workApply.eid,
|
workApply.dep_id,
|
workApply.dep_name,
|
workApply.apply_uid,
|
workApply.apply_uname,
|
workApply.work_type,
|
workApply.work_level,
|
workApply.status,
|
workApply.approval_step,
|
workApply.approval_step_id,
|
workApply.apply_time,
|
workApply.exp_start_time,
|
workApply.exp_end_time,
|
workApply.gmt_create,
|
workApply.gmt_modified,
|
workApply.work_permit_no,
|
workApply.operator_uid,
|
workApply.operator_uname,
|
workApply.operator_certificate,
|
workApply.work_content,
|
workApply.work_location,
|
workApply.hazard_identification,
|
workApply.work_detail_id,
|
workApply.material_status
|
from work_apply as workApply
|
<where>
|
<if test="query.status != null">
|
and workApply.status = #{query.status}
|
</if>
|
<if test="query.workType != null">
|
and workApply.work_type = #{query.workType}
|
</if>
|
<if test="query.applyUid != null">
|
and workApply.apply_uid = #{query.applyUid}
|
</if>
|
</where>
|
order by workApply.gmt_create desc
|
|
|
|
</select>
|
<select id="listPendingWorkApplyInfo"
|
parameterType="com.gkhy.safePlatform.specialWork.model.query.db.WorkApplyPendingPageDBQuery"
|
resultMap="WorkApplyInfoBO">
|
select
|
workApply.id,
|
workApply.eid,
|
workApply.dep_id,
|
workApply.dep_name,
|
workApply.apply_uid,
|
workApply.apply_uname,
|
workApply.work_type,
|
workApply.work_level,
|
workApply.status,
|
workApply.approval_step,
|
workApply.approval_step_id,
|
workApply.apply_time,
|
workApply.exp_start_time,
|
workApply.exp_end_time,
|
workApply.gmt_create,
|
workApply.gmt_modified,
|
workApply.work_permit_no,
|
workApply.operator_uid,
|
workApply.operator_uname,
|
workApply.operator_certificate,
|
workApply.work_content,
|
workApply.work_location,
|
workApply.hazard_identification,
|
workApply.work_detail_id,
|
workApply.material_status,
|
ruleStep.id step_id,
|
ruleStep.type step_type,
|
ruleStep.approval_result step_approval_result,
|
ruleStep.step_serial step_serial,
|
ruleStep.start_approval_time step_start_approval_time,
|
ruleStep.finish_approval_time step_finish_approval_time,
|
ruleStep.exp_finish_approval_time step_exp_finish_approval_time,
|
ruleStep.pre_step_id,
|
ruleStep.next_step_id,
|
ruleStep.is_contain_item,
|
ruleUnit.id unit_id,
|
ruleUnit.approval_uid unit_approval_uid,
|
ruleUnit.approval_uname unit_approval_uname,
|
ruleUnit.result unit_result,
|
ruleUnit.approval_start_time unit_approval_start_time,
|
ruleUnit.approval_end_time unit_approval_end_time,
|
ruleUnit.approval_actual_time unit_approval_actual_time,
|
ruleUnit.fill_content unit_fill_content
|
from work_apply as workApply
|
inner join work_approval_step as ruleStep on ruleStep.id = workApply.approval_step_id
|
inner join work_approval_unit as ruleUnit on ruleUnit.step_id = ruleStep.id and ruleUnit.approval_uid = #{query.approvalUid}
|
<where>
|
status != 7
|
<if test="query.status != null">
|
and workApply.status = #{query.status}
|
</if>
|
<if test="query.workType != null">
|
and workApply.work_type = #{query.workType}
|
</if>
|
<if test="query.applyUname != null">
|
and workApply.apply_uname like concat("%",#{query.applyUname},"%")
|
</if>
|
</where>
|
order by workApply.gmt_create desc
|
|
|
|
</select>
|
<select id="getWorkApprovalByApprovalUid"
|
resultMap="WorkApplyInfo">
|
select
|
workApply.id,
|
workApply.eid,
|
workApply.dep_id,
|
workApply.dep_name,
|
workApply.apply_uid,
|
workApply.apply_uname,
|
workApply.work_type,
|
workApply.work_level,
|
workApply.status,
|
workApply.approval_step,
|
workApply.approval_step_id,
|
workApply.apply_time,
|
workApply.exp_start_time,
|
workApply.exp_end_time,
|
workApply.gmt_create,
|
workApply.gmt_modified,
|
workApply.work_permit_no,
|
workApply.operator_uid,
|
workApply.operator_uname,
|
workApply.operator_certificate,
|
workApply.work_content,
|
workApply.work_location,
|
workApply.hazard_identification,
|
workApply.material_status
|
from work_apply as workApply
|
inner join work_approval_step as ruleStep on ruleStep.id = workApply.approval_step_id
|
inner join work_approval_unit as ruleUnit on ruleUnit.step_id = ruleStep.id and ruleUnit.approval_uid = #{approvalUid}
|
where workApply.id = #{workApplyId}
|
|
</select>
|
<select id="countWorkApplyInfo" resultType="java.lang.Integer">
|
select count(0)
|
from work_apply
|
</select>
|
<select id="listReportableWorkApply"
|
resultMap="WorkApplyReportableDO">
|
select
|
workApply.id,
|
workApply.work_permit_no,
|
workApply.work_type,
|
workApply.work_level,
|
workApply.work_content,
|
workApply.work_location,
|
workApply.exp_start_time,
|
workApply.exp_end_time,
|
workApply.hazard_identification,
|
workApply.status
|
from work_apply as workApply
|
where workApply.status = #{query.status}
|
and workApply.exp_start_time < #{query.now}
|
and workApply.exp_end_time > #{query.now}
|
<if test="query.workPermitNo != null and query.workPermitNo != ''">
|
and workApply.work_permit_no like concat("%",#{query.workPermitNo},"%")
|
</if>
|
<if test="query.workType != null">
|
and workApply.work_type = #{query.workType}
|
</if>
|
</select>
|
<select id="listAllWorkApplyByPage"
|
resultMap="WorkApplyInfo">
|
select
|
workApply.id,
|
workApply.eid,
|
workApply.dep_id,
|
workApply.dep_name,
|
workApply.apply_uid,
|
workApply.apply_uname,
|
workApply.work_type,
|
workApply.work_level,
|
workApply.status,
|
workApply.approval_step,
|
workApply.approval_step_id,
|
workApply.apply_time,
|
workApply.exp_start_time,
|
workApply.exp_end_time,
|
workApply.gmt_create,
|
workApply.gmt_modified,
|
workApply.work_permit_no,
|
workApply.operator_uid,
|
workApply.operator_uname,
|
workApply.operator_certificate,
|
workApply.work_content,
|
workApply.work_location,
|
workApply.hazard_identification,
|
workApply.work_detail_id,
|
workApply.material_status
|
from work_apply as workApply
|
<where>
|
<if test="query.status != null">
|
and workApply.status = #{query.status}
|
</if>
|
<if test="query.workType != null">
|
and workApply.work_type = #{query.workType}
|
</if>
|
<if test="query.workLevel != null">
|
and workApply.work_level = #{query.workLevel}
|
</if>
|
<if test="query.applyDepId != null">
|
and workApply.dep_id = #{query.applyDepId}
|
</if>
|
<if test="query.applyStartTime != null">
|
and workApply.apply_time > #{query.applyStartTime}
|
</if>
|
<if test="query.applyEndTime != null">
|
and workApply.apply_time < #{query.applyEndTime}
|
</if>
|
</where>
|
order by workApply.gmt_create desc
|
|
</select>
|
<select id="getWorkApplyCountByDep" resultType="com.gkhy.safePlatform.specialWork.entity.WorkApplyCountDO">
|
select count(1) as count,dep_id,work_type from work_apply where DATE(gmt_create) = curdate() GROUP BY dep_id,work_type;
|
</select>
|
|
</mapper>
|