insert into business_inspection_plan
(inspection_plan_name,
inspection_route_id,
inspection_plan_period,
remark,
end_time,
start_date,
end_date,
inspection_month,
inspection_day,
inspection_workday,
can_reexamine,
operate,
sign_type,
start_time,
inspection_plan_id,
state,
community_id,
b_id,
create_user_id,
create_user_name)
values (#{inspectionPlanName}, #{inspectionRouteId}, #{inspectionPlanPeriod}, #{remark},
#{endTime}, #{startDate}, #{endDate}, #{inspectionMonth}, #{inspectionDay}, #{inspectionWorkday},
#{canReexamine}, #{operate}, #{signType}, #{startTime},
#{inspectionPlanId}, #{state}, #{communityId}, #{bId}, #{createUserId},
#{createUserName})
insert into
inspection_plan(
inspection_plan_name,inspection_route_id,
inspection_plan_period,remark,status_cd,end_time,
sign_type,start_time,create_user_id,create_user_name,
inspection_plan_id,state,community_id,b_id
) select
t.inspection_plan_name,t.inspection_route_id,t.inspection_plan_period,t.remark,'0',
t.end_time,t.sign_type,t.start_time,t.create_user_id,t.create_user_name,
t.inspection_plan_id,t.state,
t.community_id,t.b_id
from business_inspection_plan t where 1=1
and t.inspection_plan_name= #{inspectionPlanName}
and t.inspection_route_id= #{inspectionRouteId}
and t.inspection_plan_period= #{inspectionPlanPeriod}
and t.remark= #{remark}
and t.end_time= #{endTime}
and t.operate= 'ADD'
and t.sign_type= #{signType}
and t.start_time= #{startTime}
and t.create_user= #{createUser}
and t.inspection_plan_id= #{inspectionPlanId}
and t.state= #{state}
and t.community_id= #{communityId}
and t.b_id= #{bId}
update inspection_plan t set t.status_cd = #{statusCd}
,t.b_id = #{newBId}
, t.inspection_plan_name= #{inspectionPlanName}
, t.inspection_route_id= #{inspectionRouteId}
, t.inspection_plan_period= #{inspectionPlanPeriod}
, t.remark= #{remark}
, t.end_time= #{endTime}
, t.sign_type= #{signType}
, t.can_reexamine= #{canReexamine}
, t.start_time= #{startTime}
, t.state= #{state}
, t.community_id= #{communityId}
where 1=1
and t.inspection_plan_id= #{inspectionPlanId}
and t.b_id= #{bId}