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

115 lines
4.8 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.PlanManagementMapper">
<insert id="addPlanManagement">
insert into tb_plan_management (plan_management_month,project_name,work_content,inspection_station_id,
stare_date,end_date,risk_level,remark,create_user,create_time)
values (#{planManagementMonth},#{projectName},#{workContent},#{inspectionStationId},
#{stareDate}, #{endDate},#{riskLevel},#{remark},#{createUser},#{createTime})
</insert>
<update id="updatePlanManagement">
update tb_plan_management
<trim prefix="set" suffixOverrides=",">
<if test="planManagementMonth!= null " >
plan_management_month=#{planManagementMonth},
</if>
<if test="projectName!= null " >
project_name=#{projectName},
</if>
<if test="workContent!= null " >
work_content=#{workContent},
</if>
<if test="inspectionStationId!= null " >
inspection_station_id=#{inspectionStationId},
</if>
<if test="stareDate!= null " >
stare_date=#{stareDate},
</if>
<if test="endDate!= null " >
end_date=#{endDate},
</if>
<if test="riskLevel!= null " >
risk_level=#{riskLevel},
</if>
<if test="updateUser!= null " >
update_user=#{updateUser},
</if>
<if test="updateTime!= null " >
update_time=#{updateTime},
</if>
<if test="remark!= null " >
remark=#{remark},
</if>
</trim>
where plan_management_id = #{planManagementId}
</update>
<delete id="delPlanManagement">
update tb_plan_management set is_active ='0' where plan_management_id = #{planManagementId}
</delete>
<select id="getPlanManagementList" resultType="com.bonus.digital.dao.PlanManagementVo">
select tpm.plan_management_id,
tpm.plan_management_month,
tpm.project_name,
tpm.work_content,
tpm.inspection_station_id,
tis2.inspection_station_name as inspectionStationName,
tpm.stare_date,
tpm.end_date,
tpm.risk_level,
tpm.remark,
tpm.create_user
from tb_plan_management tpm
left join tb_inspection_station tis2 on tpm.inspection_station_id = tis2.inspection_station_id
where tpm.is_active = '1'
<if test="planManagementMonth!= null " >
and tpm.plan_management_month=#{planManagementMonth}
</if>
<if test="inspectionStationId!= null " >
and tpm.inspection_station_id=#{inspectionStationId}
</if>
<if test="riskLevel!= null " >
and tpm.risk_level=#{riskLevel}
</if>
<if test="keyWord!= null " >
AND (tpm.project_name like concat('%', #{keyWord}, '%')
or tpm.work_content like concat('%', #{keyWord}, '%'))
</if>
</select>
<select id="getMonthPlanByPlanId" 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,
tpm.plan_major_name as planMajorName,
tmp.business_type_id,
tpm2.plan_major_name as businessTypeName,
tmp.project_name,
tmp.work_content,
tmp.plan_category_id,
tpm3.plan_major_name as planCategoryName,
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_skilled_worker_day,
tmp.plan_auxiliary_worker_num,
tmp.plan_auxiliary_worker_day,
tmp.plan_sub_car_num,
tmp.create_user,
tmp.create_time,
tmp.risk_level,
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.business_type_id = tpm2.plan_major_id
left join tb_plan_major tpm3 on tmp.plan_category_id = tpm3.plan_major_id
where tmp.plan_management_id = #{planManagementId} and tmp.is_active = '1'
</select>
</mapper>