|
|
@@ -836,6 +836,9 @@
|
|
|
left join t_order_new o on b.order_no =o.order_no left join expense_account c on a.ea_id =c.id
|
|
|
left join admin ad on b.aid=ad.id left join department adDep on ad.department_id=adDep.id
|
|
|
where 1=1 and b.expense_main =1
|
|
|
+ <if test="checkNo !=null">
|
|
|
+ and b.check_no like concat('%',#{checkNo},'%')
|
|
|
+ </if>
|
|
|
<if test=" status != null">
|
|
|
and b.status = #{status}
|
|
|
</if>
|
|
|
@@ -871,6 +874,9 @@
|
|
|
left join admin ad on b.aid=ad.id
|
|
|
left join department adDep on ad .department_id=adDep.id
|
|
|
where 1=1 and b.expense_main =1
|
|
|
+ <if test="checkNo !=null">
|
|
|
+ and b.check_no like concat('%',#{checkNo},'%')
|
|
|
+ </if>
|
|
|
<if test=" status != null">
|
|
|
and b.status = #{status}
|
|
|
</if>
|
|
|
@@ -902,83 +908,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
- <select id="ExpenseDetailsList" resultMap="MainMap">
|
|
|
- select c.id detId,c.`type` sonType,ead.`type` detType,ead.amount ,ead.real_amount ,
|
|
|
- b.id,b.check_no,b.total_amount,b.order_no,o.contract_no,b.aname,b.apply_dep,b.pay_dep,
|
|
|
- date_format(a.create_time,'%Y-%m-%d %H:%i:%S')createTimeStr,b.status,b.process_status,
|
|
|
- dep.name applyDepName,dep2.name payDepName, b.remarks,b.eaaid ,
|
|
|
- c.id sonId,c.total_amount sonAmount,c.`type` ,c.type_other ,c.user_names ,c.release_start ,c.release_end
|
|
|
- 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 c on a.ea_id =c.id
|
|
|
- left join expense_account_details ead on c.id=ead.eaid
|
|
|
- left join admin ad on b.aid=ad.id
|
|
|
- left join department adDep on ad .department_id=adDep.id
|
|
|
- where 1=1 and b.expense_main =1
|
|
|
+ <select id="ExpenseDetailsList" resultType="com.goafanti.expenseAccount.bo.OutExpenseAccountDetailsList">
|
|
|
+ select mea.check_no ,ead.`type`,ead.amount ,ead.real_amount ,o.contract_no ,dep.name applyDepName,
|
|
|
+ dep2.name payDepName ,mea.aname ,ad2.name financeName,mea.status ,mea.process_status ,mea.id mainId,
|
|
|
+ tm.buyer_name buyerName ,date_format(mea.create_time,'%Y-%m-%d %H:%i:%S')createTimeStr
|
|
|
+ from expense_account_details ead left join expense_account a on ead.eaid =a.id
|
|
|
+ left join expense_relationship er on a.id=er.ea_id left join expense_account mea on er.id=mea.id
|
|
|
+ left join t_order_new o on mea.order_no =o.order_no left join t_order_mid tm on o.order_no =tm.order_no
|
|
|
+ left join department dep on mea.apply_dep =dep.id
|
|
|
+ left join department dep2 on mea.pay_dep =dep2.id left join admin ad on mea.aid=ad.id
|
|
|
+ left join department dep3 on ad.department_id =dep3.id left join admin ad2 on dep3.finance_id =ad2.id
|
|
|
+ where 1=1
|
|
|
<if test=" status != null">
|
|
|
- and b.status = #{status}
|
|
|
- </if>
|
|
|
- <if test="listStatus ==0">
|
|
|
- and b.status in(0,1,3)
|
|
|
- </if>
|
|
|
- <if test="listStatus ==1">
|
|
|
- and b.status =2
|
|
|
- </if>
|
|
|
- <if test=" roleType ==0">
|
|
|
- and b.aid = #{aid}
|
|
|
- </if>
|
|
|
- <if test="roleType == 1">
|
|
|
- and b.process_status > 0
|
|
|
- and ad.superior_id= #{aid}
|
|
|
- </if>
|
|
|
- <if test="roleType == 2">
|
|
|
- and b.process_status > 1
|
|
|
- and adDep.finance_id = #{aid}
|
|
|
+ and mea.status = #{status}
|
|
|
</if>
|
|
|
- <if test="roleType == 3">
|
|
|
- and b.process_status > 2
|
|
|
- and ad.department_id in
|
|
|
+ <if test="deps !=null">
|
|
|
+ and ad.department_id in
|
|
|
<foreach collection="deps" item="dep" open="(" close=")" separator=",">
|
|
|
#{dep}
|
|
|
</foreach>
|
|
|
</if>
|
|
|
+ <if test=" contractNo != null">
|
|
|
+ and o.contract_no like concat('%',#{contractNo},'%')
|
|
|
+ </if><if test=" buyerName != null">
|
|
|
+ and tm.buyer_name like concat('%','buyerName','%')
|
|
|
+ </if><if test=" type != null">
|
|
|
+ and ead.`type` = #{type}
|
|
|
+ </if><if test=" aname != null">
|
|
|
+ and mea.aname like concat('%',#{aname},'%')
|
|
|
+ </if><if test=" applyDep != null">
|
|
|
+ and mea.apply_dep =#{applyDep}
|
|
|
+ </if><if test=" payDep != null">
|
|
|
+ and mea.pay_dep =#{payDep}
|
|
|
+ </if><if test=" startTime != null and endTime !=null">
|
|
|
+ and mea.create_time between #{startTime} and #{endTime}
|
|
|
+ </if><if test=" checkNo != null">
|
|
|
+ and mea.check_no like concat('%',#{checkNo},'%')
|
|
|
+ </if>
|
|
|
${page_sql}
|
|
|
</select>
|
|
|
<select id="ExpenseDetailsCount" resultType="java.lang.Integer">
|
|
|
select count(*)
|
|
|
- from expense_account b
|
|
|
- left join admin ad on b.aid=ad.id
|
|
|
- left join department adDep on ad .department_id=adDep.id
|
|
|
- where 1=1 and b.expense_main =1
|
|
|
+ from expense_account_details ead left join expense_account a on ead.eaid =a.id
|
|
|
+ left join expense_relationship er on a.id=er.ea_id left join expense_account mea on er.id=mea.id
|
|
|
+ left join t_order_new o on mea.order_no =o.order_no left join t_order_mid tm on o.order_no =tm.order_no
|
|
|
+ left join department dep on mea.apply_dep =dep.id
|
|
|
+ left join department dep2 on mea.pay_dep =dep2.id left join admin ad on mea.aid=ad.id
|
|
|
+ left join department dep3 on ad.department_id =dep3.id left join admin ad2 on dep3.finance_id =ad2.id
|
|
|
+ where 1=1
|
|
|
<if test=" status != null">
|
|
|
- and b.status = #{status}
|
|
|
- </if>
|
|
|
- <if test="listStatus ==0">
|
|
|
- and b.status in(0,1,3)
|
|
|
- </if>
|
|
|
- <if test="listStatus ==1">
|
|
|
- and b.status =2
|
|
|
+ and mea.status = #{status}
|
|
|
</if>
|
|
|
- <if test=" roleType ==0">
|
|
|
- and b.aid = #{aid}
|
|
|
- </if>
|
|
|
- <if test="roleType == 1">
|
|
|
- and b.process_status > 0
|
|
|
- and ad.superior_id= #{aid}
|
|
|
- </if>
|
|
|
- <if test="roleType == 2">
|
|
|
- and b.process_status > 1
|
|
|
- and adDep.finance_id = #{aid}
|
|
|
- </if>
|
|
|
- <if test="roleType == 3">
|
|
|
- and b.process_status > 2
|
|
|
- and ad.department_id in
|
|
|
+ <if test="deps !=null">
|
|
|
+ and ad.department_id in
|
|
|
<foreach collection="deps" item="dep" open="(" close=")" separator=",">
|
|
|
#{dep}
|
|
|
</foreach>
|
|
|
</if>
|
|
|
+ <if test=" contractNo != null">
|
|
|
+ and o.contract_no like concat('%',#{contractNo},'%')
|
|
|
+ </if><if test=" buyerName != null">
|
|
|
+ and tm.buyer_name like concat('%','buyerName','%')
|
|
|
+ </if><if test=" type != null">
|
|
|
+ and ead.`type` = #{type}
|
|
|
+ </if><if test=" aname != null">
|
|
|
+ and mea.aname like concat('%',#{aname},'%')
|
|
|
+ </if><if test=" applyDep != null">
|
|
|
+ and mea.apply_dep =#{applyDep}
|
|
|
+ </if><if test=" payDep != null">
|
|
|
+ and mea.pay_dep =#{payDep}
|
|
|
+ </if><if test=" startTime != null and endTime !=null">
|
|
|
+ and mea.create_time between #{startTime} and #{endTime}
|
|
|
+ </if><if test=" checkNo != null">
|
|
|
+ and mea.check_no like concat('%',#{checkNo},'%')
|
|
|
+ </if>
|
|
|
</select>
|
|
|
<select id="selectCountByIdsAndType" resultType="java.lang.Integer">
|
|
|
select count(*) from expense_account
|