ys_sms_sending_system/bonus-business/src/main/resources/mapper/MonthPlanMapper.xml

142 lines
6.3 KiB
XML

<?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.bonus.digital.mapper.MonthlyPlanMapper">
<insert id="addMonthlyPlanList" useGeneratedKeys="true" keyProperty="monthlyPlanId">
insert into tb_monthly_plan (monthly_plan,inspection_station_id,inspection_station_name,plan_major_id,business_type_id,
project_name,work_content,plan_category_id,tower_base_number,planned_start_time,
planned_end_time,plan_personnel,plan_car_num,plan_skilled_worker_num,plan_auxiliary_worker_num,
plan_sub_car_num,create_user,create_time,actual_working_day)
values (#{monthlyPlan},#{inspectionStationId},#{inspectionStationName},#{planMajorId},#{businessTypeId},
#{projectName},#{workContent},#{planCategoryId},#{towerBaseNumber},#{plannedStartTime},#{plannedEndTime},
#{planPersonnel},#{planCarNum},#{planSkilledWorkerNum},#{planAuxiliaryWorkerNum},#{planSubCarNum},
#{createUser},#{createTime},#{actualWorkingDay})
</insert>
<insert id="addPersonnelArrangement">
insert into tb_personnel_arrangement (monthly_plan_id,day,personnel_names)
values (#{monthlyPlanId},#{day},#{personnelNames})
</insert>
<insert id="addWorkload">
insert into tb_workload (plan_id,workload_category_id,workload_category_name,unit_price,workload_num,data_source)
values (#{planId},#{workloadCategoryId},#{workloadCategoryName},#{unitPrice},#{workloadNum},#{dataSource})
</insert>
<update id="updateMonthlyPlan">
update tb_monthly_plan
<trim prefix="set" suffixOverrides=",">
<if test="monthlyPlan!= null " >
monthly_plan=#{monthlyPlan},
</if>
<if test="inspectionStationId!= null " >
inspection_station_id=#{inspectionStationId},
</if>
<if test="inspectionStationName!= null " >
inspection_station_name=#{inspectionStationName},
</if>
<if test="planMajorId!= null " >
plan_major_id=#{planMajorId},
</if>
<if test="businessTypeId!= null " >
business_type_id=#{businessTypeId},
</if>
<if test="projectName!= null " >
project_name=#{projectName},
</if>
<if test="workContent!= null " >
work_content=#{workContent},
</if>
<if test="planCategoryId!= null " >
plan_category_id=#{planCategoryId},
</if>
<if test="towerBaseNumber!= null " >
tower_base_number=#{towerBaseNumber},
</if>
<if test="plannedStartTime!= null " >
planned_start_time=#{plannedStartTime},
</if>
<if test="plannedEndTime!= null " >
planned_end_time=#{plannedEndTime},
</if>
<if test="planPersonnel!= null " >
plan_personnel=#{planPersonnel},
</if>
<if test="planCarNum!= null " >
plan_car_num=#{planCarNum},
</if>
<if test="planSkilledWorkerNum!= null " >
plan_skilled_worker_num=#{planSkilledWorkerNum},
</if>
<if test="planAuxiliaryWorkerNum!= null " >
plan_auxiliary_worker_num=#{planAuxiliaryWorkerNum},
</if>
<if test="planSubCarNum!= null " >
plan_sub_car_num=#{planSubCarNum},
</if>
<if test="updateTime!= null " >
update_time=#{updateTime},
</if>
<if test="updateUser!= null " >
update_user=#{updateUser},
</if>
<if test="actualWorkingDay!= null " >
actual_working_day=#{actualWorkingDay},
</if>
</trim>
where monthly_plan_id = #{monthlyPlanId}
</update>
<delete id="delMonthlyPlanList">
update tb_monthly_plan set is_active ='0' where monthly_plan_id = #{monthlyPlanId}
</delete>
<delete id="delPersonnelArrangement">
delete from tb_personnel_arrangement where monthly_plan_id = #{monthlyPlanId}
</delete>
<delete id="delWorkload">
delete from tb_workload where plan_id= #{monthlyPlanId}
</delete>
<select id="getPlanMajorList" resultType="com.bonus.digital.dao.MonthlyPlanVo">
select tmp.monthly_plan_id,
tmp.monthly_plan,
tmp.inspection_station_id,
tmp.inspection_station_name,
tmp.plan_major_id,
tmp.business_type_id,
tmp.project_name,
tmp.work_content,
tmp.plan_category_id,
tmp.tower_base_number,
tmp.planned_start_time,
tmp.planned_end_time,
tmp.plan_personnel,
tmp.plan_car_num,
tmp.plan_skilled_worker_num,
tmp.plan_auxiliary_worker_num,
tmp.plan_sub_car_num,
tmp.create_user,
tmp.create_time,
tmp.actual_working_day
from tb_monthly_plan tmp
left join tb_plan_major tpm on tmp.plan_major_id = tpm.plan_major_id
left join tb_plan_major tpm2 on tmp.plan_major_id = tpm2.plan_major_id
left join tb_plan_major tpm3 on tmp.plan_major_id = tpm3.plan_major_id
where tmp.is_active = '1'
</select>
<select id="getPersonnelArrangementList" resultType="com.bonus.digital.dao.PersonnelArrangementVo">
select personnel_arrangement_id,monthly_plan_id,"day",personnel_names
from tb_personnel_arrangement where monthly_plan_id = #{monthlyPlanId}
</select>
<select id="getMonthlyPlanPerson" resultType="com.bonus.digital.dao.MonthlyPlanVo">
</select>
<select id="getPlanMajorListByMonth" resultType="com.bonus.digital.dao.MonthlyPlanVo">
select tmp.inspection_station_name,
tmp.work_content,
tmp.planned_start_time,
tmp.planned_end_time,
tmp.plan_personnel
from tb_monthly_plan tmp
where tmp.is_active = '1' and tmp.monthly_plan = #{monthlyPlan}
</select>
</mapper>