insert into business_apply_room_discount_record(
ardr_id,ard_id,create_user_id,create_user_name,remark,b_id,community_id,is_true,state
) values (
#{ardrId},#{ardId},#{createUserId},#{createUserName},#{remark},#{bId},#{communityId},#{isTrue},#{state}
)
insert into apply_room_discount_record(
ardr_id,ard_id,create_user_id,create_user_name,remark,b_id,community_id,is_true,state,status_cd
) values (
#{ardrId},#{ardId},#{createUserId},#{createUserName},#{remark},#{bId},#{communityId},#{isTrue},#{state},#{statusCd}
)
insert into apply_room_discount_record(
ardr_id,ard_id,create_user_id,create_user_name,status_cd,remark,b_id,community_id,is_true,state
) select
t.ardr_id,t.ard_id,t.create_user_id,t.create_user_name,'0',t.remark,t.b_id,t.community_id,t.is_true,t.state
from
business_apply_room_discount_record t where 1=1
and t.ardr_id= #{ardrId}
and t.ard_id= #{ardId}
and t.create_user_id= #{createUserId}
and t.create_user_name= #{createUserName}
and t.remark= #{remark}
and t.b_id= #{bId}
and t.community_id= #{communityId}
and t.is_true= #{isTrue}
and t.state= #{state}
update apply_room_discount_record t set t.status_cd = #{statusCd}
,t.b_id = #{newBId}
, t.ard_id= #{ardId}
, t.create_user_id= #{createUserId}
, t.create_user_name= #{createUserName}
, t.remark= #{remark}
, t.community_id= #{communityId}
, t.is_true= #{isTrue}
, t.state= #{state}
where 1=1
and t.ardr_id= #{ardrId}
and t.b_id= #{bId}