|
|
@@ -540,43 +540,43 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="selectsignStatisticsList" resultType="com.goafanti.order.bo.OutSignStatistics">
|
|
|
- select x.id, name, counts, totalAmount, newSignNumber, repeatSignNumber, channelSignNumber,
|
|
|
- (newSignNumber/counts)newRatio,(repeatSignNumber/counts)repeatRatio,(newSignNumber/counts)channelRatio
|
|
|
- from( select a.id,a.name ,sum(x.counts)counts ,sum(x.totalAmount)totalAmount,sum(x.newSignNumber)newSignNumber,
|
|
|
- sum(x.repeatSignNumber)repeatSignNumber,sum(x.channelSignNumber)channelSignNumber
|
|
|
+ select a.id, a.name,y.aid, userCount, orderCount, totalAmount, newSignNumber, repeatSignNumber, channelSignNumber,
|
|
|
+ (newSignNumber/orderCount)newRatio,(repeatSignNumber/orderCount)repeatRatio,(newSignNumber/orderCount)channelRatio
|
|
|
from admin a
|
|
|
left join user_role ur on ur.uid =a.id left join `role` r on r.id=ur.rid
|
|
|
- left join ( select b.aid,count(*)counts,sum(a.total_amount) totalAmount ,
|
|
|
+ left join ( select x.aid,count(id) userCount, sum(x.orderCount)orderCount,sum(x.totalAmount)totalAmount,
|
|
|
+ sum(x.newSignNumber)newSignNumber,sum(x.repeatSignNumber)repeatSignNumber,
|
|
|
+ sum(x.channelSignNumber)channelSignNumber
|
|
|
+ from ( select b.aid,b.id,count(*)orderCount ,sum(a.total_amount) totalAmount ,
|
|
|
sum(if(a.sales_type < 3 || (a.sales_type > 3 && a.sales_type < 6),1,0 ))newSignNumber,
|
|
|
- sum(if(a.sales_type=3,1,0 ))repeatSignNumber,sum(if(a.sales_type > 5,1,0 ))channelSignNumber
|
|
|
+ sum(if(a.sales_type=3,1,0 ))channelSignNumber,sum(if(a.sales_type > 5,1,0 ))repeatSignNumber
|
|
|
from t_order_new a left join user b on b.id=a.buyer_id
|
|
|
- where a.process_status <4 and b.share_type =2
|
|
|
- <if test="amountType != null">
|
|
|
- <if test="amountType == 1">
|
|
|
- and a.total_amount < 10
|
|
|
- </if>
|
|
|
- <if test="amountType == 2">
|
|
|
- and a.total_amount BETWEEN 10 and 20
|
|
|
- </if>
|
|
|
- <if test="amountType == 3">
|
|
|
- and a.total_amount BETWEEN 20 and 30
|
|
|
+ where a.process_status >4 and b.share_type =2 and a.delete_sign in(0,2)
|
|
|
+ <if test="amountType != null">
|
|
|
+ <if test="amountType == 1">
|
|
|
+ and a.total_amount < 10
|
|
|
+ </if>
|
|
|
+ <if test="amountType == 2">
|
|
|
+ and a.total_amount BETWEEN 10 and 20
|
|
|
+ </if>
|
|
|
+ <if test="amountType == 3">
|
|
|
+ and a.total_amount BETWEEN 20 and 30
|
|
|
+ </if>
|
|
|
+ <if test="amountType == 4">
|
|
|
+ and a.total_amount > 30
|
|
|
+ </if>
|
|
|
</if>
|
|
|
- <if test="amountType == 4">
|
|
|
- and a.total_amount > 30
|
|
|
+ <if test="signTimeStart != null and signTimeEnd!=null">
|
|
|
+ and a.sign_time BETWEEN #{signTimeStart} and #{signTimeEnd}
|
|
|
</if>
|
|
|
- </if>
|
|
|
- <if test="signTimeStart != null and signTimeEnd!=null">
|
|
|
- and a.sign_time BETWEEN #{signTimeStart} and #{signTimeEnd}
|
|
|
- </if>
|
|
|
- group by b.aid)x on x.aid=a.id
|
|
|
+ group by b.aid,b.id)x group by x.aid)y on y.aid=a.id
|
|
|
where r.role_type in (96,996)
|
|
|
- <if test="aid != null">
|
|
|
- and a.id= #{aid}
|
|
|
- </if>
|
|
|
+ <if test="aid != null">
|
|
|
+ and a.id= #{aid}
|
|
|
+ </if>
|
|
|
<if test="depId != null">
|
|
|
- and a.department_id = #{depId}
|
|
|
+ and a.department_id = #{depId}
|
|
|
</if>
|
|
|
- group by a.id,a.name)x
|
|
|
<if test="page_sql!=null">
|
|
|
${page_sql}
|
|
|
</if>
|
|
|
@@ -594,4 +594,88 @@
|
|
|
</if>
|
|
|
group by a.id,a.name)x
|
|
|
</select>
|
|
|
+
|
|
|
+ <select id="selectsignStatisticsOrderList" resultType="com.goafanti.order.bo.TOrderNewBo">
|
|
|
+ select a.order_no as orderNo,a.create_time as createTime, date_format(a.sign_time,'%Y-%m-%d' ) as signDate,a.delete_sign deleteSign,
|
|
|
+ a.contract_no as contractNo, b.nickname as userName ,a.process_status as processStatus,a.total_amount as totalAmount,
|
|
|
+ a.order_status as orderStatus, a.liquidation_status as liquidationStatus,a.approval,c.salesman_name as salesmanName,c.project_type projectType,
|
|
|
+ dep.name as depName,c.finance_name as financeName,c.invoice_amount invoiceAmount,a.settlement_amount settlementAmount,
|
|
|
+ a.sales_type salesType, a.channel_id channelId ,a.other
|
|
|
+ from t_order_new a left join `user` b on a.buyer_id=b.id left join t_order_mid c on a.order_no=c.order_no
|
|
|
+ left join department dep on a.order_dep=dep.id
|
|
|
+ where a.process_status >4 and b.share_type =2 and a.delete_sign in(0,2)
|
|
|
+ <if test="amountType != null">
|
|
|
+ <if test="amountType == 1">
|
|
|
+ and a.total_amount < 10
|
|
|
+ </if>
|
|
|
+ <if test="amountType == 2">
|
|
|
+ and a.total_amount BETWEEN 10 and 20
|
|
|
+ </if>
|
|
|
+ <if test="amountType == 3">
|
|
|
+ and a.total_amount BETWEEN 20 and 30
|
|
|
+ </if>
|
|
|
+ <if test="amountType == 4">
|
|
|
+ and a.total_amount > 30
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="signTimeStart != null and signTimeEnd!=null">
|
|
|
+ and a.sign_time BETWEEN #{signTimeStart} and #{signTimeEnd}
|
|
|
+ </if>
|
|
|
+ <if test="aid !=null">
|
|
|
+ and b.aid= #{aid}
|
|
|
+ </if>
|
|
|
+ <if test="orderType !=null">
|
|
|
+ <if test="orderType ==1">
|
|
|
+ and(a.sales_type < 3 or (a.sales_type > 3 and a.sales_type < 6))
|
|
|
+ </if>
|
|
|
+ <if test="orderType ==2">
|
|
|
+ and a.sales_type > 5
|
|
|
+ </if>
|
|
|
+ <if test="orderType ==3">
|
|
|
+ and a.sales_type=3
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ order by a.create_time desc
|
|
|
+ <if test="page_sql!=null">
|
|
|
+ ${page_sql}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectsignStatisticsOrderCount" resultType="integer">
|
|
|
+ select count(*)
|
|
|
+ from t_order_new a left join `user` b on a.buyer_id=b.id left join t_order_mid c on a.order_no=c.order_no
|
|
|
+ left join department dep on a.order_dep=dep.id
|
|
|
+ where a.process_status >4 and b.share_type =2 and a.delete_sign in(0,2)
|
|
|
+ <if test="amountType != null">
|
|
|
+ <if test="amountType == 1">
|
|
|
+ and a.total_amount < 10
|
|
|
+ </if>
|
|
|
+ <if test="amountType == 2">
|
|
|
+ and a.total_amount BETWEEN 10 and 20
|
|
|
+ </if>
|
|
|
+ <if test="amountType == 3">
|
|
|
+ and a.total_amount BETWEEN 20 and 30
|
|
|
+ </if>
|
|
|
+ <if test="amountType == 4">
|
|
|
+ and a.total_amount > 30
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="signTimeStart != null and signTimeEnd!=null">
|
|
|
+ and a.sign_time BETWEEN #{signTimeStart} and #{signTimeEnd}
|
|
|
+ </if>
|
|
|
+ <if test="aid !=null">
|
|
|
+ and b.aid= #{aid}
|
|
|
+ </if>
|
|
|
+ <if test="orderType !=null">
|
|
|
+ <if test="orderType ==1">
|
|
|
+ and(a.sales_type < 3 or (a.sales_type > 3 and a.sales_type < 6))
|
|
|
+ </if>
|
|
|
+ <if test="orderType ==2">
|
|
|
+ and a.sales_type > 5
|
|
|
+ </if>
|
|
|
+ <if test="orderType ==3">
|
|
|
+ and a.sales_type=3
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
</mapper>
|