Procházet zdrojové kódy

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

anderx před 3 roky
rodič
revize
3979891f6b

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

@@ -554,7 +554,7 @@
   </select>
 
   <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
     from  admin a
     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 test="amountType != null">
       <if test="amountType == 1">
-        and  totalAmount &lt; 10
+        and  ( totalAmount &lt; 10 or totalAmount is null)
       </if>
       <if test="amountType == 2">
         and  totalAmount BETWEEN 10 and 20
@@ -597,8 +597,12 @@
   </select>
 
   <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
+    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)
     <if test="aid != null">
       and a.id= #{aid}
@@ -606,7 +610,20 @@
     <if test="depId != null">
       and a.department_id = #{depId}
     </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 id="selectsignStatisticsOrderList" resultType="com.goafanti.order.bo.TOrderNewBo">