id, prid, order_no, aid, aname, `type`, type_other, `status`, process_status, total_amount,
attachment_url, apply_dep, pay_dep, eaaid, create_time, district_name, user_names,
release_start, release_end, duration, examine_name, settlement_amount, debit_id,
target_type, liquidation_status, remarks, check_no, expense_main, real_amount, secondary_type,
secondary_type_other
delete from expense_account
where id = #{id,jdbcType=INTEGER}
insert into expense_account (prid, order_no, aid,
aname, `type`, type_other,
`status`, process_status, total_amount,
attachment_url, apply_dep, pay_dep,
eaaid, create_time, district_name,
user_names, release_start, release_end,
duration, examine_name, settlement_amount,
debit_id, target_type, liquidation_status,
remarks, check_no, expense_main,
real_amount, secondary_type, secondary_type_other
)
values (#{prid,jdbcType=INTEGER}, #{orderNo,jdbcType=VARCHAR}, #{aid,jdbcType=VARCHAR},
#{aname,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, #{typeOther,jdbcType=VARCHAR},
#{status,jdbcType=INTEGER}, #{processStatus,jdbcType=INTEGER}, #{totalAmount,jdbcType=DECIMAL},
#{attachmentUrl,jdbcType=VARCHAR}, #{applyDep,jdbcType=VARCHAR}, #{payDep,jdbcType=VARCHAR},
#{eaaid,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{districtName,jdbcType=VARCHAR},
#{userNames,jdbcType=VARCHAR}, #{releaseStart,jdbcType=TIMESTAMP}, #{releaseEnd,jdbcType=TIMESTAMP},
#{duration,jdbcType=DOUBLE}, #{examineName,jdbcType=VARCHAR}, #{settlementAmount,jdbcType=DECIMAL},
#{debitId,jdbcType=INTEGER}, #{targetType,jdbcType=INTEGER}, #{liquidationStatus,jdbcType=INTEGER},
#{remarks,jdbcType=VARCHAR}, #{checkNo,jdbcType=VARCHAR}, #{expenseMain,jdbcType=INTEGER},
#{realAmount,jdbcType=DECIMAL}, #{secondaryType,jdbcType=INTEGER}, #{secondaryTypeOther,jdbcType=VARCHAR}
)
insert into expense_account
prid,
order_no,
aid,
aname,
`type`,
type_other,
`status`,
process_status,
total_amount,
attachment_url,
apply_dep,
pay_dep,
eaaid,
create_time,
district_name,
user_names,
release_start,
release_end,
duration,
examine_name,
settlement_amount,
debit_id,
target_type,
liquidation_status,
remarks,
check_no,
expense_main,
real_amount,
secondary_type,
secondary_type_other,
#{prid,jdbcType=INTEGER},
#{orderNo,jdbcType=VARCHAR},
#{aid,jdbcType=VARCHAR},
#{aname,jdbcType=VARCHAR},
#{type,jdbcType=INTEGER},
#{typeOther,jdbcType=VARCHAR},
#{status,jdbcType=INTEGER},
#{processStatus,jdbcType=INTEGER},
#{totalAmount,jdbcType=DECIMAL},
#{attachmentUrl,jdbcType=VARCHAR},
#{applyDep,jdbcType=VARCHAR},
#{payDep,jdbcType=VARCHAR},
#{eaaid,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP},
#{districtName,jdbcType=VARCHAR},
#{userNames,jdbcType=VARCHAR},
#{releaseStart,jdbcType=TIMESTAMP},
#{releaseEnd,jdbcType=TIMESTAMP},
#{duration,jdbcType=DOUBLE},
#{examineName,jdbcType=VARCHAR},
#{settlementAmount,jdbcType=DECIMAL},
#{debitId,jdbcType=INTEGER},
#{targetType,jdbcType=INTEGER},
#{liquidationStatus,jdbcType=INTEGER},
#{remarks,jdbcType=VARCHAR},
#{checkNo,jdbcType=VARCHAR},
#{expenseMain,jdbcType=INTEGER},
#{realAmount,jdbcType=DECIMAL},
#{secondaryType,jdbcType=INTEGER},
#{secondaryTypeOther,jdbcType=VARCHAR},
update expense_account
prid = #{prid,jdbcType=INTEGER},
order_no = #{orderNo,jdbcType=VARCHAR},
aid = #{aid,jdbcType=VARCHAR},
aname = #{aname,jdbcType=VARCHAR},
`type` = #{type,jdbcType=INTEGER},
type_other = #{typeOther,jdbcType=VARCHAR},
`status` = #{status,jdbcType=INTEGER},
process_status = #{processStatus,jdbcType=INTEGER},
total_amount = #{totalAmount,jdbcType=DECIMAL},
attachment_url = #{attachmentUrl,jdbcType=VARCHAR},
apply_dep = #{applyDep,jdbcType=VARCHAR},
pay_dep = #{payDep,jdbcType=VARCHAR},
eaaid = #{eaaid,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
district_name = #{districtName,jdbcType=VARCHAR},
user_names = #{userNames,jdbcType=VARCHAR},
release_start = #{releaseStart,jdbcType=TIMESTAMP},
release_end = #{releaseEnd,jdbcType=TIMESTAMP},
duration = #{duration,jdbcType=DOUBLE},
examine_name = #{examineName,jdbcType=VARCHAR},
settlement_amount = #{settlementAmount,jdbcType=DECIMAL},
debit_id = #{debitId,jdbcType=INTEGER},
target_type = #{targetType,jdbcType=INTEGER},
liquidation_status = #{liquidationStatus,jdbcType=INTEGER},
remarks = #{remarks,jdbcType=VARCHAR},
check_no = #{checkNo,jdbcType=VARCHAR},
expense_main = #{expenseMain,jdbcType=INTEGER},
real_amount = #{realAmount,jdbcType=DECIMAL},
secondary_type = #{secondaryType,jdbcType=INTEGER},
secondary_type_other = #{secondaryTypeOther,jdbcType=VARCHAR},
where id = #{id,jdbcType=INTEGER}
update expense_account
set prid = #{prid,jdbcType=INTEGER},
order_no = #{orderNo,jdbcType=VARCHAR},
aid = #{aid,jdbcType=VARCHAR},
aname = #{aname,jdbcType=VARCHAR},
`type` = #{type,jdbcType=INTEGER},
type_other = #{typeOther,jdbcType=VARCHAR},
`status` = #{status,jdbcType=INTEGER},
process_status = #{processStatus,jdbcType=INTEGER},
total_amount = #{totalAmount,jdbcType=DECIMAL},
attachment_url = #{attachmentUrl,jdbcType=VARCHAR},
apply_dep = #{applyDep,jdbcType=VARCHAR},
pay_dep = #{payDep,jdbcType=VARCHAR},
eaaid = #{eaaid,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
district_name = #{districtName,jdbcType=VARCHAR},
user_names = #{userNames,jdbcType=VARCHAR},
release_start = #{releaseStart,jdbcType=TIMESTAMP},
release_end = #{releaseEnd,jdbcType=TIMESTAMP},
duration = #{duration,jdbcType=DOUBLE},
examine_name = #{examineName,jdbcType=VARCHAR},
settlement_amount = #{settlementAmount,jdbcType=DECIMAL},
debit_id = #{debitId,jdbcType=INTEGER},
target_type = #{targetType,jdbcType=INTEGER},
liquidation_status = #{liquidationStatus,jdbcType=INTEGER},
remarks = #{remarks,jdbcType=VARCHAR},
check_no = #{checkNo,jdbcType=VARCHAR},
expense_main = #{expenseMain,jdbcType=INTEGER},
real_amount = #{realAmount,jdbcType=DECIMAL},
secondary_type = #{secondaryType,jdbcType=INTEGER},
secondary_type_other = #{secondaryTypeOther,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
a.id, a.prid, a.order_no orderNo, o.contract_no contractNo ,tm.buyer_name buyerName, a.aid, a.aname, a.`type`,
a.type_other typeOther , a.status,a.process_status processStatus,a.total_amount totalAmount,a.debit_id debitId,
a.attachment_url attachmentUrl,a.apply_dep applyDep, a.pay_dep payDep, a.eaaid,a.district_name districtName,
a.user_names userNames,a.create_time, a.release_start,a.release_end, a.duration,b.name applyDepName,
c.name payDepName,d.name ,d.bank ,d.accounts ,a.settlement_amount settlementAmount,a.secondary_type secondaryType,
a.liquidation_status liquidationStatus, a.remarks,a.check_no checkNo,a.secondary_type_other secondaryTypeOther,
date_format(a.create_time,'%Y-%m-%d %H:%i:%S')createTimeStr,
date_format(a.release_start,'%Y-%m-%d %H:%i:%S')releaseStartStr,
date_format(a.release_end,'%Y-%m-%d %H:%i:%S')releaseEndStr
FROM expense_account a left join department b on a.apply_dep =b.id left join department c on a.pay_dep =c.id
left join expense_account_private d on a.eaaid=d.id left join t_order_new o on a.order_no =o.order_no
left join t_order_mid tm on a.order_no =tm.order_no
and a.process_status>=0
and a.status=1
and a.status=2
and a.aid= #{aid}
and a.process_status>0
and a.process_status =eae.`type`
and a.process_status >eae.`type`
and f.finance_id in (select id from admin where superior_id = #{auditor})
and a.status= #{status}
and mea.check_no like concat('%',#{checkNo},'%')
and a.check_no like concat('%',#{checkNo},'%')
and a.user_names like concat('%',#{username},'%')
and a.create_time between #{startTime} and #{endTime}
and d.department_id = #{depId}
and e.contract_no like concat('%',#{contractNo},'%')
and a.apply_dep = #{applyDep}
and a.pay_dep = #{payDep}
and a.expense_main= #{expenseMain}
and a.secondary_type= #{secondaryType}
select b.id,b.check_no,b.total_amount,b.order_no,o.contract_no,b.aname,b.apply_dep,b.pay_dep,b.real_amount,b.type_other ,
date_format(b.create_time,'%Y-%m-%d %H:%i:%S')createTimeStr,b.examine_name, dep.name applyDepName,dep2.name payDepName,
b.remarks,b.eaaid ,eap.name ,eap.bank ,eap.accounts ,b.status,b.process_status,
c.id sonId,c.total_amount sonAmount,c.`type` sonType,c.type_other sonTypeOther,c.user_names ,c.release_start ,c.release_end ,
c.district_name districtName,c.user_names userNames,c.secondary_type ,c.secondary_type_other,c.attachment_url,
c.duration,pr.plan,pro.contract_no sonContractNo,c.real_amount sonRealAmount,
d.id detId,d.`type` detType,d.amount,d.real_amount detRealAmount ,d.start_district ,d.end_district,d.vehicle,d.vehicle_other,
d.pay_type ,d.invoice_type ,d.invoice_no,d.payer_name ,d.open_bank ,d.bank_accounts ,d.open_bank_address,d.type_other detTypeOther,
date_format(d.start_time,'%Y-%m-%d %H:%i:%S')startTime,date_format(d.end_time,'%Y-%m-%d %H:%i:%S')endTime,
date_format(d.agree_time,'%Y-%m-%d')agreeTime
from expense_relationship a left join expense_account b on a.id =b.id
left join department dep on b.apply_dep =dep.id left join department dep2 on b.pay_dep =dep2.id
left join t_order_new o on b.order_no =o.order_no left join expense_account_private eap on b.eaaid =eap.id
left join expense_account c on a.ea_id =c.id left join expense_account_details d on c.id =d.eaid
left join public_release pr on c.prid=pr.id left join t_order_new pro on pr.order_no=pro.order_no
update expense_account
set status= #{status}
where id in
#{item.id}
update expense_relationship a ,expense_account b
set b.status= #{status}
where a.id= #{id} and a.ea_id=b.id
update expense_account x ,(select b.id,sum(c.real_amount) amount
from expense_account_details a left join expense_account b on a.eaid =b.id
left join expense_account_details c on b.id =c.eaid
where a.id= #{id} group by b.id)y
set x.real_amount =y.amount
where x.id=y.id;
update expense_account x ,( select a.id,sum(c.real_amount)amount
from expense_account a left join expense_relationship b on a.id=b.id
left join expense_account c on b.ea_id =c.id
where a.id in(select c.id
from expense_account_details a left join expense_account b on a.eaid =b.id
left join expense_relationship c on b.id =c.ea_id
where a.id= #{id}) group by a.id)y
set x.real_amount =y.amount
where x.id=y.id
and b.check_no like concat('%',#{checkNo},'%')
and b.status = #{status}
and b.aid = #{aid}
and b.process_status =1
and b.process_status > 1
and ad.superior_id= #{aid}
and b.process_status =2
and b.process_status > 2
and adDep.finance_id = #{aid}
and b.process_status =3
and b.process_status > 3
and ad.department_id in
#{dep}
and b.process_status =4 and b.status=1
and b.process_status =5 and b.status=2
and adDep.finance_id in (select id from admin where superior_id = #{aid})
and mea.status = #{status}
and ad.department_id in
#{dep}
and dep3.finance_id = #{aid}
and dep3.finance_id in (select id from admin where superior_id = #{aid})
and o.contract_no like concat('%',#{contractNo},'%')
and tm.buyer_name like concat('%','buyerName','%')
and ead.`type` = #{type}
and mea.aname like concat('%',#{aname},'%')
and mea.apply_dep =#{applyDep}
and mea.pay_dep =#{payDep}
and mea.create_time between #{startTime} and #{endTime}
and mea.check_no like concat('%',#{checkNo},'%')