|
|
@@ -2210,10 +2210,43 @@ left join department d on o.order_dep = d.id left join t_order_mid a on o.orde
|
|
|
where b.status=0 and b.aid = #{financeId} and a.process_status = 3
|
|
|
</select>
|
|
|
<select id="selectExpenseCount" resultType="com.goafanti.expenseAccount.bo.ExpenseCountsBo">
|
|
|
- select a.order_no orderNo ,a.contract_no contractNo ,b.buyer_name buyerName
|
|
|
- from t_order_new a left join t_order_mid b on a.order_no =b.order_no
|
|
|
- where a.order_no in
|
|
|
- (select a.order_no from expense_account a where a.target_type =1 group by order_no)
|
|
|
+ select a.order_no orderNo,a.contract_no contractNo,b.buyer_name buyerName,
|
|
|
+ c.expenseCount,c.peopleCount,c.notExamine,c.rejectCount,c.paymentAmount,c.days
|
|
|
+ from t_order_new a left join t_order_mid b on a.order_no =b.order_no left join (select a.order_no,a.expenseCount,b.peopleCount,c.notExamine,
|
|
|
+ c.rejectCount,ifnull(d.paymentAmount,0)paymentAmount,a.days from (select a.order_no,count(a.id)expenseCount,
|
|
|
+ sum(ROUND(a.duration/7.5) )days from expense_account a where a.order_no in (select a.order_no from expense_account a
|
|
|
+ where a.target_type = #{targetType}
|
|
|
+ <if test="startTime !=null and endTime != null">
|
|
|
+ and a.create_time BETWEEN #{startTime} and #{endTime}
|
|
|
+ </if>
|
|
|
+ group by order_no)
|
|
|
+
|
|
|
+ group by order_no )a left join (select order_no,count(aid)peopleCount from (select a.order_no,aid from expense_account a where a.order_no in
|
|
|
+ (select a.order_no from expense_account a where a.target_type = #{targetType}
|
|
|
+ <if test="startTime !=null and endTime != null">
|
|
|
+ and a.create_time BETWEEN #{startTime} and #{endTime}
|
|
|
+ </if>
|
|
|
+ group by order_no)
|
|
|
+ group by order_no,aid )a group by order_no)b on a.order_no=b.order_no left join (select a.order_no,sum(notExamine)notExamine,sum(rejectCount)rejectCount
|
|
|
+ from (select a.order_no,status ,IF(status=1,1,0)notExamine,IF(status=3,1,0)rejectCount
|
|
|
+ from expense_account a where a.order_no in (select a.order_no from expense_account a where a.target_type = #{targetType}
|
|
|
+ <if test="startTime !=null and endTime != null">
|
|
|
+ and a.create_time BETWEEN #{startTime} and #{endTime}
|
|
|
+ </if>
|
|
|
+ group by order_no))a group by order_no)c on a.order_no=c.order_no left join ( select a.order_no ,sum(c.payment_amount) paymentAmount
|
|
|
+ from t_order_new a left join t_order_task b on a.order_no =b.order_no left join t_order_payment c on b.id =c.tid
|
|
|
+ where c.status =3 and a.order_no in (select a.order_no from expense_account a where a.target_type = #{targetType}
|
|
|
+ <if test="startTime !=null and endTime != null">
|
|
|
+ and a.create_time BETWEEN #{startTime} and #{endTime}
|
|
|
+ </if>
|
|
|
+ group by order_no) group by order_no )d on a.order_no=d.order_no)c on a.order_no =c.order_no
|
|
|
+ where a.order_no in (select a.order_no from expense_account a where a.target_type = #{targetType}
|
|
|
+ <if test="startTime !=null and endTime != null">
|
|
|
+ and a.create_time BETWEEN #{startTime} and #{endTime}
|
|
|
+ </if>
|
|
|
+ group by order_no)
|
|
|
+ and a.contract_no like concat('%' ,#{contractNo},'%')
|
|
|
+ and a.order_dep = #{depId}
|
|
|
</select>
|
|
|
|
|
|
</mapper>
|