<?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.SpecialWorkAppointmentInfoRepository">
|
|
<resultMap type="com.gkhy.safePlatform.specialWork.entity.SpecialWorkAppointmentInfo" id="SpecialWorkAppointmentMap">
|
<result property="id" column="id" jdbcType="INTEGER"/>
|
<result property="applyDepId" column="apply_dep_id" jdbcType="INTEGER"/>
|
<result property="applyDepName" column="apply_dep_name" jdbcType="VARCHAR"/>
|
<result property="appointmentTime" column="appointment_time" jdbcType="TIMESTAMP"/>
|
<result property="status" column="status" jdbcType="TINYINT"/>
|
<result property="hotWork" column="hot_work" jdbcType="INTEGER"/>
|
<result property="groundBreakingOper" column="ground_breaking_oper" jdbcType="INTEGER"/>
|
<result property="blindPlatePluggingOper" column="blind_plate_plugging_oper" jdbcType="INTEGER"/>
|
<result property="temporaryPowerOper" column="temporary_power_oper" jdbcType="INTEGER"/>
|
<result property="workAtHeight" column="work_at_height" jdbcType="INTEGER"/>
|
<result property="openCircuitOper" column="open_circuit_oper" jdbcType="INTEGER"/>
|
<result property="liftingOper" column="lifting_oper" jdbcType="INTEGER"/>
|
<result property="confinedSpaceOper" column="confined_space_oper" jdbcType="INTEGER"/>
|
<result property="createUid" column="create_uid" jdbcType="INTEGER"/>
|
<result property="gmtCreate" column="gmt_create" jdbcType="TIMESTAMP"/>
|
<result property="gmtModified" column="gmt_modified" jdbcType="TIMESTAMP"/>
|
<result property="createUname" column="create_uname" jdbcType="VARCHAR"/>
|
<result property="modifiedUname" column="modified_uname" jdbcType="VARCHAR"/>
|
<result property="modifiedUid" column="modified_uid" jdbcType="INTEGER"/>
|
</resultMap>
|
|
<!--查询单个-->
|
<select id="queryById" resultMap="SpecialWorkAppointmentMap">
|
select
|
id, apply_dep_id, apply_dep_name, appointment_time, status, hot_work, ground_breaking_oper, blind_plate_plugging_oper, temporary_power_oper, work_at_height, open_circuit_oper, lifting_oper, confined_space_oper, create_uid, gmt_create, gmt_modified, create_uname, modified_uname, modified_uid
|
from special_work_appointment
|
where id = #{id} and status = #{status}
|
</select>
|
|
<!--查询数据-->
|
<select id="listByConditions" resultMap="SpecialWorkAppointmentMap">
|
select
|
id, apply_dep_id, apply_dep_name, appointment_time, status, hot_work, ground_breaking_oper, blind_plate_plugging_oper, temporary_power_oper, work_at_height, open_circuit_oper, lifting_oper, confined_space_oper, create_uid, gmt_create, gmt_modified, create_uname, modified_uname, modified_uid
|
from special_work_appointment
|
<where>
|
|
<if test="query.applyDepId != null">
|
and apply_dep_id = #{query.applyDepId}
|
</if>
|
<if test="query.appointmentTime != null">
|
and appointment_time = #{query.appointmentTime}
|
</if>
|
<if test="query.startTime != null">
|
and appointment_time >= #{query.startTime}
|
</if>
|
<if test="query.endTime != null">
|
and appointment_time <= #{query.endTime}
|
</if>
|
<if test="query.status != null">
|
and status = #{query.status}
|
</if>
|
</where>
|
ORDER BY gmt_create DESC
|
</select>
|
|
<!--统计总行数-->
|
<select id="count" resultType="java.lang.Long">
|
select count(1)
|
from special_work_appointment
|
<where>
|
<if test="id != null">
|
and id = #{id}
|
</if>
|
<if test="applyDepId != null">
|
and apply_dep_id = #{applyDepId}
|
</if>
|
<if test="applyDepName != null and applyDepName != ''">
|
and apply_dep_name = #{applyDepName}
|
</if>
|
<if test="appointmentTime != null">
|
and appointment_time = #{appointmentTime}
|
</if>
|
<if test="status != null">
|
and status = #{status}
|
</if>
|
<if test="hotWork != null">
|
and hot_work = #{hotWork}
|
</if>
|
<if test="groundBreakingOper != null">
|
and ground_breaking_oper = #{groundBreakingOper}
|
</if>
|
<if test="blindPlatePluggingOper != null">
|
and blind_plate_plugging_oper = #{blindPlatePluggingOper}
|
</if>
|
<if test="temporaryPowerOper != null">
|
and temporary_power_oper = #{temporaryPowerOper}
|
</if>
|
<if test="workAtHeight != null">
|
and work_at_height = #{workAtHeight}
|
</if>
|
<if test="openCircuitOper != null">
|
and open_circuit_oper = #{openCircuitOper}
|
</if>
|
<if test="liftingOper != null">
|
and lifting_oper = #{liftingOper}
|
</if>
|
<if test="confinedSpaceOper != null">
|
and confined_space_oper = #{confinedSpaceOper}
|
</if>
|
<if test="createUid != null">
|
and create_uid = #{createUid}
|
</if>
|
<if test="gmtCreate != null">
|
and gmt_create = #{gmtCreate}
|
</if>
|
<if test="gmtModified != null">
|
and gmt_modified = #{gmtModified}
|
</if>
|
<if test="createUname != null and createUname != ''">
|
and create_uname = #{createUname}
|
</if>
|
<if test="modifiedUname != null and modifiedUname != ''">
|
and modified_uname = #{modifiedUname}
|
</if>
|
<if test="modifiedUid != null">
|
and modified_uid = #{modifiedUid}
|
</if>
|
</where>
|
</select>
|
|
<!--新增所有列-->
|
<insert id="saveOne" >
|
insert into special_work_appointment(apply_dep_id, apply_dep_name, appointment_time, status, hot_work, ground_breaking_oper, blind_plate_plugging_oper, temporary_power_oper, work_at_height, open_circuit_oper, lifting_oper, confined_space_oper, create_uid, gmt_create, gmt_modified, create_uname, modified_uname, modified_uid)
|
values (#{applyDepId}, #{applyDepName}, #{appointmentTime}, #{status}, #{hotWork}, #{groundBreakingOper}, #{blindPlatePluggingOper}, #{temporaryPowerOper}, #{workAtHeight}, #{openCircuitOper}, #{liftingOper}, #{confinedSpaceOper}, #{createUid}, #{gmtCreate}, #{gmtModified}, #{createUname}, #{modifiedUname}, #{modifiedUid})
|
</insert>
|
|
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
|
insert into special_work_appointment(apply_dep_id, apply_dep_name, appointment_time, status, hot_work, ground_breaking_oper, blind_plate_plugging_oper, temporary_power_oper, work_at_height, open_circuit_oper, lifting_oper, confined_space_oper, create_uid, gmt_create, gmt_modified, create_uname, modified_uname, modified_uid)
|
values
|
<foreach collection="entities" item="entity" separator=",">
|
(#{entity.applyDepId}, #{entity.applyDepName}, #{entity.appointmentTime}, #{entity.status}, #{entity.hotWork}, #{entity.groundBreakingOper}, #{entity.blindPlatePluggingOper}, #{entity.temporaryPowerOper}, #{entity.workAtHeight}, #{entity.openCircuitOper}, #{entity.liftingOper}, #{entity.confinedSpaceOper}, #{entity.createUid}, #{entity.gmtCreate}, #{entity.gmtModified}, #{entity.createUname}, #{entity.modifiedUname}, #{entity.modifiedUid})
|
</foreach>
|
</insert>
|
|
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
|
insert into special_work_appointment(apply_dep_id, apply_dep_name, appointment_time, status, hot_work, ground_breaking_oper, blind_plate_plugging_oper, temporary_power_oper, work_at_height, open_circuit_oper, lifting_oper, confined_space_oper, create_uid, gmt_create, gmt_modified, create_uname, modified_uname, modified_uid)
|
values
|
<foreach collection="entities" item="entity" separator=",">
|
(#{entity.applyDepId}, #{entity.applyDepName}, #{entity.appointmentTime}, #{entity.status}, #{entity.hotWork}, #{entity.groundBreakingOper}, #{entity.blindPlatePluggingOper}, #{entity.temporaryPowerOper}, #{entity.workAtHeight}, #{entity.openCircuitOper}, #{entity.liftingOper}, #{entity.confinedSpaceOper}, #{entity.createUid}, #{entity.gmtCreate}, #{entity.gmtModified}, #{entity.createUname}, #{entity.modifiedUname}, #{entity.modifiedUid})
|
</foreach>
|
on duplicate key update
|
apply_dep_id = values(apply_dep_id),
|
apply_dep_name = values(apply_dep_name),
|
appointment_time = values(appointment_time),
|
status = values(status),
|
hot_work = values(hot_work),
|
ground_breaking_oper = values(ground_breaking_oper),
|
blind_plate_plugging_oper = values(blind_plate_plugging_oper),
|
temporary_power_oper = values(temporary_power_oper),
|
work_at_height = values(work_at_height),
|
open_circuit_oper = values(open_circuit_oper),
|
lifting_oper = values(lifting_oper),
|
confined_space_oper = values(confined_space_oper),
|
create_uid = values(create_uid),
|
gmt_create = values(gmt_create),
|
gmt_modified = values(gmt_modified),
|
create_uname = values(create_uname),
|
modified_uname = values(modified_uname),
|
modified_uid = values(modified_uid)
|
</insert>
|
|
<!--通过主键修改数据-->
|
<update id="updateOne">
|
update special_work_appointment
|
<set>
|
<if test="applyDepId != null">
|
apply_dep_id = #{applyDepId},
|
</if>
|
<if test="applyDepName != null and applyDepName != ''">
|
apply_dep_name = #{applyDepName},
|
</if>
|
<if test="appointmentTime != null">
|
appointment_time = #{appointmentTime},
|
</if>
|
<if test="status != null">
|
status = #{status},
|
</if>
|
<if test="hotWork != null">
|
hot_work = #{hotWork},
|
</if>
|
<if test="groundBreakingOper != null">
|
ground_breaking_oper = #{groundBreakingOper},
|
</if>
|
<if test="blindPlatePluggingOper != null">
|
blind_plate_plugging_oper = #{blindPlatePluggingOper},
|
</if>
|
<if test="temporaryPowerOper != null">
|
temporary_power_oper = #{temporaryPowerOper},
|
</if>
|
<if test="workAtHeight != null">
|
work_at_height = #{workAtHeight},
|
</if>
|
<if test="openCircuitOper != null">
|
open_circuit_oper = #{openCircuitOper},
|
</if>
|
<if test="liftingOper != null">
|
lifting_oper = #{liftingOper},
|
</if>
|
<if test="confinedSpaceOper != null">
|
confined_space_oper = #{confinedSpaceOper},
|
</if>
|
<if test="createUid != null">
|
create_uid = #{createUid},
|
</if>
|
<if test="gmtCreate != null">
|
gmt_create = #{gmtCreate},
|
</if>
|
<if test="gmtModified != null">
|
gmt_modified = #{gmtModified},
|
</if>
|
<if test="createUname != null and createUname != ''">
|
create_uname = #{createUname},
|
</if>
|
<if test="modifiedUname != null and modifiedUname != ''">
|
modified_uname = #{modifiedUname},
|
</if>
|
<if test="modifiedUid != null">
|
modified_uid = #{modifiedUid},
|
</if>
|
</set>
|
where id = #{id}
|
</update>
|
|
<!--通过主键逻辑删除-->
|
<update id="updateStatus">
|
update special_work_appointment set status = #{status} where id = #{id}
|
</update>
|
<!--批量删除-->
|
<update id="updateStatusByIds">
|
update special_work_appointment set status = #{status} where id in
|
<foreach collection="idList" item="id" open="(" close=")" separator=",">
|
#{id}
|
</foreach>
|
</update>
|
<!--统计每个部门各个作业预约情况-->
|
<select id="statisticsAppointment" resultType="com.gkhy.safePlatform.specialWork.model.bo.WorkStatisticsBO">
|
SELECT apply_dep_id,
|
SUM(work_at_height) as heightCount,
|
SUM(hot_work)as hotCount,
|
SUM(ground_breaking_oper) as groundBreakingCount,
|
SUM(blind_plate_plugging_oper) as blindPlatePluggingCount,
|
SUM(temporary_power_oper) as temporaryPowerCount,
|
SUM(open_circuit_oper) as openCircuitCout,
|
SUM(lifting_oper) as liftingCount,
|
SUM(confined_space_oper) as confinedSpaceCount,
|
SUM( work_at_height + hot_work + temporary_power_oper + open_circuit_oper + lifting_oper + confined_space_oper + blind_plate_plugging_oper + ground_breaking_oper ) as totalCount
|
FROM `special_work_appointment`
|
<where>
|
<if test="query.startTime != null">
|
and appointment_time >= #{query.startTime}
|
</if>
|
<if test="query.endTime != null">
|
and appointment_time <= #{query.endTime}
|
</if>
|
<if test="query.status != null">
|
and status = #{query.status}
|
</if>
|
</where>
|
GROUP BY apply_dep_id
|
ORDER BY totalCount DESC
|
</select>
|
</mapper>
|