<?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.ruoyi.powerdistribution.mapper.PdmWorkPlanMapper">

    <resultMap type="PdmWorkPlan" id="PdmWorkPlanResult">
        <result property="id"    column="id"    />
        <result property="uuid"    column="uuid"    />
        <result property="weekPlanNo"    column="week_plan_no"    />
        <result property="weekPlanId"    column="week_plan_id"    />
        <result property="projNm"    column="proj_nm"    />
        <result property="projId"    column="proj_id"    />
        <result property="srcId"    column="src_id"    />
        <result property="planNm"    column="plan_nm"    />
        <result property="submitOrgNm"    column="submit_org_nm"    />
        <result property="submitOrgId"    column="submit_org_id"    />
        <result property="orgSort"    column="org_sort"    />
        <result property="mgmtOrgNm"    column="mgmt_org_nm"    />
        <result property="mgmtOrgId"    column="mgmt_org_id"    />
        <result property="blgOpMaintCityOrgId"    column="blg_op_maint_city_org_id"    />
        <result property="blgConstCityOrgId"    column="blg_const_city_org_id"    />
        <result property="ovhaulConstOrgNm"    column="ovhaul_const_org_nm"    />
        <result property="ovhaulConstOrgId"    column="ovhaul_const_org_id"    />
        <result property="opMaintOrgNm"    column="op_maint_org_nm"    />
        <result property="opMaintOrgId"    column="op_maint_org_id"    />
        <result property="subsOrLineNm"    column="subs_or_line_nm"    />
        <result property="subsOrLineId"    column="subs_or_line_id"    />
        <result property="opRiskLvlCd"    column="op_risk_lvl_cd"    />
        <result property="opRiskLvlDsc"    column="op_risk_lvl_dsc"    />
        <result property="elecgdRiskLvlCd"    column="elecgd_risk_lvl_cd"    />
        <result property="elecgdRiskLvlDsc"    column="elecgd_risk_lvl_dsc"    />
        <result property="voltLvlCd"    column="volt_lvl_cd"    />
        <result property="voltLvlDsc"    column="volt_lvl_dsc"    />
        <result property="majorTypCd"    column="major_typ_cd"    />
        <result property="majorTypDsc"    column="major_typ_dsc"    />
        <result property="opTypCd"    column="op_typ_cd"    />
        <result property="opTypDsc"    column="op_typ_dsc"    />
        <result property="workticketTypCd"    column="workticket_typ_cd"    />
        <result property="workticketTypDsc"    column="workticket_typ_dsc"    />
        <result property="poweroffTypCd"    column="poweroff_typ_cd"    />
        <result property="poweroffTypDsc"    column="poweroff_typ_dsc"    />
        <result property="isEnergizedOpCd"    column="is_energized_op_cd"    />
        <result property="isEnergizedOpDsc"    column="is_energized_op_dsc"    />
        <result property="planStartWkTm"    column="plan_start_wk_tm"    />
        <result property="planEndTm"    column="plan_end_tm"    />
        <result property="opContent"    column="op_content"    />
        <result property="chgSchemeDsc"    column="chg_scheme_dsc"    />
        <result property="opAddr"    column="op_addr"    />
        <result property="cityAdmAddr"    column="city_adm_addr"    />
        <result property="countyAdmAddr"    column="county_adm_addr"    />
        <result property="detlPos"    column="detl_pos"    />
        <result property="landmarkArchit"    column="landmark_archit"    />
        <result property="workTeamNm"    column="work_team_nm"    />
        <result property="workTeamId"    column="work_team_id"    />
        <result property="mainBusiOrgOpNum"    column="main_busi_org_op_num"    />
        <result property="outsourcingOrgOpNum"    column="outsourcing_org_op_num"    />
        <result property="industryOrgOpNum"    column="industry_org_op_num"    />
        <result property="workPrincipNm"    column="work_princip_nm"    />
        <result property="workPrincipId"    column="work_princip_id"    />
        <result property="workPrincipContactMode"    column="work_princip_contact_mode"    />
        <result property="majorMgmtDept"    column="major_mgmt_dept"    />
        <result property="buildMgmtOrgNm"    column="build_mgmt_org_nm"    />
        <result property="constOrgNm"    column="const_org_nm"    />
        <result property="constOrgId"    column="const_org_id"    />
        <result property="constOrgCateCd"    column="const_org_cate_cd"    />
        <result property="constOrgCateDsc"    column="const_org_cate_dsc"    />
        <result property="scntrctOrgNm"    column="scntrct_org_nm"    />
        <result property="scntrctOrgId"    column="scntrct_org_id"    />
        <result property="scntrctOrgNatureCd"    column="scntrct_org_nature_cd"    />
        <result property="scntrctOrgNatureDsc"    column="scntrct_org_nature_dsc"    />
        <result property="inspectOrgNm"    column="inspect_org_nm"    />
        <result property="inspectOrgId"    column="inspect_org_id"    />
        <result property="poweroffRange"    column="poweroff_range"    />
        <result property="supervisesCheck"    column="supervises_check"    />
        <result property="sceneSupervises"    column="scene_supervises"    />
        <result property="sceneGuardianship"    column="scene_guardianship"    />
        <result property="releaseStCd"    column="release_st_cd"    />
        <result property="releaseStDsc"    column="release_st_dsc"    />
        <result property="releaseTm"    column="release_tm"    />
        <result property="releasePes"    column="release_pes"    />
        <result property="releasePersonId"    column="release_person_id"    />
        <result property="isReleaseIntimeCd"    column="is_release_intime_cd"    />
        <result property="planExecStCd"    column="plan_exec_st_cd"    />
        <result property="isChgMoreCd"    column="is_chg_more_cd"    />
        <result property="isChgMoreDsc"    column="is_chg_more_dsc"    />
        <result property="delMarkCd"    column="del_mark_cd"    />
        <result property="delMarkDsc"    column="del_mark_dsc"    />
        <result property="bindQt"    column="bind_qt"    />
        <result property="isWearSafetyhat"    column="is_wear_safetyhat"    />
        <result property="workSrc"    column="work_src"    />
        <result property="createTm"    column="create_tm"    />
        <result property="moreNewTm"    column="more_new_tm"    />
        <result property="planTypCd"    column="plan_typ_cd"    />
        <result property="planTypDsc"    column="plan_typ_dsc"    />
        <result property="stdOrgNo"    column="std_org_no"    />
        <result property="stdOrgNm"    column="std_org_nm"    />
        <result property="stdCityOrgNm"    column="std_city_org_nm"    />
        <result property="dataDt"    column="data_dt"    />
        <result property="etlTm"    column="etl_tm"    />
        <result property="parMon"    column="par_mon"    />
        <result property="stdCityOrgNo"    column="std_city_org_no"    />
        <result property="planExecStDsc"    column="plan_exec_st_dsc"    />
        <result property="cancelReason"    column="cancel_reason"    />
        <result property="planReason"    column="plan_reason"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
    </resultMap>

    <sql id="selectPdmWorkPlanVo">
        select id, uuid, week_plan_no, week_plan_id, proj_nm, proj_id, src_id, plan_nm, submit_org_nm, submit_org_id, org_sort, mgmt_org_nm, mgmt_org_id, blg_op_maint_city_org_id, blg_const_city_org_id, ovhaul_const_org_nm, ovhaul_const_org_id, op_maint_org_nm, op_maint_org_id, subs_or_line_nm, subs_or_line_id, op_risk_lvl_cd, op_risk_lvl_dsc, elecgd_risk_lvl_cd, elecgd_risk_lvl_dsc, volt_lvl_cd, volt_lvl_dsc, major_typ_cd, major_typ_dsc, op_typ_cd, op_typ_dsc, workticket_typ_cd, workticket_typ_dsc, poweroff_typ_cd, poweroff_typ_dsc, is_energized_op_cd, is_energized_op_dsc, plan_start_wk_tm, plan_end_tm, op_content, chg_scheme_dsc, op_addr, city_adm_addr, county_adm_addr, detl_pos, landmark_archit, work_team_nm, work_team_id, main_busi_org_op_num, outsourcing_org_op_num, industry_org_op_num, work_princip_nm, work_princip_id, work_princip_contact_mode, major_mgmt_dept, build_mgmt_org_nm, const_org_nm, const_org_id, const_org_cate_cd, const_org_cate_dsc, scntrct_org_nm, scntrct_org_id, scntrct_org_nature_cd, scntrct_org_nature_dsc, inspect_org_nm, inspect_org_id, poweroff_range, supervises_check, scene_supervises, scene_guardianship, release_st_cd, release_st_dsc, release_tm, release_pes, release_person_id, is_release_intime_cd, plan_exec_st_cd, is_chg_more_cd, is_chg_more_dsc, del_mark_cd, del_mark_dsc, bind_qt, is_wear_safetyhat, work_src, create_tm, more_new_tm, plan_typ_cd, plan_typ_dsc, std_org_no, std_org_nm, std_city_org_nm, data_dt, etl_tm, par_mon, std_city_org_no, plan_exec_st_dsc,plan_reason,cancel_reason,risk_type,create_by, create_time, update_by, update_time from pdm_work_plan
    </sql>

    <select id="selectPdmWorkPlanList" parameterType="com.ruoyi.powerdistribution.domain.dto.PdmWorkPlanDTO" resultMap="PdmWorkPlanResult">
        <include refid="selectPdmWorkPlanVo"/>
        <where>
            <if test="uuid != null  and uuid != ''"> and uuid = #{uuid}</if>
            <if test="weekPlanNo != null  and weekPlanNo != ''"> and week_plan_no = #{weekPlanNo}</if>
            <if test="weekPlanId != null  and weekPlanId != ''"> and week_plan_id = #{weekPlanId}</if>
            <if test="projNm != null  and projNm != ''"> and proj_nm = #{projNm}</if>
            <if test="projId != null  and projId != ''"> and proj_id = #{projId}</if>
            <if test="srcId != null  and srcId != ''"> and src_id = #{srcId}</if>
            <if test="planNm != null  and planNm != ''"> and plan_nm = #{planNm}</if>
            <if test="submitOrgNm != null  and submitOrgNm != ''"> and submit_org_nm = #{submitOrgNm}</if>
            <if test="submitOrgId != null  and submitOrgId != ''"> and submit_org_id = #{submitOrgId}</if>
            <if test="orgSort != null  and orgSort != ''"> and org_sort = #{orgSort}</if>
            <if test="mgmtOrgNm != null  and mgmtOrgNm != ''"> and mgmt_org_nm = #{mgmtOrgNm}</if>
            <if test="mgmtOrgId != null  and mgmtOrgId != ''"> and mgmt_org_id = #{mgmtOrgId}</if>
            <if test="blgOpMaintCityOrgId != null  and blgOpMaintCityOrgId != ''"> and blg_op_maint_city_org_id = #{blgOpMaintCityOrgId}</if>
            <if test="blgConstCityOrgId != null  and blgConstCityOrgId != ''"> and blg_const_city_org_id = #{blgConstCityOrgId}</if>
            <if test="ovhaulConstOrgNm != null  and ovhaulConstOrgNm != ''"> and ovhaul_const_org_nm = #{ovhaulConstOrgNm}</if>
            <if test="ovhaulConstOrgId != null  and ovhaulConstOrgId != ''"> and ovhaul_const_org_id = #{ovhaulConstOrgId}</if>
            <if test="opMaintOrgNm != null  and opMaintOrgNm != ''"> and op_maint_org_nm = #{opMaintOrgNm}</if>
            <if test="opMaintOrgId != null  and opMaintOrgId != ''"> and op_maint_org_id = #{opMaintOrgId}</if>
            <if test="subsOrLineNm != null  and subsOrLineNm != ''"> and subs_or_line_nm = #{subsOrLineNm}</if>
            <if test="subsOrLineId != null  and subsOrLineId != ''"> and subs_or_line_id = #{subsOrLineId}</if>
            <if test="opRiskLvlCd != null  and opRiskLvlCd != ''"> and op_risk_lvl_cd = #{opRiskLvlCd}</if>
            <if test="opRiskLvlDsc != null  and opRiskLvlDsc != ''"> and op_risk_lvl_dsc = #{opRiskLvlDsc}</if>
            <if test="elecgdRiskLvlCd != null  and elecgdRiskLvlCd != ''"> and elecgd_risk_lvl_cd = #{elecgdRiskLvlCd}</if>
            <if test="elecgdRiskLvlDsc != null  and elecgdRiskLvlDsc != ''"> and elecgd_risk_lvl_dsc = #{elecgdRiskLvlDsc}</if>
            <if test="voltLvlCd != null  and voltLvlCd != ''"> and volt_lvl_cd = #{voltLvlCd}</if>
            <if test="voltLvlDsc != null  and voltLvlDsc != ''"> and volt_lvl_dsc = #{voltLvlDsc}</if>
            <if test="majorTypCd != null  and majorTypCd != ''"> and major_typ_cd = #{majorTypCd}</if>
            <if test="majorTypDsc != null  and majorTypDsc != ''"> and major_typ_dsc = #{majorTypDsc}</if>
            <if test="opTypCd != null  and opTypCd != ''"> and op_typ_cd = #{opTypCd}</if>
            <if test="opTypDsc != null  and opTypDsc != ''"> and op_typ_dsc = #{opTypDsc}</if>
            <if test="workticketTypCd != null  and workticketTypCd != ''"> and workticket_typ_cd = #{workticketTypCd}</if>
            <if test="workticketTypDsc != null  and workticketTypDsc != ''"> and workticket_typ_dsc = #{workticketTypDsc}</if>
            <if test="poweroffTypCd != null  and poweroffTypCd != ''"> and poweroff_typ_cd = #{poweroffTypCd}</if>
            <if test="poweroffTypDsc != null  and poweroffTypDsc != ''"> and poweroff_typ_dsc = #{poweroffTypDsc}</if>
            <if test="isEnergizedOpCd != null  and isEnergizedOpCd != ''"> and is_energized_op_cd = #{isEnergizedOpCd}</if>
            <if test="isEnergizedOpDsc != null  and isEnergizedOpDsc != ''"> and is_energized_op_dsc = #{isEnergizedOpDsc}</if>
            <if test="planStartWkTm != null "> and plan_start_wk_tm = #{planStartWkTm}</if>
            <if test="planEndTm != null "> and plan_end_tm = #{planEndTm}</if>
            <if test="opContent != null  and opContent != ''"> and op_content = #{opContent}</if>
            <if test="chgSchemeDsc != null  and chgSchemeDsc != ''"> and chg_scheme_dsc = #{chgSchemeDsc}</if>
            <if test="opAddr != null  and opAddr != ''"> and op_addr = #{opAddr}</if>
            <if test="cityAdmAddr != null  and cityAdmAddr != ''"> and city_adm_addr = #{cityAdmAddr}</if>
            <if test="countyAdmAddr != null  and countyAdmAddr != ''"> and county_adm_addr = #{countyAdmAddr}</if>
            <if test="detlPos != null  and detlPos != ''"> and detl_pos = #{detlPos}</if>
            <if test="landmarkArchit != null  and landmarkArchit != ''"> and landmark_archit = #{landmarkArchit}</if>
            <if test="workTeamNm != null  and workTeamNm != ''"> and work_team_nm = #{workTeamNm}</if>
            <if test="workTeamId != null  and workTeamId != ''"> and work_team_id = #{workTeamId}</if>
            <if test="mainBusiOrgOpNum != null  and mainBusiOrgOpNum != ''"> and main_busi_org_op_num = #{mainBusiOrgOpNum}</if>
            <if test="outsourcingOrgOpNum != null  and outsourcingOrgOpNum != ''"> and outsourcing_org_op_num = #{outsourcingOrgOpNum}</if>
            <if test="industryOrgOpNum != null  and industryOrgOpNum != ''"> and industry_org_op_num = #{industryOrgOpNum}</if>
            <if test="workPrincipNm != null  and workPrincipNm != ''"> and work_princip_nm = #{workPrincipNm}</if>
            <if test="workPrincipId != null  and workPrincipId != ''"> and work_princip_id = #{workPrincipId}</if>
            <if test="workPrincipContactMode != null  and workPrincipContactMode != ''"> and work_princip_contact_mode = #{workPrincipContactMode}</if>
            <if test="majorMgmtDept != null  and majorMgmtDept != ''"> and major_mgmt_dept = #{majorMgmtDept}</if>
            <if test="buildMgmtOrgNm != null  and buildMgmtOrgNm != ''"> and build_mgmt_org_nm = #{buildMgmtOrgNm}</if>
            <if test="constOrgNm != null  and constOrgNm != ''"> and const_org_nm = #{constOrgNm}</if>
            <if test="constOrgId != null  and constOrgId != ''"> and const_org_id = #{constOrgId}</if>
            <if test="constOrgCateCd != null  and constOrgCateCd != ''"> and const_org_cate_cd = #{constOrgCateCd}</if>
            <if test="constOrgCateDsc != null  and constOrgCateDsc != ''"> and const_org_cate_dsc = #{constOrgCateDsc}</if>
            <if test="scntrctOrgNm != null  and scntrctOrgNm != ''"> and scntrct_org_nm = #{scntrctOrgNm}</if>
            <if test="scntrctOrgId != null  and scntrctOrgId != ''"> and scntrct_org_id = #{scntrctOrgId}</if>
            <if test="scntrctOrgNatureCd != null  and scntrctOrgNatureCd != ''"> and scntrct_org_nature_cd = #{scntrctOrgNatureCd}</if>
            <if test="scntrctOrgNatureDsc != null  and scntrctOrgNatureDsc != ''"> and scntrct_org_nature_dsc = #{scntrctOrgNatureDsc}</if>
            <if test="inspectOrgNm != null  and inspectOrgNm != ''"> and inspect_org_nm = #{inspectOrgNm}</if>
            <if test="inspectOrgId != null  and inspectOrgId != ''"> and inspect_org_id = #{inspectOrgId}</if>
            <if test="poweroffRange != null  and poweroffRange != ''"> and poweroff_range = #{poweroffRange}</if>
            <if test="supervisesCheck != null  and supervisesCheck != ''"> and supervises_check = #{supervisesCheck}</if>
            <if test="sceneSupervises != null  and sceneSupervises != ''"> and scene_supervises = #{sceneSupervises}</if>
            <if test="sceneGuardianship != null  and sceneGuardianship != ''"> and scene_guardianship = #{sceneGuardianship}</if>
            <if test="releaseStCd != null  and releaseStCd != ''"> and release_st_cd = #{releaseStCd}</if>
            <if test="releaseStDsc != null  and releaseStDsc != ''"> and release_st_dsc = #{releaseStDsc}</if>
            <if test="releaseTm != null  and releaseTm != ''"> and release_tm = #{releaseTm}</if>
            <if test="releasePes != null  and releasePes != ''"> and release_pes = #{releasePes}</if>
            <if test="releasePersonId != null  and releasePersonId != ''"> and release_person_id = #{releasePersonId}</if>
            <if test="isReleaseIntimeCd != null  and isReleaseIntimeCd != ''"> and is_release_intime_cd = #{isReleaseIntimeCd}</if>
            <if test="planExecStCd != null  and planExecStCd != ''"> and plan_exec_st_cd = #{planExecStCd}</if>
            <if test="isChgMoreCd != null  and isChgMoreCd != ''"> and is_chg_more_cd = #{isChgMoreCd}</if>
            <if test="isChgMoreDsc != null  and isChgMoreDsc != ''"> and is_chg_more_dsc = #{isChgMoreDsc}</if>
            <if test="delMarkCd != null  and delMarkCd != ''"> and del_mark_cd = #{delMarkCd}</if>
            <if test="delMarkDsc != null  and delMarkDsc != ''"> and del_mark_dsc = #{delMarkDsc}</if>
            <if test="bindQt != null  and bindQt != ''"> and bind_qt = #{bindQt}</if>
            <if test="isWearSafetyhat != null  and isWearSafetyhat != ''"> and is_wear_safetyhat = #{isWearSafetyhat}</if>
            <if test="workSrc != null  and workSrc != ''"> and work_src = #{workSrc}</if>
            <if test="createTm != null "> and create_tm = #{createTm}</if>
            <if test="moreNewTm != null "> and more_new_tm = #{moreNewTm}</if>
            <if test="planTypCd != null  and planTypCd != ''"> and plan_typ_cd = #{planTypCd}</if>
            <if test="planTypDsc != null  and planTypDsc != ''"> and plan_typ_dsc = #{planTypDsc}</if>
            <if test="stdOrgNo != null  and stdOrgNo != ''"> and std_org_no = #{stdOrgNo}</if>
            <if test="stdOrgNm != null  and stdOrgNm != ''"> and std_org_nm = #{stdOrgNm}</if>
            <if test="stdCityOrgNm != null  and stdCityOrgNm != ''"> and std_city_org_nm = #{stdCityOrgNm}</if>
            <if test="dataDt != null  and dataDt != ''"> and data_dt = #{dataDt}</if>
            <if test="etlTm != null  and etlTm != ''"> and etl_tm = #{etlTm}</if>
            <if test="parMon != null  and parMon != ''"> and par_mon = #{parMon}</if>
            <if test="stdCityOrgNo != null  and stdCityOrgNo != ''"> and std_city_org_no = #{stdCityOrgNo}</if>
            <if test="planExecStDsc != null  and planExecStDsc != ''"> and plan_exec_st_dsc = #{planExecStDsc}</if>
            <if test="riskType != null  and riskType != ''"> and risk_type = #{riskType}</if>

            <if test="startDate != null and startDate != ''">
             and date_format(plan_start_wk_tm,'%Y%m%d') &gt;= #{startDate}
            </if>
            <if test="endDate != null and endDate != ''">
                and date_format(plan_start_wk_tm,'%Y%m%d') &lt;= #{endDate}
            </if>
            <if test="level3Flag != null and level3Flag == 1 ">
                and op_risk_lvl_cd in ('2007001','2007002','2007003')
            </if>
            <if test="dataFlag != null and dataFlag == 1 ">
                and volt_lvl_cd not in ('2001008','2001009')
                and not  (is_energized_op_cd = '2006001' and poweroff_typ_cd = '2005002' and workticket_typ_cd = '2008015')
            </if>
            <if test="riskFlag != null and riskFlag == 1 ">
                and risk_type != '0'
            </if>
        </where>
    </select>

    <select id="selectPdmWorkPlanById" parameterType="Long" resultMap="PdmWorkPlanResult">
        <include refid="selectPdmWorkPlanVo"/>
        where id = #{id}
    </select>

    <insert id="insertPdmWorkPlan" parameterType="PdmWorkPlan" useGeneratedKeys="true" keyProperty="id">
        insert into pdm_work_plan
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="uuid != null">uuid,</if>
            <if test="weekPlanNo != null">week_plan_no,</if>
            <if test="weekPlanId != null">week_plan_id,</if>
            <if test="projNm != null">proj_nm,</if>
            <if test="projId != null">proj_id,</if>
            <if test="srcId != null">src_id,</if>
            <if test="planNm != null">plan_nm,</if>
            <if test="submitOrgNm != null">submit_org_nm,</if>
            <if test="submitOrgId != null">submit_org_id,</if>
            <if test="orgSort != null">org_sort,</if>
            <if test="mgmtOrgNm != null">mgmt_org_nm,</if>
            <if test="mgmtOrgId != null">mgmt_org_id,</if>
            <if test="blgOpMaintCityOrgId != null">blg_op_maint_city_org_id,</if>
            <if test="blgConstCityOrgId != null">blg_const_city_org_id,</if>
            <if test="ovhaulConstOrgNm != null">ovhaul_const_org_nm,</if>
            <if test="ovhaulConstOrgId != null">ovhaul_const_org_id,</if>
            <if test="opMaintOrgNm != null">op_maint_org_nm,</if>
            <if test="opMaintOrgId != null">op_maint_org_id,</if>
            <if test="subsOrLineNm != null">subs_or_line_nm,</if>
            <if test="subsOrLineId != null">subs_or_line_id,</if>
            <if test="opRiskLvlCd != null">op_risk_lvl_cd,</if>
            <if test="opRiskLvlDsc != null">op_risk_lvl_dsc,</if>
            <if test="elecgdRiskLvlCd != null">elecgd_risk_lvl_cd,</if>
            <if test="elecgdRiskLvlDsc != null">elecgd_risk_lvl_dsc,</if>
            <if test="voltLvlCd != null">volt_lvl_cd,</if>
            <if test="voltLvlDsc != null">volt_lvl_dsc,</if>
            <if test="majorTypCd != null">major_typ_cd,</if>
            <if test="majorTypDsc != null">major_typ_dsc,</if>
            <if test="opTypCd != null">op_typ_cd,</if>
            <if test="opTypDsc != null">op_typ_dsc,</if>
            <if test="workticketTypCd != null">workticket_typ_cd,</if>
            <if test="workticketTypDsc != null">workticket_typ_dsc,</if>
            <if test="poweroffTypCd != null">poweroff_typ_cd,</if>
            <if test="poweroffTypDsc != null">poweroff_typ_dsc,</if>
            <if test="isEnergizedOpCd != null">is_energized_op_cd,</if>
            <if test="isEnergizedOpDsc != null">is_energized_op_dsc,</if>
            <if test="planStartWkTm != null">plan_start_wk_tm,</if>
            <if test="planEndTm != null">plan_end_tm,</if>
            <if test="opContent != null">op_content,</if>
            <if test="chgSchemeDsc != null">chg_scheme_dsc,</if>
            <if test="opAddr != null">op_addr,</if>
            <if test="cityAdmAddr != null">city_adm_addr,</if>
            <if test="countyAdmAddr != null">county_adm_addr,</if>
            <if test="detlPos != null">detl_pos,</if>
            <if test="landmarkArchit != null">landmark_archit,</if>
            <if test="workTeamNm != null">work_team_nm,</if>
            <if test="workTeamId != null">work_team_id,</if>
            <if test="mainBusiOrgOpNum != null">main_busi_org_op_num,</if>
            <if test="outsourcingOrgOpNum != null">outsourcing_org_op_num,</if>
            <if test="industryOrgOpNum != null">industry_org_op_num,</if>
            <if test="workPrincipNm != null">work_princip_nm,</if>
            <if test="workPrincipId != null">work_princip_id,</if>
            <if test="workPrincipContactMode != null">work_princip_contact_mode,</if>
            <if test="majorMgmtDept != null">major_mgmt_dept,</if>
            <if test="buildMgmtOrgNm != null">build_mgmt_org_nm,</if>
            <if test="constOrgNm != null">const_org_nm,</if>
            <if test="constOrgId != null">const_org_id,</if>
            <if test="constOrgCateCd != null">const_org_cate_cd,</if>
            <if test="constOrgCateDsc != null">const_org_cate_dsc,</if>
            <if test="scntrctOrgNm != null">scntrct_org_nm,</if>
            <if test="scntrctOrgId != null">scntrct_org_id,</if>
            <if test="scntrctOrgNatureCd != null">scntrct_org_nature_cd,</if>
            <if test="scntrctOrgNatureDsc != null">scntrct_org_nature_dsc,</if>
            <if test="inspectOrgNm != null">inspect_org_nm,</if>
            <if test="inspectOrgId != null">inspect_org_id,</if>
            <if test="poweroffRange != null">poweroff_range,</if>
            <if test="supervisesCheck != null">supervises_check,</if>
            <if test="sceneSupervises != null">scene_supervises,</if>
            <if test="sceneGuardianship != null">scene_guardianship,</if>
            <if test="releaseStCd != null">release_st_cd,</if>
            <if test="releaseStDsc != null">release_st_dsc,</if>
            <if test="releaseTm != null">release_tm,</if>
            <if test="releasePes != null">release_pes,</if>
            <if test="releasePersonId != null">release_person_id,</if>
            <if test="isReleaseIntimeCd != null">is_release_intime_cd,</if>
            <if test="planExecStCd != null">plan_exec_st_cd,</if>
            <if test="isChgMoreCd != null">is_chg_more_cd,</if>
            <if test="isChgMoreDsc != null">is_chg_more_dsc,</if>
            <if test="delMarkCd != null">del_mark_cd,</if>
            <if test="delMarkDsc != null">del_mark_dsc,</if>
            <if test="bindQt != null">bind_qt,</if>
            <if test="isWearSafetyhat != null">is_wear_safetyhat,</if>
            <if test="workSrc != null">work_src,</if>
            <if test="createTm != null">create_tm,</if>
            <if test="moreNewTm != null">more_new_tm,</if>
            <if test="planTypCd != null">plan_typ_cd,</if>
            <if test="planTypDsc != null">plan_typ_dsc,</if>
            <if test="stdOrgNo != null">std_org_no,</if>
            <if test="stdOrgNm != null">std_org_nm,</if>
            <if test="stdCityOrgNm != null">std_city_org_nm,</if>
            <if test="dataDt != null">data_dt,</if>
            <if test="etlTm != null">etl_tm,</if>
            <if test="parMon != null">par_mon,</if>
            <if test="stdCityOrgNo != null">std_city_org_no,</if>
            <if test="planExecStDsc != null">plan_exec_st_dsc,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="uuid != null">#{uuid},</if>
            <if test="weekPlanNo != null">#{weekPlanNo},</if>
            <if test="weekPlanId != null">#{weekPlanId},</if>
            <if test="projNm != null">#{projNm},</if>
            <if test="projId != null">#{projId},</if>
            <if test="srcId != null">#{srcId},</if>
            <if test="planNm != null">#{planNm},</if>
            <if test="submitOrgNm != null">#{submitOrgNm},</if>
            <if test="submitOrgId != null">#{submitOrgId},</if>
            <if test="orgSort != null">#{orgSort},</if>
            <if test="mgmtOrgNm != null">#{mgmtOrgNm},</if>
            <if test="mgmtOrgId != null">#{mgmtOrgId},</if>
            <if test="blgOpMaintCityOrgId != null">#{blgOpMaintCityOrgId},</if>
            <if test="blgConstCityOrgId != null">#{blgConstCityOrgId},</if>
            <if test="ovhaulConstOrgNm != null">#{ovhaulConstOrgNm},</if>
            <if test="ovhaulConstOrgId != null">#{ovhaulConstOrgId},</if>
            <if test="opMaintOrgNm != null">#{opMaintOrgNm},</if>
            <if test="opMaintOrgId != null">#{opMaintOrgId},</if>
            <if test="subsOrLineNm != null">#{subsOrLineNm},</if>
            <if test="subsOrLineId != null">#{subsOrLineId},</if>
            <if test="opRiskLvlCd != null">#{opRiskLvlCd},</if>
            <if test="opRiskLvlDsc != null">#{opRiskLvlDsc},</if>
            <if test="elecgdRiskLvlCd != null">#{elecgdRiskLvlCd},</if>
            <if test="elecgdRiskLvlDsc != null">#{elecgdRiskLvlDsc},</if>
            <if test="voltLvlCd != null">#{voltLvlCd},</if>
            <if test="voltLvlDsc != null">#{voltLvlDsc},</if>
            <if test="majorTypCd != null">#{majorTypCd},</if>
            <if test="majorTypDsc != null">#{majorTypDsc},</if>
            <if test="opTypCd != null">#{opTypCd},</if>
            <if test="opTypDsc != null">#{opTypDsc},</if>
            <if test="workticketTypCd != null">#{workticketTypCd},</if>
            <if test="workticketTypDsc != null">#{workticketTypDsc},</if>
            <if test="poweroffTypCd != null">#{poweroffTypCd},</if>
            <if test="poweroffTypDsc != null">#{poweroffTypDsc},</if>
            <if test="isEnergizedOpCd != null">#{isEnergizedOpCd},</if>
            <if test="isEnergizedOpDsc != null">#{isEnergizedOpDsc},</if>
            <if test="planStartWkTm != null">#{planStartWkTm},</if>
            <if test="planEndTm != null">#{planEndTm},</if>
            <if test="opContent != null">#{opContent},</if>
            <if test="chgSchemeDsc != null">#{chgSchemeDsc},</if>
            <if test="opAddr != null">#{opAddr},</if>
            <if test="cityAdmAddr != null">#{cityAdmAddr},</if>
            <if test="countyAdmAddr != null">#{countyAdmAddr},</if>
            <if test="detlPos != null">#{detlPos},</if>
            <if test="landmarkArchit != null">#{landmarkArchit},</if>
            <if test="workTeamNm != null">#{workTeamNm},</if>
            <if test="workTeamId != null">#{workTeamId},</if>
            <if test="mainBusiOrgOpNum != null">#{mainBusiOrgOpNum},</if>
            <if test="outsourcingOrgOpNum != null">#{outsourcingOrgOpNum},</if>
            <if test="industryOrgOpNum != null">#{industryOrgOpNum},</if>
            <if test="workPrincipNm != null">#{workPrincipNm},</if>
            <if test="workPrincipId != null">#{workPrincipId},</if>
            <if test="workPrincipContactMode != null">#{workPrincipContactMode},</if>
            <if test="majorMgmtDept != null">#{majorMgmtDept},</if>
            <if test="buildMgmtOrgNm != null">#{buildMgmtOrgNm},</if>
            <if test="constOrgNm != null">#{constOrgNm},</if>
            <if test="constOrgId != null">#{constOrgId},</if>
            <if test="constOrgCateCd != null">#{constOrgCateCd},</if>
            <if test="constOrgCateDsc != null">#{constOrgCateDsc},</if>
            <if test="scntrctOrgNm != null">#{scntrctOrgNm},</if>
            <if test="scntrctOrgId != null">#{scntrctOrgId},</if>
            <if test="scntrctOrgNatureCd != null">#{scntrctOrgNatureCd},</if>
            <if test="scntrctOrgNatureDsc != null">#{scntrctOrgNatureDsc},</if>
            <if test="inspectOrgNm != null">#{inspectOrgNm},</if>
            <if test="inspectOrgId != null">#{inspectOrgId},</if>
            <if test="poweroffRange != null">#{poweroffRange},</if>
            <if test="supervisesCheck != null">#{supervisesCheck},</if>
            <if test="sceneSupervises != null">#{sceneSupervises},</if>
            <if test="sceneGuardianship != null">#{sceneGuardianship},</if>
            <if test="releaseStCd != null">#{releaseStCd},</if>
            <if test="releaseStDsc != null">#{releaseStDsc},</if>
            <if test="releaseTm != null">#{releaseTm},</if>
            <if test="releasePes != null">#{releasePes},</if>
            <if test="releasePersonId != null">#{releasePersonId},</if>
            <if test="isReleaseIntimeCd != null">#{isReleaseIntimeCd},</if>
            <if test="planExecStCd != null">#{planExecStCd},</if>
            <if test="isChgMoreCd != null">#{isChgMoreCd},</if>
            <if test="isChgMoreDsc != null">#{isChgMoreDsc},</if>
            <if test="delMarkCd != null">#{delMarkCd},</if>
            <if test="delMarkDsc != null">#{delMarkDsc},</if>
            <if test="bindQt != null">#{bindQt},</if>
            <if test="isWearSafetyhat != null">#{isWearSafetyhat},</if>
            <if test="workSrc != null">#{workSrc},</if>
            <if test="createTm != null">#{createTm},</if>
            <if test="moreNewTm != null">#{moreNewTm},</if>
            <if test="planTypCd != null">#{planTypCd},</if>
            <if test="planTypDsc != null">#{planTypDsc},</if>
            <if test="stdOrgNo != null">#{stdOrgNo},</if>
            <if test="stdOrgNm != null">#{stdOrgNm},</if>
            <if test="stdCityOrgNm != null">#{stdCityOrgNm},</if>
            <if test="dataDt != null">#{dataDt},</if>
            <if test="etlTm != null">#{etlTm},</if>
            <if test="parMon != null">#{parMon},</if>
            <if test="stdCityOrgNo != null">#{stdCityOrgNo},</if>
            <if test="planExecStDsc != null">#{planExecStDsc},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
         </trim>
    </insert>

    <update id="updatePdmWorkPlan" parameterType="PdmWorkPlan">
        update pdm_work_plan
        <trim prefix="SET" suffixOverrides=",">
            <if test="uuid != null">uuid = #{uuid},</if>
            <if test="weekPlanNo != null">week_plan_no = #{weekPlanNo},</if>
            <if test="weekPlanId != null">week_plan_id = #{weekPlanId},</if>
            <if test="projNm != null">proj_nm = #{projNm},</if>
            <if test="projId != null">proj_id = #{projId},</if>
            <if test="srcId != null">src_id = #{srcId},</if>
            <if test="planNm != null">plan_nm = #{planNm},</if>
            <if test="submitOrgNm != null">submit_org_nm = #{submitOrgNm},</if>
            <if test="submitOrgId != null">submit_org_id = #{submitOrgId},</if>
            <if test="orgSort != null">org_sort = #{orgSort},</if>
            <if test="mgmtOrgNm != null">mgmt_org_nm = #{mgmtOrgNm},</if>
            <if test="mgmtOrgId != null">mgmt_org_id = #{mgmtOrgId},</if>
            <if test="blgOpMaintCityOrgId != null">blg_op_maint_city_org_id = #{blgOpMaintCityOrgId},</if>
            <if test="blgConstCityOrgId != null">blg_const_city_org_id = #{blgConstCityOrgId},</if>
            <if test="ovhaulConstOrgNm != null">ovhaul_const_org_nm = #{ovhaulConstOrgNm},</if>
            <if test="ovhaulConstOrgId != null">ovhaul_const_org_id = #{ovhaulConstOrgId},</if>
            <if test="opMaintOrgNm != null">op_maint_org_nm = #{opMaintOrgNm},</if>
            <if test="opMaintOrgId != null">op_maint_org_id = #{opMaintOrgId},</if>
            <if test="subsOrLineNm != null">subs_or_line_nm = #{subsOrLineNm},</if>
            <if test="subsOrLineId != null">subs_or_line_id = #{subsOrLineId},</if>
            <if test="opRiskLvlCd != null">op_risk_lvl_cd = #{opRiskLvlCd},</if>
            <if test="opRiskLvlDsc != null">op_risk_lvl_dsc = #{opRiskLvlDsc},</if>
            <if test="elecgdRiskLvlCd != null">elecgd_risk_lvl_cd = #{elecgdRiskLvlCd},</if>
            <if test="elecgdRiskLvlDsc != null">elecgd_risk_lvl_dsc = #{elecgdRiskLvlDsc},</if>
            <if test="voltLvlCd != null">volt_lvl_cd = #{voltLvlCd},</if>
            <if test="voltLvlDsc != null">volt_lvl_dsc = #{voltLvlDsc},</if>
            <if test="majorTypCd != null">major_typ_cd = #{majorTypCd},</if>
            <if test="majorTypDsc != null">major_typ_dsc = #{majorTypDsc},</if>
            <if test="opTypCd != null">op_typ_cd = #{opTypCd},</if>
            <if test="opTypDsc != null">op_typ_dsc = #{opTypDsc},</if>
            <if test="workticketTypCd != null">workticket_typ_cd = #{workticketTypCd},</if>
            <if test="workticketTypDsc != null">workticket_typ_dsc = #{workticketTypDsc},</if>
            <if test="poweroffTypCd != null">poweroff_typ_cd = #{poweroffTypCd},</if>
            <if test="poweroffTypDsc != null">poweroff_typ_dsc = #{poweroffTypDsc},</if>
            <if test="isEnergizedOpCd != null">is_energized_op_cd = #{isEnergizedOpCd},</if>
            <if test="isEnergizedOpDsc != null">is_energized_op_dsc = #{isEnergizedOpDsc},</if>
            <if test="planStartWkTm != null">plan_start_wk_tm = #{planStartWkTm},</if>
            <if test="planEndTm != null">plan_end_tm = #{planEndTm},</if>
            <if test="opContent != null">op_content = #{opContent},</if>
            <if test="chgSchemeDsc != null">chg_scheme_dsc = #{chgSchemeDsc},</if>
            <if test="opAddr != null">op_addr = #{opAddr},</if>
            <if test="cityAdmAddr != null">city_adm_addr = #{cityAdmAddr},</if>
            <if test="countyAdmAddr != null">county_adm_addr = #{countyAdmAddr},</if>
            <if test="detlPos != null">detl_pos = #{detlPos},</if>
            <if test="landmarkArchit != null">landmark_archit = #{landmarkArchit},</if>
            <if test="workTeamNm != null">work_team_nm = #{workTeamNm},</if>
            <if test="workTeamId != null">work_team_id = #{workTeamId},</if>
            <if test="mainBusiOrgOpNum != null">main_busi_org_op_num = #{mainBusiOrgOpNum},</if>
            <if test="outsourcingOrgOpNum != null">outsourcing_org_op_num = #{outsourcingOrgOpNum},</if>
            <if test="industryOrgOpNum != null">industry_org_op_num = #{industryOrgOpNum},</if>
            <if test="workPrincipNm != null">work_princip_nm = #{workPrincipNm},</if>
            <if test="workPrincipId != null">work_princip_id = #{workPrincipId},</if>
            <if test="workPrincipContactMode != null">work_princip_contact_mode = #{workPrincipContactMode},</if>
            <if test="majorMgmtDept != null">major_mgmt_dept = #{majorMgmtDept},</if>
            <if test="buildMgmtOrgNm != null">build_mgmt_org_nm = #{buildMgmtOrgNm},</if>
            <if test="constOrgNm != null">const_org_nm = #{constOrgNm},</if>
            <if test="constOrgId != null">const_org_id = #{constOrgId},</if>
            <if test="constOrgCateCd != null">const_org_cate_cd = #{constOrgCateCd},</if>
            <if test="constOrgCateDsc != null">const_org_cate_dsc = #{constOrgCateDsc},</if>
            <if test="scntrctOrgNm != null">scntrct_org_nm = #{scntrctOrgNm},</if>
            <if test="scntrctOrgId != null">scntrct_org_id = #{scntrctOrgId},</if>
            <if test="scntrctOrgNatureCd != null">scntrct_org_nature_cd = #{scntrctOrgNatureCd},</if>
            <if test="scntrctOrgNatureDsc != null">scntrct_org_nature_dsc = #{scntrctOrgNatureDsc},</if>
            <if test="inspectOrgNm != null">inspect_org_nm = #{inspectOrgNm},</if>
            <if test="inspectOrgId != null">inspect_org_id = #{inspectOrgId},</if>
            <if test="poweroffRange != null">poweroff_range = #{poweroffRange},</if>
            <if test="supervisesCheck != null">supervises_check = #{supervisesCheck},</if>
            <if test="sceneSupervises != null">scene_supervises = #{sceneSupervises},</if>
            <if test="sceneGuardianship != null">scene_guardianship = #{sceneGuardianship},</if>
            <if test="releaseStCd != null">release_st_cd = #{releaseStCd},</if>
            <if test="releaseStDsc != null">release_st_dsc = #{releaseStDsc},</if>
            <if test="releaseTm != null">release_tm = #{releaseTm},</if>
            <if test="releasePes != null">release_pes = #{releasePes},</if>
            <if test="releasePersonId != null">release_person_id = #{releasePersonId},</if>
            <if test="isReleaseIntimeCd != null">is_release_intime_cd = #{isReleaseIntimeCd},</if>
            <if test="planExecStCd != null">plan_exec_st_cd = #{planExecStCd},</if>
            <if test="isChgMoreCd != null">is_chg_more_cd = #{isChgMoreCd},</if>
            <if test="isChgMoreDsc != null">is_chg_more_dsc = #{isChgMoreDsc},</if>
            <if test="delMarkCd != null">del_mark_cd = #{delMarkCd},</if>
            <if test="delMarkDsc != null">del_mark_dsc = #{delMarkDsc},</if>
            <if test="bindQt != null">bind_qt = #{bindQt},</if>
            <if test="isWearSafetyhat != null">is_wear_safetyhat = #{isWearSafetyhat},</if>
            <if test="workSrc != null">work_src = #{workSrc},</if>
            <if test="createTm != null">create_tm = #{createTm},</if>
            <if test="moreNewTm != null">more_new_tm = #{moreNewTm},</if>
            <if test="planTypCd != null">plan_typ_cd = #{planTypCd},</if>
            <if test="planTypDsc != null">plan_typ_dsc = #{planTypDsc},</if>
            <if test="stdOrgNo != null">std_org_no = #{stdOrgNo},</if>
            <if test="stdOrgNm != null">std_org_nm = #{stdOrgNm},</if>
            <if test="stdCityOrgNm != null">std_city_org_nm = #{stdCityOrgNm},</if>
            <if test="dataDt != null">data_dt = #{dataDt},</if>
            <if test="etlTm != null">etl_tm = #{etlTm},</if>
            <if test="parMon != null">par_mon = #{parMon},</if>
            <if test="stdCityOrgNo != null">std_city_org_no = #{stdCityOrgNo},</if>
            <if test="planExecStDsc != null">plan_exec_st_dsc = #{planExecStDsc},</if>
            <if test="cancelReason != null">cancel_reason = #{cancelReason},</if>
            <if test="riskType != null ">risk_type = #{riskType},</if>
            <if test="planReason != null">plan_reason = #{planReason},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deletePdmWorkPlanById" parameterType="Long">
        delete from pdm_work_plan where id = #{id}
    </delete>

    <delete id="deletePdmWorkPlanByIds" parameterType="String">
        delete from pdm_work_plan where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>
