insert into business_account_detail(
detail_type,amount,operate,order_id,obj_id,detail_id,acct_id,rel_acct_id,remark,b_id,obj_type
) values (
#{detailType},#{amount},#{operate},#{orderId},#{objId},#{detailId},#{acctId},#{relAcctId},#{remark},#{bId},#{objType}
)
insert into account_detail(
detail_type,amount,order_id,obj_id,detail_id,acct_id,rel_acct_id,remark,status_cd,b_id,obj_type
) select
t.detail_type,t.amount,t.order_id,t.obj_id,t.detail_id,t.acct_id,t.rel_acct_id,t.remark,'0',t.b_id,t.obj_type
from business_account_detail t where 1=1
and t.detail_type= #{detailType}
and t.amount= #{amount}
and t.operate= 'ADD'
and t.order_id= #{orderId}
and t.obj_id= #{objId}
and t.detail_id= #{detailId}
and t.acct_id= #{acctId}
and t.rel_acct_id= #{relAcctId}
and t.remark= #{remark}
and t.b_id= #{bId}
and t.obj_type= #{objType}
update account_detail t set t.status_cd = #{statusCd}
,t.b_id = #{newBId}
, t.detail_type= #{detailType}
, t.amount= #{amount}
, t.order_id= #{orderId}
, t.obj_id= #{objId}
, t.acct_id= #{acctId}
, t.rel_acct_id= #{relAcctId}
, t.remark= #{remark}
, t.obj_type= #{objType}
where 1=1
and t.detail_id= #{detailId}
and t.b_id= #{bId}
insert into account_detail(
detail_type,amount,order_id,obj_id,detail_id,acct_id,rel_acct_id,remark,b_id,obj_type
) values (
#{detailType},#{amount},#{orderId},#{objId},#{detailId},#{acctId},#{relAcctId},#{remark},'-1',#{objType}
)