Просмотр исходного кода

各接口操作数据同步到客户统计表

anderx лет назад: 3
Родитель
Сommit
3979891f6b
1 измененных файлов с 21 добавлено и 4 удалено
  1. 21 4
      src/main/java/com/goafanti/common/mapper/UserMidMapper.xml

+ 21 - 4
src/main/java/com/goafanti/common/mapper/UserMidMapper.xml

@@ -554,7 +554,7 @@
   </select>
   </select>
 
 
   <select id="selectsignStatisticsList" resultType="com.goafanti.order.bo.OutSignStatistics">
   <select id="selectsignStatisticsList" resultType="com.goafanti.order.bo.OutSignStatistics">
-    select a.id, a.name,y.aid, userCount, orderCount, totalAmount, newSignNumber, repeatSignNumber, channelSignNumber,
+    select a.id, a.name,  userCount, orderCount, totalAmount, newSignNumber, repeatSignNumber, channelSignNumber,
     (newSignNumber/orderCount)newRatio,(repeatSignNumber/orderCount)repeatRatio,(newSignNumber/orderCount)channelRatio
     (newSignNumber/orderCount)newRatio,(repeatSignNumber/orderCount)repeatRatio,(newSignNumber/orderCount)channelRatio
     from  admin a
     from  admin a
     left join user_role ur on ur.uid =a.id left join `role` r on r.id=ur.rid
     left join user_role ur on ur.uid =a.id left join `role` r on r.id=ur.rid
@@ -579,7 +579,7 @@
     </if>
     </if>
     <if test="amountType != null">
     <if test="amountType != null">
       <if test="amountType == 1">
       <if test="amountType == 1">
-        and  totalAmount &lt; 10
+        and  ( totalAmount &lt; 10 or totalAmount is null)
       </if>
       </if>
       <if test="amountType == 2">
       <if test="amountType == 2">
         and  totalAmount BETWEEN 10 and 20
         and  totalAmount BETWEEN 10 and 20
@@ -597,8 +597,12 @@
   </select>
   </select>
 
 
   <select id="selectsignStatisticsCount" resultType="integer">
   <select id="selectsignStatisticsCount" resultType="integer">
-    select count(*)from (select a.id,a.name
+    select count(*)
     from  admin a left join user_role ur on ur.uid =a.id left join `role` r on r.id=ur.rid
     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,sum(a.total_amount) totalAmount
+    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 and a.delete_sign in(0,2)
+    group by b.aid)x on a.id=x.aid
     where r.role_type in (96,996)
     where r.role_type in (96,996)
     <if test="aid != null">
     <if test="aid != null">
       and a.id= #{aid}
       and a.id= #{aid}
@@ -606,7 +610,20 @@
     <if test="depId != null">
     <if test="depId != null">
       and a.department_id = #{depId}
       and a.department_id = #{depId}
     </if>
     </if>
-    group by a.id,a.name)x
+    <if test="amountType != null">
+      <if test="amountType == 1">
+        and ( totalAmount &lt; 10 or totalAmount is null)
+      </if>
+      <if test="amountType == 2">
+        and  totalAmount BETWEEN 10 and 20
+      </if>
+      <if test="amountType == 3">
+        and  totalAmount BETWEEN 20 and 30
+      </if>
+      <if test="amountType == 4">
+        and  totalAmount &gt; 30
+      </if>
+    </if>
   </select>
   </select>
 
 
   <select id="selectsignStatisticsOrderList" resultType="com.goafanti.order.bo.TOrderNewBo">
   <select id="selectsignStatisticsOrderList" resultType="com.goafanti.order.bo.TOrderNewBo">