|
|
@@ -0,0 +1,62 @@
|
|
|
+<?xml version="1.0" encoding="UTF-8" ?>
|
|
|
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
|
|
+<mapper namespace="com.usoftchina.saas.commons.mapper.HomePageMapper" >
|
|
|
+ <parameterMap id="sp_livedata" type="java.util.Map">
|
|
|
+ <parameter property="componyid" mode="IN" />
|
|
|
+ <parameter property="res" jdbcType="VARCHAR" mode="OUT" />
|
|
|
+ </parameterMap>
|
|
|
+
|
|
|
+ <select id="getLiveData" parameterMap="sp_livedata" statementType="CALLABLE">
|
|
|
+ CALL SP_LIVEDATA(?,?)
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getPurchaseDataNow" parameterType="long" resultType="string">
|
|
|
+ select concat('{',GROUP_CONCAT(concat('"',si_vendname,'":',IFNULL(si_amount,0))),'}') from statsinfo
|
|
|
+ where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(now(),'%Y%m') and si_type='PURC' ORDER BY si_amount desc
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getPurchaseDataInSixMonth" parameterType="long" resultType="string">
|
|
|
+ select concat('{',d1,',',d2,',',d3,',',d4,',',d5,',',d6,'}') from (
|
|
|
+(select concat('"',DATE_FORMAT(now(),'%Y%m'),'":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0')) d1 from statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(now(),'%Y%m') and si_type='PURC' ORDER BY si_amount desc) data_1,
|
|
|
+
|
|
|
+(select concat('"',DATE_FORMAT(date_sub(now(),interval 1 MONTH),'%Y%m'),'":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0')) d2 from statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 1 MONTH),'%Y%m') and si_type='PURC' ORDER BY si_amount desc)data_2,
|
|
|
+
|
|
|
+
|
|
|
+(select concat('"',DATE_FORMAT(date_sub(now(),interval 2 MONTH),'%Y%m'),'":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0')) d3 from statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 2 MONTH),'%Y%m') and si_type='PURC' ORDER BY si_amount desc)data_3,
|
|
|
+
|
|
|
+
|
|
|
+(select concat('"',DATE_FORMAT(date_sub(now(),interval 3 MONTH),'%Y%m'),'":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0')) d4 from statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 3 MONTH),'%Y%m') and si_type='PURC' ORDER BY si_amount desc) data_4,
|
|
|
+
|
|
|
+
|
|
|
+(select concat('"',DATE_FORMAT(date_sub(now(),interval 4 MONTH),'%Y%m'),'":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0')) d5 from statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 4 MONTH),'%Y%m') and si_type='PURC' ORDER BY si_amount desc)data_5,
|
|
|
+
|
|
|
+(select concat('"',DATE_FORMAT(date_sub(now(),interval 5 MONTH),'%Y%m'),'":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0')) d6 from statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 5 MONTH),'%Y%m') and si_type='PURC' ORDER BY si_amount desc)data_6)
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+ <select id="getStorageData" parameterType="long" resultType="string">
|
|
|
+ select concat('{',d1,',',d2,',',d3,',',d4,',',d5,',',d6,'}') from (
|
|
|
+
|
|
|
+(select concat('"',DATE_FORMAT(now(),'%Y%m'),'":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0')) d1 from statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(now(),'%Y%m') and si_type='STOCK' ORDER BY si_amount desc) data_1,
|
|
|
+
|
|
|
+(select concat('"',DATE_FORMAT(date_sub(now(),interval 1 MONTH),'%Y%m'),'":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0')) d2 from statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 1 MONTH),'%Y%m') and si_type='STOCK' ORDER BY si_amount desc)data_2,
|
|
|
+
|
|
|
+
|
|
|
+(select concat('"',DATE_FORMAT(date_sub(now(),interval 2 MONTH),'%Y%m'),'":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0')) d3 from statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 2 MONTH),'%Y%m') and si_type='STOCK' ORDER BY si_amount desc)data_3,
|
|
|
+
|
|
|
+
|
|
|
+(select concat('"',DATE_FORMAT(date_sub(now(),interval 3 MONTH),'%Y%m'),'":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0')) d4 from statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 3 MONTH),'%Y%m') and si_type='STOCK' ORDER BY si_amount desc) data_4,
|
|
|
+
|
|
|
+
|
|
|
+(select concat('"',DATE_FORMAT(date_sub(now(),interval 4 MONTH),'%Y%m'),'":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0')) d5 from statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 4 MONTH),'%Y%m') and si_type='STOCK' ORDER BY si_amount desc)data_5,
|
|
|
+
|
|
|
+(select concat('"',DATE_FORMAT(date_sub(now(),interval 5 MONTH),'%Y%m'),'":',ifnull(ROUND(sum((ifnull(si_amount,0))),2),'0')) d6 from statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(date_sub(now(),interval 5 MONTH),'%Y%m') and si_type='STOCK' ORDER BY si_amount desc)data_6);
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+ <select id="getPayAndRecData" parameterType="long" resultType="string">
|
|
|
+ select concat('{"支出":',ifnull(si_amount_pay,'0'),',"收入":',ifnull(si_amount_rec,'0'),'}') from statsinfo where companyid=#{componyId} and si_yearmonth=DATE_FORMAT(now(),'%Y%m') and si_type='FUND'
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+</mapper>
|