insert into business_junk_requirement(
publish_user_name,publish_user_id,junk_requirement_id,classification,reference_price,operate,type_cd,publish_user_link,context,state,community_id,b_id
) values (
#{publishUserName},#{publishUserId},#{junkRequirementId},#{classification},#{referencePrice},#{operate},#{typeCd},#{publishUserLink},#{context},#{state},#{communityId},#{bId}
)
insert into junk_requirement(
publish_user_name,publish_user_id,status_cd,junk_requirement_id,classification,reference_price,type_cd,publish_user_link,context,state,community_id,b_id
) select
t.publish_user_name,t.publish_user_id,'0',t.junk_requirement_id,t.classification,t.reference_price,t.type_cd,t.publish_user_link,t.context,t.state,t.community_id,t.b_id
from business_junk_requirement t where 1=1
and t.publish_user_name= #{publishUserName}
and t.publish_user_id= #{publishUserId}
and t.junk_requirement_id= #{junkRequirementId}
and t.classification= #{classification}
and t.reference_price= #{referencePrice}
and t.operate= 'ADD'
and t.type_cd= #{typeCd}
and t.publish_user_link= #{publishUserLink}
and t.context= #{context}
and t.state= #{state}
and t.community_id= #{communityId}
and t.b_id= #{bId}
update junk_requirement t set t.status_cd = #{statusCd}
,t.b_id = #{newBId}
, t.publish_user_name= #{publishUserName}
, t.publish_user_id= #{publishUserId}
, t.classification= #{classification}
, t.reference_price= #{referencePrice}
, t.type_cd= #{typeCd}
, t.publish_user_link= #{publishUserLink}
, t.context= #{context}
, t.state= #{state}
, t.community_id= #{communityId}
where 1=1
and t.junk_requirement_id= #{junkRequirementId}
and t.b_id= #{bId}