|
@@ -48,6 +48,13 @@ public interface DmOrderRecordRepository extends JpaRepository<DmOrderRecord, Lo
|
|
|
@Query(value = "SELECT IF(SUM(amt) is null,0,SUM(amt)) FROM dm_order_record WHERE create_date BETWEEN DATE_FORMAT(DATE_SUB(CURDATE(),INTERVAL 1 DAY),'%Y-%m-%d 00:00:00') AND DATE_FORMAT(DATE_SUB(CURDATE(),INTERVAL 1 DAY),'%Y-%m-%d 23:59:59') ",nativeQuery = true)
|
|
|
Integer countIncome();
|
|
|
|
|
|
+ /**
|
|
|
+ * 今日营业额
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Query(value = "SELECT IF(SUM(amt) is null,0,SUM(amt)) FROM dm_order_record WHERE create_date BETWEEN DATE_FORMAT(CURDATE(),'%Y-%m-%d 00:00:00') AND DATE_FORMAT(CURDATE(),'%Y-%m-%d 23:59:59') ",nativeQuery = true)
|
|
|
+ Integer countNowIncome();
|
|
|
+
|
|
|
/**
|
|
|
* 昨日消费人数
|
|
|
* @return
|
|
@@ -57,6 +64,13 @@ public interface DmOrderRecordRepository extends JpaRepository<DmOrderRecord, Lo
|
|
|
" ) a ",nativeQuery = true)
|
|
|
Integer countConsumerNumber();
|
|
|
|
|
|
+ /**
|
|
|
+ * 今日消费人数
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Query(value = "SELECT count(1) from (SELECT DISTINCT mob FROM dm_order_record WHERE create_date BETWEEN DATE_FORMAT(CURDATE(),'%Y-%m-%d 00:00:00') AND DATE_FORMAT(CURDATE(),'%Y-%m-%d 23:59:59')) a ",nativeQuery = true)
|
|
|
+ Integer countConsumerNowNumber();
|
|
|
+
|
|
|
@Query(value = "SELECT a.`id`, a.`bh`, a.`money`, a.`mob`, a.`user_code`, a.`user_name`, a.`dept_id`, " +
|
|
|
"a.`user_type`, a.`phone`, a.`create_date`, a.`total_money`, a.`zk_money`, a.`seq`, a.`card`, " +
|
|
|
"a.`card_no`, a.`part`, a.`term`, a.`shop`, a.`term_name`, a.`shop_name`, a.`amt`, a.`balance`, " +
|
|
@@ -109,4 +123,11 @@ public interface DmOrderRecordRepository extends JpaRepository<DmOrderRecord, Lo
|
|
|
*/
|
|
|
@Query(value = "SELECT if(AVG(pj.pj_star) is null,0,AVG(pj.pj_star)) as grade, COUNT(DISTINCT(pj.user_code)) as code_num,count(pj.food_code) as food_num FROM dm_order_record as record INNER JOIN dm_order_item as item on item.bh = record.bh left join dm_food_pj as pj on pj.order_bh = item.bh where DATE_FORMAT(record.create_date,'%Y-%m-%d') = DATE_FORMAT(NOW(),'%Y-%m-%d') and pj.food_code = :cateId ",nativeQuery = true)
|
|
|
Map<String,Object> selectOrderSumByCateId(@Param("cateId") String cateId);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 销售前端的商品
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Query(value = "SELECT item.pid,item.name,COUNT(item.pid) as countPid FROM dm_order_record rec LEFT JOIN dm_order_item item on rec.seq = item.seq WHERE rec.create_date BETWEEN DATE_FORMAT(date_sub(CURDATE(),interval 1 day),'%Y-%m-%d 00:00:00') AND DATE_FORMAT(date_sub(CURDATE(),interval 1 day),'%Y-%m-%d 23:59:59') GROUP BY item.pid ORDER BY countPid desc LIMIT 0,3",nativeQuery = true)
|
|
|
+ List<Map<String,Object>> countCateTheTopThree();
|
|
|
}
|