Browse Source

首页数据接口处理

guq 7 years ago
parent
commit
b7dd209814

+ 10 - 3
applications/commons/commons-server/src/main/resources/mapper/HomePageMapper.xml

@@ -11,9 +11,16 @@
     </select>
 
     <select id="getPurchaseDataNow" parameterType="long" resultType="string">
-        select concat('[',GROUP_CONCAT(concat('{"x":"',ifnull(si_vendname,''),'","y":',IFNULL(round(si_amount/10000,2),0),'}')),']')  from (
-        select * from statsinfo
-        where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(now(),'%Y%m') and si_type='PURC' ORDER BY si_amount desc limit 10) a
+      select concat('[',five,',',other,']') from (
+	      select GROUP_CONCAT(concat('{"x":"',ifnull(si_vendname,''),'","y":',IFNULL(round(si_amount/10000,2),0),'}')) five from (
+        select * from statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(now(),'%Y%m') and si_type='PURC' ORDER BY si_amount desc limit 5) a ) a1,
+      (
+	  select concat('{"x":"其它","y":',ifnull(round((all_sum - five_sum)/10000,2),0),'}') other from (
+		(select sum(si_amount) all_sum from statsinfo  where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(now(),'%Y%m') and si_type='PURC')a,
+        (select sum(si_amount) five_sum from statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(now(),'%Y%m') and si_type='PURC' ORDER BY si_amount desc limit 0,5) b)
+	  ) b1
+
+
     </select>
 
     <select id="getPurchaseDataInSixMonth" parameterType="long" resultType="string">