edit | blame | history | raw

moneyEchart

 SELECT IFNULL(SUM(b.money),0) as moneyCount, IFNULL(SUM(b.weight),0) as weightCount FROM xzx_order_info a
    LEFT JOIN xzx_order_detail_info c ON a.order_id = c.order_id
    LEFT JOIN xzx_order_item_info b ON a.order_id=b.order_id
    WHERE a.order_type=1 AND a.order_status in (4,5,7)
    @if(!isEmpty(startTime)){
        AND c.complete_time BETWEEN #startTime# AND #endTime#
    @}

storageEchart

SELECT IFNULL(SUM(b.money),0) as storageMoneyCount, IFNULL(SUM(b.weight),0) as storageWeightCount,
a.sys_storage_id as sysStorageId FROM 
xzx_order_storage_info a 
LEFT JOIN xzx_order_storage_detail b ON a.storage_id = b.storage_id AND b.flag=1
@if(!isEmpty(startTime)){
    AND a.storage_time BETWEEN #startTime# AND #endTime#
@}
GROUP BY a.sys_storage_id;

orderEchart

SELECT IFNULL(COUNT(a.order_id),0) AS orderCount 
FROM xzx_order_info a,xzx_order_detail_info b  
WHERE a.order_type=1 AND a.order_status in (4,5,7) 
  AND a.order_id = b.order_id 
    @if(!isEmpty(startTime)){
        AND IFNULL(b.complete_time,a.create_time) BETWEEN #startTime# AND #endTime#
    @}

orderEchartTemp

 SELECT IFNULL(COUNT(*),0) as orderCount FROM xzx_order_info a WHERE a.order_type=1 AND a.order_status in (4,5) 
    @if(!isEmpty(startTime)){
        AND a.create_time BETWEEN #startTime# AND #endTime#
    @}         

userEchart

SELECT IFNULL(COUNT(*),0) as userCount FROM (
    SELECT * FROM xzx_user_info a WHERE del_flag=0
    @if(!isEmpty(startTime)){
        AND a.regist_time BETWEEN #startTime# AND #endTime#
    @}
     GROUP BY a.mobile_phone
) x

insertEchart

INSERT INTO `xzx_charts_data`(`money_by_order`, `weight_by_order`, `order_sum`, `money_by_storage`, `weight_by_storage`, `user_sum`, `visit_sum`, `create_time`, `date_hours`, `sys_storage_id`) 
VALUES 
(#moneyCount#, #weightCount#, #orderCount#, #storageMoneyCount#, #storageWeightCount#, #userCount#, #visitCount#, #createTime#, #dateHours#, #sysStorageId#);

queryOrderDayCount

select ifnull(count(order_id),0) from xzx_order_info 
where del_flag=0
@if(!isEmpty(startTime)){
    and a.create_time BETWEEN #startTime# AND #endTime#
@}
and order_status in ('1','2','3','4','5','7')

queryData

SELECT SUM(a.money_by_storage) as storageMoneyCount, 
        (SELECT visit_sum FROM xzx_charts_data
            @if(!isEmpty(startTime)){
                 WHERE a.create_time BETWEEN #startTime# AND #endTime#
            @}
            GROUP BY create_time DESC LIMIT 1
        ) as visitCount, 
        SUM(a.user_sum) as userCount, 
        SUM(a.order_sum) as orderCount, 
        SUM(a.weight_by_storage) as storageWeightCount,
        SUM(a.money_by_order) as moneyCount, 
        SUM(a.weight_by_order) as weightCount
FROM xzx_charts_data a 
@if(!isEmpty(startTime)){
    WHERE a.create_time BETWEEN #startTime# AND #endTime#
@}

queryUserDayCount

SELECT DATE_FORMAT(login_time, '%Y-%m-%d') AS dateHours,IFNULL(count(user_id),0) AS visitCount
  FROM xzx_user_login_info 
 WHERE login_time IS NOT null 
   AND DATE_FORMAT(login_time, '%Y-%m-%d')=DATE_FORMAT(CURDATE()-1, '%Y-%m-%d')
 GROUP BY dateHours ORDER BY login_id DESC 

haveVisitLog

  select IF(count(user_id),count(user_id),'') from xzx_user_login_info
  where 1=1  and login_time is not null
    AND DATE_FORMAT(login_time, '%Y-%m-%d') <= #endTime#
    AND DATE_FORMAT(login_time, '%Y-%m-%d') >= #startTime#
   limit 1

weekVistNum

  SELECT count(*) AS visitCount
      FROM xzx_user_login_info 
     WHERE login_time is not null 
          AND DATE_FORMAT(login_time, '%Y-%m-%d') <= #endTime#
           AND DATE_FORMAT(login_time, '%Y-%m-%d') >= #startTime#
     GROUP BY user_id ORDER BY login_id DESC        

queryDataByStorageId

SELECT IFNULL(SUM(a.money_by_storage), 0) as storageMoneyCount,  IFNULL(SUM(a.weight_by_storage),0) as storageWeightCount, b.storage_name as sysStorageId
FROM xzx_sys_storage b 
    LEFT JOIN xzx_charts_data a ON a.sys_storage_id=b.id 
    @if(!isEmpty(startTime)){
        WHERE a.create_time BETWEEN #startTime# AND #endTime#
    @}
    GROUP BY b.id limit 0, 10000

queryItemtype

SELECT SUM(b.money) as storageMoney, SUM(b.weight) as storageWeight,a.title as itemName
FROM xzx_sys_environmental_info a
LEFT JOIN xzx_order_item_info b ON a.item_type = b.item_type
LEFT JOIN xzx_order_info c ON b.order_id = c.order_id and c.order_status IN ( '4', '5', '7' )
left JOIN xzx_order_detail_info d on c.order_id=d.order_id
WHERE a.parent_id is NOT NULL and a.del_flag=0
@if(!isEmpty(startTime)){
AND d.receive_time BETWEEN #startTime# AND #endTime#
@}

GROUP BY a.item_type

queryItemtypeEmpty

SELECT '0.00' as storageMoney, '0.00' as storageWeight,a.title as itemName
FROM xzx_sys_environmental_info a
LEFT JOIN xzx_order_item_info b ON a.item_type = b.item_type
WHERE a.parent_id is NOT NULL and a.del_flag=0
GROUP BY a.item_type

querySumReclayMoney

SELECT sum(b.money) FROM xzx_order_info a
INNER JOIN xzx_order_item_info b on a.order_id=b.order_id
WHERE a.order_status in ('4','5','7')

query15daydata

SELECT left(date_hours, 10) as createTime, 
    SUM(money_by_order) as moneyCount, 
    SUM(weight_by_order) as weightCount,
    SUM(order_sum) as orderCount,
    SUM(money_by_storage) as storageMoneyCount,
    SUM(weight_by_storage) as storageWeightCount, 
    SUM(user_sum) as userCount
FROM xzx_charts_data 
    WHERE date_hours BETWEEN #startTime# AND #endTime#
    GROUP BY left(date_hours, 10)

queryModel

SELECT create_time as createTime FROM xzx_charts_data ORDER BY create_time ASC LIMIT 1

queryOrder

SELECT b.complete_time as createTime 
FROM xzx_order_info a
left join xzx_order_detail_info b on a.order_id=b.order_id
where a.del_flag=0
 ORDER BY create_time ASC LIMIT 1

qeuryConfigInfo

SELECT config_value FROM xzx_sys_config_info WHERE config_type_code=#configTypeCode#

updateConfigInfo

UPDATE xzx_sys_config_info SET config_value=0 WHERE config_type_code=#configTypeCode#

queryTime

    SELECT create_time as createTime FROM xzx_charts_data ORDER BY create_time desc LIMIT 1

queryDbTime

SELECT date_format(now(), '%Y-%m-%d %H:%i:%s') as dbTime FROM dual