<?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.xzx.gc.order.mapper.EchartConsoleMapper">
|
|
<select id="moneyEchart" resultType="com.xzx.gc.model.admin.EchartModel">
|
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 test="startTime != null and startTime != ''">
|
AND c.complete_time BETWEEN #{startTime} AND #{endTime}
|
</if>
|
</select>
|
|
|
|
<select id="storageEchart" resultType="com.xzx.gc.model.admin.EchartModel">
|
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 test="startTime != null and startTime != ''">
|
AND a.storage_time BETWEEN #{startTime} AND #{endTime}
|
</if>
|
GROUP BY a.sys_storage_id
|
</select>
|
|
|
|
<select id="orderEchart" resultType="com.xzx.gc.model.admin.EchartModel">
|
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 test="startTime != null and startTime != ''">
|
AND IFNULL(b.complete_time,a.create_time) BETWEEN #{startTime} AND #{endTime}
|
</if>
|
</select>
|
|
|
|
<select id="orderEchartTemp" resultType="com.xzx.gc.model.admin.EchartModel">
|
SELECT IFNULL(COUNT(*),0) as orderCount FROM xzx_order_info a WHERE a.order_type=1 AND a.order_status in (4,5)
|
<if test="startTime != null and startTime != ''">
|
AND a.create_time BETWEEN #{startTime} AND #{endTime}
|
</if>
|
</select>
|
|
|
<select id="userEchart" resultType="com.xzx.gc.model.admin.EchartModel">
|
SELECT IFNULL(COUNT(*),0) as userCount FROM (
|
SELECT * FROM xzx_user_info a WHERE del_flag=0
|
<if test="startTime != null and startTime != ''">
|
AND a.regist_time BETWEEN #{startTime} AND #{endTime}
|
</if>
|
GROUP BY a.mobile_phone
|
) x
|
</select>
|
|
|
|
|
<insert id="insertEchart" parameterType="com.xzx.gc.model.admin.EchartModel">
|
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});
|
|
</insert>
|
|
<select id="queryOrderDayCount" parameterType="com.xzx.gc.model.admin.EchartModel" resultType="java.lang.String">
|
select ifnull(count(order_id),0) from xzx_order_info
|
where del_flag=0
|
<if test="startTime != null and startTime != ''">
|
and create_time BETWEEN #{startTime} AND #{endTime}
|
</if>
|
and order_status in ('1','2','3','4','5','7')
|
</select>
|
|
|
<select id="queryData" parameterType="com.xzx.gc.model.admin.EchartModel" resultType="com.xzx.gc.model.admin.EchartModel">
|
SELECT SUM(a.money_by_storage) as storageMoneyCount,
|
(SELECT visit_sum FROM xzx_charts_data
|
<if test="startTime != null and startTime != ''">
|
WHERE a.create_time BETWEEN #{startTime} AND #{endTime}
|
</if>
|
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 test="startTime != null and startTime != ''">
|
WHERE a.create_time BETWEEN #{startTime} AND #{endTime}
|
</if>
|
</select>
|
|
|
|
|
|
|
<select id="haveVisitLog" resultType="java.lang.String">
|
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') <![CDATA[<= ]]> #{endTime}
|
AND DATE_FORMAT(login_time, '%Y-%m-%d') <![CDATA[>= ]]> #{startTime}
|
limit 1
|
</select>
|
|
|
|
<select id="weekVistNum" resultType="com.xzx.gc.model.admin.EchartModel">
|
SELECT count(*) AS visitCount
|
FROM xzx_user_login_info
|
WHERE login_time is not null
|
AND DATE_FORMAT(login_time, '%Y-%m-%d') <![CDATA[<= ]]> #{endTime}
|
AND DATE_FORMAT(login_time, '%Y-%m-%d') <![CDATA[>= ]]> #{startTime}
|
GROUP BY user_id ORDER BY login_id DESC
|
</select>
|
|
<select id="queryDataByStorageId" parameterType="com.xzx.gc.model.admin.EchartModel" resultType="com.xzx.gc.model.admin.EchartModel">
|
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 test="startTime != null and startTime != ''">
|
WHERE a.create_time BETWEEN #{startTime} AND #{endTime}
|
</if>
|
GROUP BY b.id limit 0, 10000
|
</select>
|
|
|
|
<select id="queryItemtype" parameterType="com.xzx.gc.model.admin.ItemRateModel" resultType="com.xzx.gc.model.admin.ItemRateModel">
|
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 test="startTime != null and startTime != ''">
|
AND d.receive_time BETWEEN #{startTime} AND #{endTime}
|
</if>
|
|
GROUP BY a.item_type
|
</select>
|
|
|
<select id="queryItemtypeEmpty" parameterType="com.xzx.gc.model.admin.ItemRateModel" resultType="com.xzx.gc.model.admin.ItemRateModel">
|
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
|
</select>
|
|
|
|
|
|
|
|
|
|
|
<select id="query15daydata" resultType="com.xzx.gc.model.admin.EchartModel">
|
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)
|
</select>
|
|
|
|
<select id="queryModel" resultType="com.xzx.gc.model.admin.ItemRateModel">
|
SELECT create_time as createTime FROM xzx_charts_data ORDER BY create_time ASC LIMIT 1
|
</select>
|
|
|
<select id="queryOrder" resultType="com.xzx.gc.model.admin.ItemRateModel">
|
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
|
</select>
|
|
|
<select id="qeuryConfigInfo" resultType="java.lang.Integer">
|
SELECT config_value FROM xzx_sys_config_info WHERE config_type_code=#{configTypeCode}
|
|
</select>
|
|
|
|
<update id="updateConfigInfo" >
|
UPDATE xzx_sys_config_info SET config_value=0 WHERE config_type_code=#{configTypeCode}
|
|
</update>
|
|
<select id="queryTime" resultType="java.lang.String">
|
SELECT create_time as createTime FROM xzx_charts_data ORDER BY create_time desc LIMIT 1
|
</select>
|
|
|
<select id="queryDbTime" resultType="java.lang.String">
|
SELECT date_format(now(), '%Y-%m-%d %H:%i:%s') as dbTime FROM dual
|
|
</select>
|
|
|
</mapper>
|