|
|
@ -46,6 +46,44 @@ |
|
|
|
<result property="checkAmt" column="check_amt"/> |
|
|
|
</resultMap> |
|
|
|
|
|
|
|
<select id="queryForecastRoiCostItems" resultType="com.qs.serve.modules.bir.entity.vo.BirRoiCostItemVo" resultMap="BirRoiCostItemVoMap"> |
|
|
|
SELECT |
|
|
|
key_num AS `year_month`, |
|
|
|
min( start_date ) AS year_month_date, |
|
|
|
sum(bir_base_activity.pre_act_quantity) as cost_amt, |
|
|
|
sum(bir_base_activity.verification_amt) as check_amt |
|
|
|
FROM |
|
|
|
`bir_base_activity` left join `tbs_cost_apply` on `bir_base_activity`.cost_apply_id = `tbs_cost_apply`.id |
|
|
|
<where> |
|
|
|
tbs_cost_apply.charge_state in (1,2) |
|
|
|
and bir_base_activity.key_num >= #{query.startMonthNum} |
|
|
|
and bir_base_activity.key_num <= #{query.endMonthNum} |
|
|
|
<if test="query.supplierId!=null and query.supplierId!=''"> |
|
|
|
and bir_base_activity.supplier_id = #{query.supplierId} |
|
|
|
</if> |
|
|
|
<if test="query.userId!=null and query.userId!=''"> |
|
|
|
and bir_base_activity.supplier_id != #{query.notSupplierId} |
|
|
|
and bir_base_activity.user_id = #{query.userId} |
|
|
|
</if> |
|
|
|
<if test="query.supplierIds!=null and query.supplierIds.size > 0"> |
|
|
|
and bir_base_activity.supplier_id in |
|
|
|
<foreach collection="query.supplierIds" item ="selectId" index="i" open="(" close=")" separator=","> |
|
|
|
#{selectId} |
|
|
|
</foreach> |
|
|
|
</if> |
|
|
|
<if test="query.userIds!=null and query.userIds.size > 0"> |
|
|
|
and bir_base_activity.user_id in |
|
|
|
<foreach collection="query.userIds" item ="selectId" index="i" open="(" close=")" separator=","> |
|
|
|
#{selectId} |
|
|
|
</foreach> |
|
|
|
</if> |
|
|
|
</where> |
|
|
|
GROUP BY |
|
|
|
`year_month` |
|
|
|
ORDER BY |
|
|
|
`year_month` desc |
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
|
|
<select id="queryRoiCostItems" resultType="com.qs.serve.modules.bir.entity.vo.BirRoiCostItemVo" resultMap="BirRoiCostItemVoMap"> |
|
|
|
SELECT |
|
|
@ -54,25 +92,26 @@ |
|
|
|
sum(bir_base_activity.activity_total_amt) as cost_amt, |
|
|
|
sum(bir_base_activity.verification_amt) as check_amt |
|
|
|
FROM |
|
|
|
`bir_base_activity` |
|
|
|
`bir_base_activity` left join `tbs_cost_apply` on `bir_base_activity`.cost_apply_id = `tbs_cost_apply`.id |
|
|
|
<where> |
|
|
|
tbs_cost_apply.charge_state = 3 |
|
|
|
and bir_base_activity.key_num >= #{query.startMonthNum} |
|
|
|
and bir_base_activity.key_num <= #{query.endMonthNum} |
|
|
|
<if test="query.supplierId!=null and query.supplierId!=''"> |
|
|
|
and supplier_id = #{query.supplierId} |
|
|
|
and bir_base_activity.supplier_id = #{query.supplierId} |
|
|
|
</if> |
|
|
|
<if test="query.userId!=null and query.userId!=''"> |
|
|
|
and supplier_id != #{query.notSupplierId} |
|
|
|
and user_id = #{query.userId} |
|
|
|
and bir_base_activity.supplier_id != #{query.notSupplierId} |
|
|
|
and bir_base_activity.user_id = #{query.userId} |
|
|
|
</if> |
|
|
|
<if test="query.supplierIds!=null and query.supplierIds.size > 0"> |
|
|
|
and supplier_id in |
|
|
|
and bir_base_activity.supplier_id in |
|
|
|
<foreach collection="query.supplierIds" item ="selectId" index="i" open="(" close=")" separator=","> |
|
|
|
#{selectId} |
|
|
|
</foreach> |
|
|
|
</if> |
|
|
|
<if test="query.userIds!=null and query.userIds.size > 0"> |
|
|
|
and user_id in |
|
|
|
and bir_base_activity.user_id in |
|
|
|
<foreach collection="query.userIds" item ="selectId" index="i" open="(" close=")" separator=","> |
|
|
|
#{selectId} |
|
|
|
</foreach> |
|
|
|