数据统计
This commit is contained in:
parent
b4cdb77bdf
commit
79a9d8e47e
@ -358,28 +358,28 @@
|
||||
<select id="fuelStream" resultType="java.util.Map">
|
||||
SELECT
|
||||
-- 当天的数据和条数
|
||||
CAST((SELECT COUNT(*) FROM oil_order WHERE DATE(create_time) = CURDATE()) AS CHAR) AS today_count,
|
||||
CAST((SELECT SUM(pay_amount) FROM oil_order WHERE DATE(create_time) = CURDATE()) AS CHAR) AS today_sum,
|
||||
CAST((SELECT COUNT(*) FROM oil_order WHERE DATE(create_time) = CURDATE()and store_id = #{storeId}) AS CHAR) AS today_count,
|
||||
CAST((SELECT SUM(pay_amount) FROM oil_order WHERE DATE(create_time) = CURDATE()and store_id = #{storeId}) AS CHAR) AS today_sum,
|
||||
|
||||
-- 当周的数据和条数
|
||||
CAST((SELECT COUNT(*) FROM oil_order WHERE WEEK(create_time) = WEEK(CURDATE())) AS CHAR) AS this_week_count,
|
||||
CAST((SELECT SUM(pay_amount) FROM oil_order WHERE WEEK(create_time) = WEEK(CURDATE())) AS CHAR) AS this_week_sum,
|
||||
CAST((SELECT COUNT(*) FROM oil_order WHERE WEEK(create_time) = WEEK(CURDATE())and store_id = #{storeId}) AS CHAR) AS this_week_count,
|
||||
CAST((SELECT SUM(pay_amount) FROM oil_order WHERE WEEK(create_time) = WEEK(CURDATE())and store_id = #{storeId}) AS CHAR) AS this_week_sum,
|
||||
|
||||
-- 当月的数据和条数
|
||||
CAST((SELECT COUNT(*) FROM oil_order WHERE MONTH(create_time) = MONTH(CURDATE())) AS CHAR) AS this_month_count,
|
||||
CAST((SELECT SUM(pay_amount) FROM oil_order WHERE MONTH(create_time) = MONTH(CURDATE())) AS CHAR) AS this_month_sum,
|
||||
CAST((SELECT COUNT(*) FROM oil_order WHERE MONTH(create_time) = MONTH(CURDATE())and store_id = #{storeId}) AS CHAR) AS this_month_count,
|
||||
CAST((SELECT SUM(pay_amount) FROM oil_order WHERE MONTH(create_time) = MONTH(CURDATE())and store_id = #{storeId}) AS CHAR) AS this_month_sum,
|
||||
|
||||
-- 昨天的数据
|
||||
CAST((SELECT COUNT(*) FROM oil_order WHERE DATE(create_time) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)) AS CHAR) AS yesterday_count,
|
||||
CAST((SELECT SUM(pay_amount) FROM oil_order WHERE DATE(create_time) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)) AS CHAR) AS yesterday_sum,
|
||||
CAST((SELECT COUNT(*) FROM oil_order WHERE DATE(create_time) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)and store_id = #{storeId}) AS CHAR) AS yesterday_count,
|
||||
CAST((SELECT SUM(pay_amount) FROM oil_order WHERE DATE(create_time) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)and store_id = #{storeId}) AS CHAR) AS yesterday_sum,
|
||||
|
||||
-- 上周的数据
|
||||
CAST((SELECT COUNT(*) FROM oil_order WHERE WEEK(create_time) = WEEK(DATE_SUB(CURDATE(), INTERVAL 1 WEEK))) AS CHAR) AS last_week_count,
|
||||
CAST((SELECT SUM(pay_amount) FROM oil_order WHERE WEEK(create_time) = WEEK(DATE_SUB(CURDATE(), INTERVAL 1 WEEK))) AS CHAR) AS last_week_sum,
|
||||
CAST((SELECT COUNT(*) FROM oil_order WHERE WEEK(create_time) = WEEK(DATE_SUB(CURDATE(), INTERVAL 1 WEEK))and store_id = #{storeId}) AS CHAR) AS last_week_count,
|
||||
CAST((SELECT SUM(pay_amount) FROM oil_order WHERE WEEK(create_time) = WEEK(DATE_SUB(CURDATE(), INTERVAL 1 WEEK))and store_id = #{storeId}) AS CHAR) AS last_week_sum,
|
||||
|
||||
-- 上个月的数据
|
||||
CAST((SELECT COUNT(*) FROM oil_order WHERE MONTH(create_time) = MONTH(DATE_SUB(CURDATE(), INTERVAL 1 MONTH))) AS CHAR) AS last_month_count,
|
||||
CAST((SELECT SUM(pay_amount) FROM oil_order WHERE MONTH(create_time) = MONTH(DATE_SUB(CURDATE(), INTERVAL 1 MONTH))) AS CHAR) AS last_month_sum;
|
||||
CAST((SELECT COUNT(*) FROM oil_order WHERE MONTH(create_time) = MONTH(DATE_SUB(CURDATE(), INTERVAL 1 MONTH))and store_id = #{storeId}) AS CHAR) AS last_month_count,
|
||||
CAST((SELECT SUM(pay_amount) FROM oil_order WHERE MONTH(create_time) = MONTH(DATE_SUB(CURDATE(), INTERVAL 1 MONTH))and store_id = #{storeId}) AS CHAR) AS last_month_sum;
|
||||
</select>
|
||||
|
||||
<select id="queryByPageApplet"
|
||||
|
@ -126,28 +126,28 @@
|
||||
<select id="cardStream" resultType="java.util.Map">
|
||||
SELECT
|
||||
-- 当天的数据和条数
|
||||
CAST((SELECT COUNT(*) FROM oil_order WHERE DATE(create_time) = CURDATE()) AS CHAR) AS today_count,
|
||||
CAST((SELECT SUM(pay_amount) FROM oil_order WHERE DATE(create_time) = CURDATE()) AS CHAR) AS today_sum,
|
||||
CAST((SELECT COUNT(*) FROM oil_order WHERE DATE(create_time) = CURDATE() and store_id = #{storeId}) AS CHAR) AS today_count,
|
||||
CAST((SELECT SUM(pay_amount) FROM oil_order WHERE DATE(create_time) = CURDATE()and store_id = #{storeId}) AS CHAR) AS today_sum,
|
||||
|
||||
-- 当周的数据和条数
|
||||
CAST((SELECT COUNT(*) FROM oil_order WHERE WEEK(create_time) = WEEK(CURDATE())) AS CHAR) AS this_week_count,
|
||||
CAST((SELECT SUM(pay_amount) FROM oil_order WHERE WEEK(create_time) = WEEK(CURDATE())) AS CHAR) AS this_week_sum,
|
||||
CAST((SELECT COUNT(*) FROM oil_order WHERE WEEK(create_time) = WEEK(CURDATE())and store_id = #{storeId}) AS CHAR) AS this_week_count,
|
||||
CAST((SELECT SUM(pay_amount) FROM oil_order WHERE WEEK(create_time) = WEEK(CURDATE())and store_id = #{storeId}) AS CHAR) AS this_week_sum,
|
||||
|
||||
-- 当月的数据和条数
|
||||
CAST((SELECT COUNT(*) FROM oil_order WHERE MONTH(create_time) = MONTH(CURDATE())) AS CHAR) AS this_month_count,
|
||||
CAST((SELECT SUM(pay_amount) FROM oil_order WHERE MONTH(create_time) = MONTH(CURDATE())) AS CHAR) AS this_month_sum,
|
||||
CAST((SELECT COUNT(*) FROM oil_order WHERE MONTH(create_time) = MONTH(CURDATE())and store_id = #{storeId}) AS CHAR) AS this_month_count,
|
||||
CAST((SELECT SUM(pay_amount) FROM oil_order WHERE MONTH(create_time) = MONTH(CURDATE())and store_id = #{storeId}) AS CHAR) AS this_month_sum,
|
||||
|
||||
-- 昨天的数据
|
||||
CAST((SELECT COUNT(*) FROM oil_order WHERE DATE(create_time) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)) AS CHAR) AS yesterday_count,
|
||||
CAST((SELECT SUM(pay_amount) FROM oil_order WHERE DATE(create_time) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)) AS CHAR) AS yesterday_sum,
|
||||
CAST((SELECT COUNT(*) FROM oil_order WHERE DATE(create_time) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)and store_id = #{storeId}) AS CHAR) AS yesterday_count,
|
||||
CAST((SELECT SUM(pay_amount) FROM oil_order WHERE DATE(create_time) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)and store_id = #{storeId}) AS CHAR) AS yesterday_sum,
|
||||
|
||||
-- 上周的数据
|
||||
CAST((SELECT COUNT(*) FROM oil_order WHERE WEEK(create_time) = WEEK(DATE_SUB(CURDATE(), INTERVAL 1 WEEK))) AS CHAR) AS last_week_count,
|
||||
CAST((SELECT SUM(pay_amount) FROM oil_order WHERE WEEK(create_time) = WEEK(DATE_SUB(CURDATE(), INTERVAL 1 WEEK))) AS CHAR) AS last_week_sum,
|
||||
CAST((SELECT COUNT(*) FROM oil_order WHERE WEEK(create_time) = WEEK(DATE_SUB(CURDATE(), INTERVAL 1 WEEK))and store_id = #{storeId}) AS CHAR) AS last_week_count,
|
||||
CAST((SELECT SUM(pay_amount) FROM oil_order WHERE WEEK(create_time) = WEEK(DATE_SUB(CURDATE(), INTERVAL 1 WEEK))and store_id = #{storeId}) AS CHAR) AS last_week_sum,
|
||||
|
||||
-- 上个月的数据
|
||||
CAST((SELECT COUNT(*) FROM oil_order WHERE MONTH(create_time) = MONTH(DATE_SUB(CURDATE(), INTERVAL 1 MONTH))) AS CHAR) AS last_month_count,
|
||||
CAST((SELECT SUM(pay_amount) FROM oil_order WHERE MONTH(create_time) = MONTH(DATE_SUB(CURDATE(), INTERVAL 1 MONTH))) AS CHAR) AS last_month_sum;
|
||||
CAST((SELECT COUNT(*) FROM oil_order WHERE MONTH(create_time) = MONTH(DATE_SUB(CURDATE(), INTERVAL 1 MONTH))and store_id = #{storeId}) AS CHAR) AS last_month_count,
|
||||
CAST((SELECT SUM(pay_amount) FROM oil_order WHERE MONTH(create_time) = MONTH(DATE_SUB(CURDATE(), INTERVAL 1 MONTH))and store_id = #{storeId}) AS CHAR) AS last_month_sum;
|
||||
</select>
|
||||
|
||||
<select id="prepaidCardSales" resultType="java.util.Map">
|
||||
|
@ -52,6 +52,7 @@
|
||||
LEFT JOIN oil_order oo ON ms.id = oo.staff_id
|
||||
LEFT JOIN card_value_record cvr ON ms.id = cvr.mt_staff_id
|
||||
LEFT JOIN card_fuel_record cfr ON ms.id = cfr.mt_staff_id
|
||||
where ms.store_id = #{storeId}
|
||||
GROUP BY
|
||||
ms.id, ms.real_name
|
||||
ORDER BY
|
||||
|
@ -97,28 +97,28 @@
|
||||
<select id="goodsStream" resultType="java.util.Map">
|
||||
SELECT
|
||||
-- 当天的数据和条数
|
||||
CAST((SELECT COUNT(*) FROM oil_order WHERE DATE(create_time) = CURDATE()) AS CHAR) AS today_count,
|
||||
CAST((SELECT SUM(pay_amount) FROM oil_order WHERE DATE(create_time) = CURDATE()) AS CHAR) AS today_sum,
|
||||
CAST((SELECT COUNT(*) FROM oil_order WHERE DATE(create_time) = CURDATE()and store_id = #{storeId}) AS CHAR) AS today_count,
|
||||
CAST((SELECT SUM(pay_amount) FROM oil_order WHERE DATE(create_time) = CURDATE()and store_id = #{storeId}) AS CHAR) AS today_sum,
|
||||
|
||||
-- 当周的数据和条数
|
||||
CAST((SELECT COUNT(*) FROM oil_order WHERE WEEK(create_time) = WEEK(CURDATE())) AS CHAR) AS this_week_count,
|
||||
CAST((SELECT SUM(pay_amount) FROM oil_order WHERE WEEK(create_time) = WEEK(CURDATE())) AS CHAR) AS this_week_sum,
|
||||
CAST((SELECT COUNT(*) FROM oil_order WHERE WEEK(create_time) = WEEK(CURDATE())and store_id = #{storeId}) AS CHAR) AS this_week_count,
|
||||
CAST((SELECT SUM(pay_amount) FROM oil_order WHERE WEEK(create_time) = WEEK(CURDATE())and store_id = #{storeId}) AS CHAR) AS this_week_sum,
|
||||
|
||||
-- 当月的数据和条数
|
||||
CAST((SELECT COUNT(*) FROM oil_order WHERE MONTH(create_time) = MONTH(CURDATE())) AS CHAR) AS this_month_count,
|
||||
CAST((SELECT SUM(pay_amount) FROM oil_order WHERE MONTH(create_time) = MONTH(CURDATE())) AS CHAR) AS this_month_sum,
|
||||
CAST((SELECT COUNT(*) FROM oil_order WHERE MONTH(create_time) = MONTH(CURDATE())and store_id = #{storeId}) AS CHAR) AS this_month_count,
|
||||
CAST((SELECT SUM(pay_amount) FROM oil_order WHERE MONTH(create_time) = MONTH(CURDATE())and store_id = #{storeId}) AS CHAR) AS this_month_sum,
|
||||
|
||||
-- 昨天的数据
|
||||
CAST((SELECT COUNT(*) FROM oil_order WHERE DATE(create_time) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)) AS CHAR) AS yesterday_count,
|
||||
CAST((SELECT SUM(pay_amount) FROM oil_order WHERE DATE(create_time) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)) AS CHAR) AS yesterday_sum,
|
||||
CAST((SELECT COUNT(*) FROM oil_order WHERE DATE(create_time) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)and store_id = #{storeId}) AS CHAR) AS yesterday_count,
|
||||
CAST((SELECT SUM(pay_amount) FROM oil_order WHERE DATE(create_time) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)and store_id = #{storeId}) AS CHAR) AS yesterday_sum,
|
||||
|
||||
-- 上周的数据
|
||||
CAST((SELECT COUNT(*) FROM oil_order WHERE WEEK(create_time) = WEEK(DATE_SUB(CURDATE(), INTERVAL 1 WEEK))) AS CHAR) AS last_week_count,
|
||||
CAST((SELECT SUM(pay_amount) FROM oil_order WHERE WEEK(create_time) = WEEK(DATE_SUB(CURDATE(), INTERVAL 1 WEEK))) AS CHAR) AS last_week_sum,
|
||||
CAST((SELECT COUNT(*) FROM oil_order WHERE WEEK(create_time) = WEEK(DATE_SUB(CURDATE(), INTERVAL 1 WEEK))and store_id = #{storeId}) AS CHAR) AS last_week_count,
|
||||
CAST((SELECT SUM(pay_amount) FROM oil_order WHERE WEEK(create_time) = WEEK(DATE_SUB(CURDATE(), INTERVAL 1 WEEK))and store_id = #{storeId}) AS CHAR) AS last_week_sum,
|
||||
|
||||
-- 上个月的数据
|
||||
CAST((SELECT COUNT(*) FROM oil_order WHERE MONTH(create_time) = MONTH(DATE_SUB(CURDATE(), INTERVAL 1 MONTH))) AS CHAR) AS last_month_count,
|
||||
CAST((SELECT SUM(pay_amount) FROM oil_order WHERE MONTH(create_time) = MONTH(DATE_SUB(CURDATE(), INTERVAL 1 MONTH))) AS CHAR) AS last_month_sum;
|
||||
CAST((SELECT COUNT(*) FROM oil_order WHERE MONTH(create_time) = MONTH(DATE_SUB(CURDATE(), INTERVAL 1 MONTH))and store_id = #{storeId}) AS CHAR) AS last_month_count,
|
||||
CAST((SELECT SUM(pay_amount) FROM oil_order WHERE MONTH(create_time) = MONTH(DATE_SUB(CURDATE(), INTERVAL 1 MONTH))and store_id = #{storeId}) AS CHAR) AS last_month_sum;
|
||||
</select>
|
||||
<select id="merchandiseSales" resultType="java.util.Map">
|
||||
|
||||
@ -128,16 +128,18 @@
|
||||
FROM
|
||||
(
|
||||
SELECT CURDATE() - INTERVAL (a.a + (10 * b.a) + (100 * c.a)) DAY AS date
|
||||
FROM (SELECT 0 AS a UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9) a
|
||||
CROSS JOIN (SELECT 0 AS a UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9) b
|
||||
CROSS JOIN (SELECT 0 AS a UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9) c
|
||||
FROM (SELECT 0 AS a UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9) a
|
||||
CROSS JOIN (SELECT 0 AS a UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9) b
|
||||
CROSS JOIN (SELECT 0 AS a UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9) c
|
||||
) date_range
|
||||
LEFT JOIN
|
||||
mt_order ON DATE(mt_order.create_time) = date_range.date
|
||||
WHERE
|
||||
date_range.date BETWEEN CURDATE() - INTERVAL 30 DAY AND CURDATE()
|
||||
|
||||
(date_range.date BETWEEN CURDATE() - INTERVAL 30 DAY AND CURDATE())
|
||||
GROUP BY
|
||||
date_range.date
|
||||
|
||||
ORDER BY
|
||||
date_range.date;
|
||||
</select>
|
||||
|
@ -166,28 +166,28 @@
|
||||
|
||||
SELECT
|
||||
-- 当天的数据和条数
|
||||
CAST((SELECT COUNT(*) FROM oil_order WHERE DATE(create_time) = CURDATE()) AS CHAR) AS today_count,
|
||||
CAST((SELECT SUM(pay_amount) FROM oil_order WHERE DATE(create_time) = CURDATE()) AS CHAR) AS today_sum,
|
||||
CAST((SELECT COUNT(*) FROM oil_order WHERE DATE(create_time) = CURDATE() and store_id = #{storeId}) AS CHAR) AS today_count,
|
||||
CAST((SELECT SUM(pay_amount) FROM oil_order WHERE DATE(create_time) = CURDATE() and store_id = #{storeId}) AS CHAR) AS today_sum,
|
||||
|
||||
-- 当周的数据和条数
|
||||
CAST((SELECT COUNT(*) FROM oil_order WHERE WEEK(create_time) = WEEK(CURDATE())) AS CHAR) AS this_week_count,
|
||||
CAST((SELECT SUM(pay_amount) FROM oil_order WHERE WEEK(create_time) = WEEK(CURDATE())) AS CHAR) AS this_week_sum,
|
||||
CAST((SELECT COUNT(*) FROM oil_order WHERE WEEK(create_time) = WEEK(CURDATE()) and store_id = #{storeId} ) AS CHAR) AS this_week_count,
|
||||
CAST((SELECT SUM(pay_amount) FROM oil_order WHERE WEEK(create_time) = WEEK(CURDATE())and store_id = #{storeId}) AS CHAR) AS this_week_sum,
|
||||
|
||||
-- 当月的数据和条数
|
||||
CAST((SELECT COUNT(*) FROM oil_order WHERE MONTH(create_time) = MONTH(CURDATE())) AS CHAR) AS this_month_count,
|
||||
CAST((SELECT SUM(pay_amount) FROM oil_order WHERE MONTH(create_time) = MONTH(CURDATE())) AS CHAR) AS this_month_sum,
|
||||
CAST((SELECT COUNT(*) FROM oil_order WHERE MONTH(create_time) = MONTH(CURDATE())and store_id = #{storeId}) AS CHAR) AS this_month_count,
|
||||
CAST((SELECT SUM(pay_amount) FROM oil_order WHERE MONTH(create_time) = MONTH(CURDATE())and store_id = #{storeId}) AS CHAR) AS this_month_sum,
|
||||
|
||||
-- 昨天的数据
|
||||
CAST((SELECT COUNT(*) FROM oil_order WHERE DATE(create_time) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)) AS CHAR) AS yesterday_count,
|
||||
CAST((SELECT SUM(pay_amount) FROM oil_order WHERE DATE(create_time) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)) AS CHAR) AS yesterday_sum,
|
||||
CAST((SELECT COUNT(*) FROM oil_order WHERE DATE(create_time) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)and store_id = #{storeId}) AS CHAR) AS yesterday_count,
|
||||
CAST((SELECT SUM(pay_amount) FROM oil_order WHERE DATE(create_time) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)and store_id = #{storeId}) AS CHAR) AS yesterday_sum,
|
||||
|
||||
-- 上周的数据
|
||||
CAST((SELECT COUNT(*) FROM oil_order WHERE WEEK(create_time) = WEEK(DATE_SUB(CURDATE(), INTERVAL 1 WEEK))) AS CHAR) AS last_week_count,
|
||||
CAST((SELECT SUM(pay_amount) FROM oil_order WHERE WEEK(create_time) = WEEK(DATE_SUB(CURDATE(), INTERVAL 1 WEEK))) AS CHAR) AS last_week_sum,
|
||||
CAST((SELECT COUNT(*) FROM oil_order WHERE WEEK(create_time) = WEEK(DATE_SUB(CURDATE(), INTERVAL 1 WEEK))and store_id = #{storeId}) AS CHAR) AS last_week_count,
|
||||
CAST((SELECT SUM(pay_amount) FROM oil_order WHERE WEEK(create_time) = WEEK(DATE_SUB(CURDATE(), INTERVAL 1 WEEK))and store_id = #{storeId}) AS CHAR) AS last_week_sum,
|
||||
|
||||
-- 上个月的数据
|
||||
CAST((SELECT COUNT(*) FROM oil_order WHERE MONTH(create_time) = MONTH(DATE_SUB(CURDATE(), INTERVAL 1 MONTH))) AS CHAR) AS last_month_count,
|
||||
CAST((SELECT SUM(pay_amount) FROM oil_order WHERE MONTH(create_time) = MONTH(DATE_SUB(CURDATE(), INTERVAL 1 MONTH))) AS CHAR) AS last_month_sum;
|
||||
CAST((SELECT COUNT(*) FROM oil_order WHERE MONTH(create_time) = MONTH(DATE_SUB(CURDATE(), INTERVAL 1 MONTH))and store_id = #{storeId}) AS CHAR) AS last_month_count,
|
||||
CAST((SELECT SUM(pay_amount) FROM oil_order WHERE MONTH(create_time) = MONTH(DATE_SUB(CURDATE(), INTERVAL 1 MONTH))and store_id = #{storeId}) AS CHAR) AS last_month_sum;
|
||||
|
||||
</select>
|
||||
<select id="oilSales" resultType="java.util.Map">
|
||||
@ -204,13 +204,16 @@
|
||||
LEFT JOIN
|
||||
oil_order ON DATE(oil_order.create_time) = date_range.date
|
||||
WHERE
|
||||
date_range.date BETWEEN CURDATE() - INTERVAL 30 DAY AND CURDATE()
|
||||
store_id = #{storeId}
|
||||
and
|
||||
(date_range.date BETWEEN CURDATE() - INTERVAL 30 DAY AND CURDATE())
|
||||
GROUP BY
|
||||
date_range.date
|
||||
ORDER BY
|
||||
date_range.date;
|
||||
</select>
|
||||
<!-- COUNT(*) AS count-->
|
||||
<!-- -- and store_id = #{storeId}-->
|
||||
|
||||
<select id="salesByOilProduct" resultType="java.util.Map">
|
||||
SELECT
|
||||
@ -232,6 +235,7 @@
|
||||
oil_order oo
|
||||
left join oil_name onn on onn.id = oo.oils
|
||||
WHERE
|
||||
|
||||
<if test="type == 'week'">
|
||||
oo.create_time >= CURDATE() - INTERVAL 6 WEEK
|
||||
</if>
|
||||
@ -241,6 +245,7 @@
|
||||
<if test="type == 'year'">
|
||||
oo.create_time >= CURDATE() - INTERVAL 6 YEAR
|
||||
</if>
|
||||
and store_id = #{storeId}
|
||||
GROUP BY
|
||||
YEAR(oo.create_time)
|
||||
<if test="type == 'week'">
|
||||
|
@ -25,6 +25,7 @@ public class ChainStoreInfo extends BaseEntity {
|
||||
private Integer id;
|
||||
//连锁店名称
|
||||
private String storeName;
|
||||
private String status;
|
||||
private Long contractDeptId;
|
||||
@TableField(exist = false)
|
||||
private String leaderName;
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.fuint.business.store.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@ -42,6 +43,9 @@ public class ChainStoreInfoServiceImpl extends ServiceImpl<ChainStoreInfoMapper,
|
||||
IPage<ChainStoreInfo> res = baseMapper.listVo(page,chainStoreInfo,sysDept.getAncestors());
|
||||
res.getRecords().forEach(it->{
|
||||
LambdaQueryWrapper<MtStore> queryWrapper =new LambdaQueryWrapper<>();
|
||||
if (ObjectUtil.isNotEmpty(chainStoreInfo.getStatus())) {
|
||||
queryWrapper.eq(MtStore :: getStatus,chainStoreInfo.getStatus());
|
||||
}
|
||||
queryWrapper.eq(MtStore::getChainStoreId,it.getId()).orderByDesc(BaseEntity::getCreateTime);
|
||||
List<MtStore> list = storeService.list(queryWrapper);
|
||||
it.setStoreList(list);
|
||||
|
Loading…
Reference in New Issue
Block a user