<?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.WorkInfoRepository" >
|
<resultMap id="WorkInfo" type="com.gkhy.safePlatform.specialWork.entity.WorkInfo" >
|
<id column="id" property="id" jdbcType="BIGINT" />
|
<result column="work_apply_id" property="workApplyId" jdbcType="BIGINT"/>
|
<result column="work_permit_no" property="workPermitNo" jdbcType="VARCHAR"/>
|
<result column="work_status" property="workStatus" jdbcType="TINYINT"/>
|
<result column="work_level" property="workLevel" jdbcType="TINYINT"/>
|
<result column="work_type" property="workType" jdbcType="TINYINT"/>
|
<result column="work_analysis_status" property="workAnalysisStatus" jdbcType="TINYINT"/>
|
<result column="work_accept_status" property="workAcceptStatus" jdbcType="TINYINT"/>
|
<result column="work_accept_content" property="workAcceptContent" jdbcType="VARCHAR"/>
|
<result column="work_accept_time" property="workAcceptTime" jdbcType="TIMESTAMP"/>
|
<result column="work_start_time" property="workStartTime" jdbcType="TIMESTAMP"/>
|
<result column="work_finish_time" property="workFinishTime" jdbcType="TIMESTAMP"/>
|
<result column="start_uname" property="startUname" jdbcType="VARCHAR"/>
|
<result column="start_uid" property="startUid" jdbcType="BIGINT"/>
|
<result column="finish_uname" property="finishUname" jdbcType="VARCHAR"/>
|
<result column="finish_uid" property="finishUid" jdbcType="BIGINT"/>
|
<result column="accept_uname" property="acceptUname" jdbcType="VARCHAR"/>
|
<result column="accept_uid" property="acceptUid" jdbcType="BIGINT"/>
|
<result column="dep_id" property="depId" jdbcType="BIGINT"/>
|
<result column="dep_name" property="depName" jdbcType="VARCHAR"/>
|
<result column="gmt_create" property="gmtCreate" jdbcType="TIMESTAMP"/>
|
<result column="abort_status" property="abortStatus" jdbcType="TINYINT"/>
|
<result column="abort_reason" property="abortReason" jdbcType="VARCHAR"/>
|
|
</resultMap>
|
|
<resultMap id="WorkInfoDO" type="com.gkhy.safePlatform.specialWork.entity.WorkInfoDO" >
|
<result column="id" property="workId" jdbcType="BIGINT" />
|
<result column="work_apply_id" property="workApplyId" jdbcType="BIGINT"/>
|
<result column="work_permit_no" property="workPermitNo" jdbcType="VARCHAR"/>
|
<result column="work_status" property="workStatus" jdbcType="TINYINT"/>
|
<result column="work_level" property="workLevel" jdbcType="TINYINT"/>
|
<result column="work_type" property="workType" jdbcType="TINYINT"/>
|
<result column="work_analysis_status" property="workAnalysisStatus" jdbcType="TINYINT"/>
|
<result column="work_accept_status" property="workAcceptStatus" jdbcType="TINYINT"/>
|
<result column="work_accept_content" property="workAcceptContent" jdbcType="VARCHAR"/>
|
<result column="work_accept_time" property="workAcceptTime" jdbcType="TIMESTAMP"/>
|
<result column="work_start_time" property="workStartTime" jdbcType="TIMESTAMP"/>
|
<result column="work_finish_time" property="workFinishTime" jdbcType="TIMESTAMP"/>
|
<result column="start_uname" property="startUname" jdbcType="VARCHAR"/>
|
<result column="start_uid" property="startUid" jdbcType="BIGINT"/>
|
<result column="finish_uname" property="finishUname" jdbcType="VARCHAR"/>
|
<result column="finish_uid" property="finishUid" jdbcType="BIGINT"/>
|
<result column="accept_uname" property="acceptUname" jdbcType="VARCHAR"/>
|
<result column="accept_uid" property="acceptUid" jdbcType="BIGINT"/>
|
<result column="dep_id" property="depId" jdbcType="BIGINT"/>
|
<result column="dep_name" property="depName" jdbcType="VARCHAR"/>
|
<result column="gmt_create" property="gmtCreate" jdbcType="TIMESTAMP"/>
|
<result column="abort_status" property="abortStatus" jdbcType="TINYINT"/>
|
<result column="abort_reason" property="abortReason" jdbcType="VARCHAR"/>
|
|
</resultMap>
|
<insert id="insertWorkInfo" parameterType="com.gkhy.safePlatform.specialWork.entity.WorkInfo">
|
insert
|
into work
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
id,
|
work_apply_id,
|
work_permit_no,
|
work_analysis_status,
|
work_status,
|
work_level,
|
work_type,
|
work_accept_status,
|
abort_status,
|
abort_reason,
|
work_accept_content,
|
work_accept_time,
|
work_start_time,
|
work_finish_time,
|
start_uname,
|
start_uid,
|
finish_uname,
|
finish_uid,
|
accept_uname,
|
accept_uid,
|
dep_id,
|
dep_name,
|
gmt_create,
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides="," >
|
#{id},
|
#{workApplyId},
|
#{workPermitNo},
|
#{workAnalysisStatus},
|
#{workStatus},
|
#{workLevel},
|
#{workType},
|
#{workAcceptStatus},
|
#{abortStatus},
|
#{abortReason},
|
#{workAcceptContent},
|
#{workAcceptTime},
|
#{workStartTime},
|
#{workFinishTime},
|
#{startUname},
|
#{startUid},
|
#{finishUname},
|
#{finishUid},
|
#{acceptUname},
|
#{acceptUid},
|
#{depId},
|
#{depName},
|
#{gmtCreate},
|
</trim>
|
|
|
</insert>
|
<update id="updateWorkInfoById"
|
parameterType="com.gkhy.safePlatform.specialWork.entity.WorkInfo">
|
update
|
work
|
<set>
|
<if test="workStatus != null">
|
work_status = #{workStatus},
|
</if>
|
<if test="workAcceptStatus != null">
|
work_accept_status = #{workAcceptStatus},
|
</if>
|
<if test="workAnalysisStatus != null">
|
work_analysis_status = #{workAnalysisStatus},
|
</if>
|
<if test="workAcceptContent != null">
|
work_accept_content = #{workAcceptContent},
|
</if>
|
<if test="workAcceptTime != null">
|
work_accept_time = #{workAcceptTime},
|
</if>
|
<if test="workStartTime != null">
|
work_start_time = #{workStartTime},
|
</if>
|
<if test="workFinishTime != null">
|
work_finish_time = #{workFinishTime},
|
</if>
|
<if test="startUname != null">
|
start_uname = #{startUname},
|
</if>
|
<if test="finishUname != null">
|
finish_uname = #{finishUname},
|
</if>
|
<if test="startUid != null">
|
start_uid = #{startUid},
|
</if>
|
<if test="finishUid != null">
|
finish_uid = #{finishUid},
|
</if>
|
<if test="acceptUname != null">
|
accept_uname = #{acceptUname},
|
</if>
|
<if test="acceptUid != null">
|
accept_uid = #{acceptUid},
|
</if>
|
<if test="abortStatus != null">
|
abort_status = #{abortStatus},
|
</if>
|
<if test="abortReason != null">
|
abort_reason = #{abortReason},
|
</if>
|
</set>
|
where id = #{id}
|
|
</update>
|
<update id="updateWorkStatusByWorkId">
|
update work
|
set work_status = #{workStatus}
|
where id = #{workId}
|
|
|
</update>
|
<update id="updateWorkAnalysisStatusByWorkId">
|
update work
|
set work_analysis_status = #{workAnalysisStatus}
|
where id = #{workId}
|
|
</update>
|
<update id="updateWorkStatusAndAbortStatusByWorkId">
|
|
update work
|
set work_status = #{workStatus},
|
abort_status = #{abortStatus}
|
where id = #{workId}
|
|
|
</update>
|
<select id="listWorkInfoDOByPage" resultMap="WorkInfoDO">
|
select
|
id,
|
work_apply_id,
|
work_permit_no,
|
work_analysis_status,
|
work_status,
|
work_level,
|
work_type,
|
work_accept_status,
|
abort_status,
|
abort_reason,
|
work_accept_content,
|
work_accept_time,
|
work_start_time,
|
work_finish_time,
|
start_uname,
|
start_uid,
|
finish_uname,
|
finish_uid,
|
accept_uname,
|
accept_uid,
|
dep_id,
|
dep_name,
|
gmt_create
|
from work
|
<where>
|
<if test="query.workAnalysisStatus != null">
|
and work_analysis_status = #{query.workAnalysisStatus}
|
</if>
|
<if test="query.workStatus != null">
|
and work_status = #{query.workStatus}
|
</if>
|
<if test="query.acceptStatus != null">
|
and work_accept_status = #{query.acceptStatus}
|
</if>
|
<if test="query.startTime != null">
|
and work_start_time >= #{query.startTime}
|
</if>
|
<if test="query.endTime != null">
|
and work_start_time <= #{query.endTime}
|
</if>
|
<if test="query.workPermitNo != null and query.workPermitNo != ''">
|
and work_permit_no like concat("%",#{query.workPermitNo},"%")
|
</if>
|
<if test="query.depId != null">
|
and dep_id = #{query.depId}
|
</if>
|
<if test="query.workDepId != null">
|
and dep_id = #{query.workDepId}
|
</if>
|
<if test="query.workType != null">
|
and work_type = #{query.workType}
|
</if>
|
<if test="query.workLevel != null">
|
and work_level = #{query.workLevel}
|
</if>
|
</where>
|
order by gmt_create desc
|
|
|
</select>
|
<select id="listWorkInfoDOMyRefByPage" resultMap="WorkInfoDO">
|
select
|
workInfo.id,
|
workInfo.work_apply_id,
|
workInfo.work_permit_no,
|
workInfo.work_analysis_status,
|
workInfo.work_status,
|
workInfo.work_level,
|
workInfo.work_type,
|
workInfo.work_accept_status,
|
workInfo.abort_status,
|
workInfo.abort_reason,
|
workInfo.work_accept_content,
|
workInfo.work_accept_time,
|
workInfo.work_start_time,
|
workInfo.work_finish_time,
|
workInfo.start_uname,
|
workInfo.start_uid,
|
workInfo.finish_uname,
|
workInfo.finish_uid,
|
workInfo.accept_uname,
|
workInfo.accept_uid,
|
workInfo.dep_id,
|
workInfo.dep_name,
|
workInfo.gmt_create
|
from work as workInfo
|
inner join work_apply_operator as operator on operator.work_apply_id = workInfo.work_apply_id and operator_uid = #{query.currentUid}
|
<where>
|
<if test="query.workAnalysisStatus != null">
|
and workInfo.work_analysis_status = #{query.workAnalysisStatus}
|
</if>
|
<if test="query.workStatus != null">
|
and workInfo.work_status = #{query.workStatus}
|
</if>
|
<if test="query.acceptStatus != null">
|
and workInfo.work_accept_status = #{query.acceptStatus}
|
</if>
|
<if test="query.startTime != null">
|
and workInfo.work_start_time >= #{query.startTime}
|
</if>
|
<if test="query.endTime != null">
|
and workInfo.work_start_time <= #{query.endTime}
|
</if>
|
<if test="query.workPermitNo != null and query.workPermitNo != ''">
|
and workInfo.work_permit_no like concat("%",#{query.workPermitNo},"%")
|
</if>
|
|
</where>
|
order by workInfo.gmt_create desc
|
|
</select>
|
<select id="countWorkInfoMyRef" resultType="java.lang.Long">
|
select
|
count(*)
|
from work as workInfo
|
inner join work_apply_operator as operator on operator.work_apply_id = workInfo.work_apply_id and operator_uid = #{query.currentUid}
|
<where>
|
<if test="query.workAnalysisStatus != null">
|
and workInfo.work_analysis_status = #{query.workAnalysisStatus}
|
</if>
|
<if test="query.workStatus != null">
|
and workInfo.work_status = #{query.workStatus}
|
</if>
|
<if test="query.acceptStatus != null">
|
and workInfo.work_accept_status = #{query.acceptStatus}
|
</if>
|
<if test="query.startTime != null">
|
and workInfo.work_start_time >= #{query.startTime}
|
</if>
|
<if test="query.endTime != null">
|
and workInfo.work_start_time <= #{query.endTime}
|
</if>
|
<if test="query.workPermitNo != null and query.workPermitNo != ''">
|
and workInfo.work_permit_no like concat("%",#{query.workPermitNo},"%")
|
</if>
|
|
</where>
|
</select>
|
<select id="countWorkInfo" resultType="java.lang.Long">
|
select
|
count(*)
|
from work
|
<where>
|
<if test="query.workAnalysisStatus != null">
|
and work_analysis_status = #{query.workAnalysisStatus}
|
</if>
|
<if test="query.workStatus != null">
|
and work_status = #{query.workStatus}
|
</if>
|
<if test="query.acceptStatus != null">
|
and work_accept_status = #{query.acceptStatus}
|
</if>
|
<if test="query.startTime != null">
|
and work_start_time >= #{query.startTime}
|
</if>
|
<if test="query.endTime != null">
|
and work_start_time <= #{query.endTime}
|
</if>
|
<if test="query.workPermitNo != null and query.workPermitNo != ''">
|
and work_permit_no like concat("%",#{query.workPermitNo},"%")
|
</if>
|
<if test="query.depId != null">
|
and dep_id = #{query.depId}
|
</if>
|
<if test="query.workDepId != null">
|
and dep_id = #{query.workDepId}
|
</if>
|
<if test="query.workType != null">
|
and work_type = #{query.workType}
|
</if>
|
<if test="query.workLevel != null">
|
and work_level = #{query.workLevel}
|
</if>
|
</where>
|
|
</select>
|
<select id="listWorkInfoGuardianByPage" resultMap="WorkInfoDO">
|
select
|
workInfo.id,
|
workInfo.work_apply_id,
|
workInfo.work_permit_no,
|
workInfo.work_analysis_status,
|
workInfo.work_status,
|
workInfo.work_level,
|
workInfo.work_type,
|
workInfo.work_accept_status,
|
workInfo.abort_status,
|
workInfo.abort_reason,
|
workInfo.work_accept_content,
|
workInfo.work_accept_time,
|
workInfo.work_start_time,
|
workInfo.work_finish_time,
|
workInfo.start_uname,
|
workInfo.start_uid,
|
workInfo.finish_uname,
|
workInfo.finish_uid,
|
workInfo.accept_uname,
|
workInfo.accept_uid,
|
workInfo.dep_id,
|
workInfo.dep_name,
|
workInfo.gmt_create
|
from work as workInfo
|
<!-- 监护人 person_type = 2 -->
|
inner join work_approval_step as step on step.work_apply_id = workInfo.work_apply_id and step.person_type = 2
|
inner join work_approval_unit as unit on step.id = unit.step_id and unit.approval_uid = #{query.currentUid}
|
<where>
|
<if test="query.workAnalysisStatus != null">
|
and workInfo.work_analysis_status = #{query.workAnalysisStatus}
|
</if>
|
<if test="query.workStatus != null">
|
and workInfo.work_status = #{query.workStatus}
|
</if>
|
<if test="query.acceptStatus != null">
|
and workInfo.work_accept_status = #{query.acceptStatus}
|
</if>
|
<if test="query.startTime != null">
|
and workInfo.work_start_time >= #{query.startTime}
|
</if>
|
<if test="query.endTime != null">
|
and workInfo.work_start_time <= #{query.endTime}
|
</if>
|
<if test="query.workPermitNo != null and query.workPermitNo != ''">
|
and workInfo.work_permit_no like concat("%",#{query.workPermitNo},"%")
|
</if>
|
</where>
|
|
order by workInfo.gmt_create desc
|
|
</select>
|
<select id="listWorkInfoAcceptByPage" resultMap="WorkInfoDO">
|
select
|
workInfo.id,
|
workInfo.work_apply_id,
|
workInfo.work_permit_no,
|
workInfo.work_analysis_status,
|
workInfo.work_status,
|
workInfo.work_level,
|
workInfo.work_type,
|
workInfo.work_accept_status,
|
workInfo.abort_status,
|
workInfo.abort_reason,
|
workInfo.work_accept_content,
|
workInfo.work_accept_time,
|
workInfo.work_start_time,
|
workInfo.work_finish_time,
|
workInfo.start_uname,
|
workInfo.start_uid,
|
workInfo.finish_uname,
|
workInfo.finish_uid,
|
workInfo.accept_uname,
|
workInfo.accept_uid,
|
workInfo.dep_id,
|
workInfo.dep_name,
|
workInfo.gmt_create
|
from work as workInfo
|
inner join work_apply as apply on apply.id = workInfo.work_apply_id on apply.dep_id = #{query.currentDepId}
|
<where>
|
<if test="query.workAnalysisStatus != null">
|
and workInfo.work_analysis_status = #{query.workAnalysisStatus}
|
</if>
|
<if test="query.workStatus != null">
|
and workInfo.work_status = #{query.workStatus}
|
</if>
|
<if test="query.acceptStatus != null">
|
and workInfo.work_accept_status = #{query.acceptStatus}
|
</if>
|
<if test="query.startTime != null">
|
and workInfo.work_start_time >= #{query.startTime}
|
</if>
|
<if test="query.endTime != null">
|
and workInfo.work_start_time <= #{query.endTime}
|
</if>
|
<if test="query.workPermitNo != null and query.workPermitNo != ''">
|
and workInfo.work_permit_no like concat("%",#{query.workPermitNo},"%")
|
</if>
|
</where>
|
order by workInfo.gmt_create desc
|
</select>
|
<select id="listWorkInfoAnalysisByPage" resultMap="WorkInfoDO">
|
select
|
workInfo.id,
|
workInfo.work_apply_id,
|
workInfo.work_permit_no,
|
workInfo.work_analysis_status,
|
workInfo.work_status,
|
workInfo.work_level,
|
workInfo.work_type,
|
workInfo.work_accept_status,
|
workInfo.abort_status,
|
workInfo.abort_reason,
|
workInfo.work_accept_content,
|
workInfo.work_accept_time,
|
workInfo.work_start_time,
|
workInfo.work_finish_time,
|
workInfo.start_uname,
|
workInfo.start_uid,
|
workInfo.finish_uname,
|
workInfo.finish_uid,
|
workInfo.accept_uname,
|
workInfo.accept_uid,
|
workInfo.dep_id,
|
workInfo.dep_name,
|
workInfo.gmt_create
|
from work as workInfo
|
<!-- 分析人 person_type = 3 -->
|
inner join work_approval_step as step on step.work_apply_id = workInfo.work_apply_id and step.person_type = 3
|
inner join work_approval_unit as unit on step.id = unit.step_id and unit.approval_uid = #{query.currentUid}
|
<where>
|
<if test="query.workAnalysisStatus != null">
|
and workInfo.work_analysis_status = #{query.workAnalysisStatus}
|
</if>
|
<if test="query.workStatus != null">
|
and workInfo.work_status = #{query.workStatus}
|
</if>
|
<if test="query.acceptStatus != null">
|
and workInfo.work_accept_status = #{query.acceptStatus}
|
</if>
|
<if test="query.startTime != null">
|
and workInfo.work_start_time >= #{query.startTime}
|
</if>
|
<if test="query.endTime != null">
|
and workInfo.work_start_time <= #{query.endTime}
|
</if>
|
<if test="query.workPermitNo != null and query.workPermitNo != ''">
|
and workInfo.work_permit_no like concat("%",#{query.workPermitNo},"%")
|
</if>
|
</where>
|
order by workInfo.gmt_create desc
|
|
</select>
|
|
<select id="countByOptions" resultType="java.lang.Integer">
|
select count(a.id) from work_apply a
|
<where>
|
<if test="type != null">
|
and a.work_type = #{type} and a.status = 7
|
</if>
|
<if test="depIdList != null">
|
and a.dep_id in
|
<foreach collection="depIdList" item="depiid" open="(" close=")" separator="," index="index">
|
#{depiid}
|
</foreach>
|
</if>
|
<if test="startTime != null">
|
and a.exp_start_time >= #{startTime}
|
</if>
|
<if test="endTime != null">
|
and a.exp_start_time <= #{endTime}
|
</if>
|
</where>
|
</select>
|
|
<select id="countAllWorkByDep" resultType="java.lang.Integer">
|
select count(a.id) from work_apply a
|
<where>
|
<if test="depId != null">
|
and a.dep_id = #{depId} and a.status = 7
|
</if>
|
<if test="startTime != null">
|
and a.exp_start_time >= #{startTime}
|
</if>
|
<if test="endTime != null">
|
and a.exp_start_time <= #{endTime}
|
</if>
|
</where>
|
</select>
|
|
|
</mapper>
|