bns_jjsp_service/securityControl-modules/securityControl-decision/target/classes/mapper/TDailyPlanDao.xml

291 lines
13 KiB
XML
Raw Normal View History

2025-01-16 18:13:22 +08:00
<?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.decision.mapper.TDailyPlanMapper">
<resultMap type="com.sercurityControl.decision.domain.TDailyPlan" id="TDailyPlanMap">
<result column="id" property="id"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="bid_id" property="bidId"/>
<result column="bid_name" property="bidName"/>
<result column="build_org_no" property="buildOrgNo"/>
<result column="build_org_name" property="buildOrgName"/>
<result column="gcxz" property="gcxz"/>
<result column="xmjl" property="xmjl"/>
<result column="xmjl_lxfs" property="xmjlLxfs"/>
<result column="work_state" property="workState"/>
<result column="no_work_yy" property="noWorkYy"/>
<result column="job_num" property="jobNum"/>
<result column="zypfzr" property="zypfzr"/>
<result column="aqjhr" property="aqjhr"/>
<result column="tzzyry" property="tzzyry"/>
<result column="ybzyry" property="ybzyry"/>
<result column="work_time" property="workTime"/>
<result column="zybw" property="zybw"/>
<result column="zylx" property="zylx"/>
<result column="zygx" property="zygx"/>
<result column="zynr" property="zynr"/>
<result column="fxdj" property="fxdj"/>
<result column="fxbh" property="fxbh"/>
<result column="dqztsgjd" property="dqztsgjd"/>
<result column="bzmc" property="bzmc"/>
<result column="bzz_name" property="bzzName"/>
<result column="bzz_id_card" property="bzzIdCard"/>
<result column="bzz_bak_ic" property="bzzBakIc"/>
<result column="bzz_lxfs" property="bzzLxfs"/>
<result column="bzaqy" property="bzaqy"/>
<result column="bzzjy" property="bzzjy"/>
<result column="remark" property="remark"/>
<result column="state" property="state"/>
<result column="tmp_state" property="tmpState"/>
<result column="bh_comment" property="bhComment"/>
<result column="people_type" property="peopleType"/>
<result column="bh_people_name" property="bhPeopleName"/>
</resultMap>
<sql id="SelectBaseMap">
SELECT id,
create_time,
update_time,
bid_id,
bid_name,
build_org_no,
build_org_name,
gcxz,
xmjl,
xmjl_lxfs,
work_state,
no_work_yy,
job_num,
zypfzr,
aqjhr,
tzzyry,
ybzyry,
work_time,
zybw,
zylx,
zygx,
zynr,
fxdj,
fxbh,
dqztsgjd,
bzmc,
bzz_name,
bzz_id_card,
bzz_bak_ic,
bzz_lxfs,
bzaqy,
bzzjy,
remark,
state,
tmp_state,
bh_comment,
people_type,
bh_people_name
FROM t_daily_plan
</sql>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
INSERT INTO t_daily_plan(
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="bidId != null and bidId != ''">bid_id,</if>
<if test="bidName != null and bidName != ''">bid_name,</if>
<if test="buildOrgNo != null and buildOrgNo != ''">build_org_no,</if>
<if test="buildOrgName != null and buildOrgName != ''">build_org_name,</if>
<if test="gcxz != null and gcxz != ''">gcxz,</if>
<if test="xmjl != null and xmjl != ''">xmjl,</if>
<if test="xmjlLxfs != null and xmjlLxfs != ''">xmjl_lxfs,</if>
<if test="workState != null">work_state,</if>
<if test="noWorkYy != null and noWorkYy != ''">no_work_yy,</if>
<if test="jobNum != null and jobNum != ''">job_num,</if>
<if test="zypfzr != null and zypfzr != ''">zypfzr,</if>
<if test="aqjhr != null and aqjhr != ''">aqjhr,</if>
<if test="tzzyry != null and tzzyry != ''">tzzyry,</if>
<if test="ybzyry != null and ybzyry != ''">ybzyry,</if>
<if test="workTime != null and workTime != ''">work_time,</if>
<if test="zybw != null and zybw != ''">zybw,</if>
<if test="zylx != null and zylx != ''">zylx,</if>
<if test="zygx != null and zygx != ''">zygx,</if>
<if test="zynr != null and zynr != ''">zynr,</if>
<if test="fxdj != null and fxdj != ''">fxdj,</if>
<if test="fxbh != null and fxbh != ''">fxbh,</if>
<if test="dqztsgjd != null and dqztsgjd != ''">dqztsgjd,</if>
<if test="bzmc != null and bzmc != ''">bzmc,</if>
<if test="bzzName != null and bzzName != ''">bzz_name,</if>
<if test="bzzIdCard != null and bzzIdCard != ''">bzz_id_card,</if>
<if test="bzzBakIc != null and bzzBakIc != ''">bzz_bak_ic,</if>
<if test="bzzLxfs != null and bzzLxfs != ''">bzz_lxfs,</if>
<if test="bzaqy != null and bzaqy != ''">bzaqy,</if>
<if test="bzzjy != null and bzzjy != ''">bzzjy,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="state != null">state,</if>
<if test="tmpState != null">tmp_state,</if>
<if test="bhComment != null and bhComment != ''">bh_comment,</if>
<if test="peopleType != null and peopleType != ''">people_type,</if>
<if test="bhPeopleName != null and bhPeopleName != ''">bh_people_name,</if>
create_time
)VALUES(
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="bidId != null and bidId != ''">#{bidId},</if>
<if test="bidName != null and bidName != ''">#{bidName},</if>
<if test="buildOrgNo != null and buildOrgNo != ''">#{buildOrgNo},</if>
<if test="buildOrgName != null and buildOrgName != ''">#{buildOrgName},</if>
<if test="gcxz != null and gcxz != ''">#{gcxz},</if>
<if test="xmjl != null and xmjl != ''">#{xmjl},</if>
<if test="xmjlLxfs != null and xmjlLxfs != ''">#{xmjlLxfs},</if>
<if test="workState != null">#{workState},</if>
<if test="noWorkYy != null and noWorkYy != ''">#{noWorkYy},</if>
<if test="jobNum != null and jobNum != ''">#{jobNum},</if>
<if test="zypfzr != null and zypfzr != ''">#{zypfzr},</if>
<if test="aqjhr != null and aqjhr != ''">#{aqjhr},</if>
<if test="tzzyry != null and tzzyry != ''">#{tzzyry},</if>
<if test="ybzyry != null and ybzyry != ''">#{ybzyry},</if>
<if test="workTime != null and workTime != ''">#{workTime},</if>
<if test="zybw != null and zybw != ''">#{zybw},</if>
<if test="zylx != null and zylx != ''">#{zylx},</if>
<if test="zygx != null and zygx != ''">#{zygx},</if>
<if test="zynr != null and zynr != ''">#{zynr},</if>
<if test="fxdj != null and fxdj != ''">#{fxdj},</if>
<if test="fxbh != null and fxbh != ''">#{fxbh},</if>
<if test="dqztsgjd != null and dqztsgjd != ''">#{dqztsgjd},</if>
<if test="bzmc != null and bzmc != ''">#{bzmc},</if>
<if test="bzzName != null and bzzName != ''">#{bzzName},</if>
<if test="bzzIdCard != null and bzzIdCard != ''">#{bzzIdCard},</if>
<if test="bzzBakIc != null and bzzBakIc != ''">#{bzzBakIc},</if>
<if test="bzzLxfs != null and bzzLxfs != ''">#{bzzLxfs},</if>
<if test="bzaqy != null and bzaqy != ''">#{bzaqy},</if>
<if test="bzzjy != null and bzzjy != ''">#{bzzjy},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="state != null">#{state},</if>
<if test="tmpState != null">#{tmpState},</if>
<if test="bhComment != null and bhComment != ''">#{bhComment},</if>
<if test="peopleType != null and peopleType != ''">#{peopleType},</if>
<if test="bhPeopleName != null and bhPeopleName != ''">#{bhPeopleName},</if>
sysdate())
</insert>
<!--通过主键删除-->
<delete id="deleteById">
DELETE
FROM t_daily_plan
WHERE id = #{id}
</delete>
<!-- 未报计划班组列表 -->
<select id="queryNoPlanPage" resultType="com.sercurityControl.decision.domain.vo.NoWorkNoticeVo">
SELECT CASE WHEN b.id IS NULL THEN 0 ELSE 1 END AS plan,
a.team_name teamName,
a.phone,
IFNULL(b.work_time, a.update_day) AS workDate,
a.fzr_name teamLeaderName,
c.build_unit buildUnit,
c.bid_name projectName
FROM t_work_team a
LEFT JOIN (SELECT id, bzz_bak_ic,build_org_name,build_org_no,bid_name,work_time FROM t_daily_plan
<if test="queryDate!= null and queryDate != ''">
WHERE work_time = #{queryDate}
</if>) b
ON a.id_number = b.bzz_bak_ic
LEFT JOIN (SELECT work_manager_num,class_id,org,build_unit,bid_name FROM t_class_metting group by work_manager_num,class_id,org,build_unit,bid_name order by work_day desc) c
ON a.id_number = c.work_manager_num
WHERE b.id IS NULL AND c.class_id IS NOT NULL AND a.work_off = 0
<if test="queryDate!= null and queryDate != ''">
AND a.update_day <![CDATA[<=]]> #{queryDate}
</if>
<if test="buildUnit!= null and buildUnit != ''">
AND c.org = #{buildUnit}
</if>
<if test="projectName!= null and projectName != ''">
AND c.bid_name like concat('%', #{projectName}, '%')
</if>
</select>
<!-- 未报计划数 -->
<select id="noPlanCount" resultType="java.lang.Integer">
SELECT count(*)
FROM t_work_team a
LEFT JOIN (SELECT id, bzz_bak_ic,build_org_name,build_org_no,bid_name,work_time FROM t_daily_plan
<if test="queryDate!= null and queryDate != ''">
WHERE work_time = #{queryDate}
</if>) b
ON a.id_number = b.bzz_bak_ic
LEFT JOIN (SELECT work_manager_num,class_id,org,build_unit,bid_name FROM t_class_metting group by work_manager_num,class_id,org,build_unit,bid_name order by work_day desc) c
ON a.id_number = c.work_manager_num
WHERE b.id IS NULL AND c.class_id IS NOT NULL AND a.work_off = 0
<if test="queryDate!= null and queryDate != ''">
AND a.update_day <![CDATA[<=]]> #{queryDate}
</if>
<if test="buildUnit!= null and buildUnit != ''">
AND c.org = #{buildUnit}
</if>
<if test="projectName!= null and projectName != ''">
AND c.bid_name like concat('%', #{projectName}, '%')
</if>
</select>
<!-- 有计划未作业列表 -->
<select id="queryNoWorkPage" resultType="com.sercurityControl.decision.domain.vo.NoWorkNoticeVo">
SELECT CASE WHEN b.id IS NULL THEN 0 ELSE 1 END AS plan,
a.team_name teamName,
a.phone,
IFNULL(b.work_time, a.update_day) AS workDate,
a.fzr_name teamLeaderName,
b.build_org_name buildUnit,
b.bid_name projectName
FROM t_work_team a
LEFT JOIN (SELECT id, bzz_bak_ic,build_org_name,build_org_no,bid_name,work_time FROM t_daily_plan
<if test="queryDate!= null and queryDate != ''">
WHERE work_time = #{queryDate}
</if>) b
ON a.id_number = b.bzz_bak_ic
LEFT JOIN (SELECT work_manager_num,class_id FROM t_class_metting
<if test="queryDate!= null and queryDate != ''">
WHERE work_day = #{queryDate}
</if>) c
ON a.id_number = c.work_manager_num
WHERE c.class_id IS NULL
AND b.id IS NOT NULL AND a.work_off = 0
<if test="queryDate!= null and queryDate != ''">
AND a.work_time <![CDATA[<=]]> #{queryDate}
</if>
<if test="buildUnit!= null and buildUnit != ''">
AND b.build_org_no = #{buildUnit}
</if>
<if test="projectName!= null and projectName != ''">
AND b.bid_name like concat('%', #{projectName}, '%')
</if>
</select>
<!-- 有计划未作业数量 -->
<select id="noWorkCount" resultType="java.lang.Integer">
SELECT count(*)
FROM t_work_team a
LEFT JOIN (SELECT id, bzz_bak_ic,build_org_name,build_org_no,bid_name,work_time FROM t_daily_plan
<if test="queryDate!= null and queryDate != ''">
WHERE work_time = #{queryDate}
</if>) b
ON a.id_number = b.bzz_bak_ic
LEFT JOIN (SELECT work_manager_num,class_id FROM t_class_metting
<if test="queryDate!= null and queryDate != ''">
WHERE work_day = #{queryDate}
</if>) c
ON a.id_number = c.work_manager_num
WHERE c.class_id IS NULL
AND b.id IS NOT NULL AND a.work_off = 0
<if test="queryDate!= null and queryDate != ''">
AND a.work_time <![CDATA[<=]]> #{queryDate}
</if>
<if test="buildUnit!= null and buildUnit != ''">
AND b.build_org_no = #{buildUnit}
</if>
<if test="projectName!= null and projectName != ''">
AND b.bid_name like concat('%', #{projectName}, '%')
</if>
</select>
</mapper>