feat: 修改首页,添加景区订单列表统计
This commit is contained in:
@@ -580,6 +580,37 @@ public interface DashboardMapper {
|
||||
})
|
||||
List<QrcodeOrderDataVO> getQrcodeOrderCount(@Param("p") Map<String, Object> params);
|
||||
|
||||
@Select({
|
||||
"<script>",
|
||||
"SELECT",
|
||||
" t.tourism_name as tourismName,",
|
||||
" t.id as tourismId,",
|
||||
" COUNT(o.id) as orderCount",
|
||||
"FROM tourisms t",
|
||||
"LEFT JOIN qrcodes q ON q.tourism_id = t.id",
|
||||
" <if test='p.includeTestQrcodes == null or p.includeTestQrcodes == false'> AND q.is_test = 0 </if>",
|
||||
" AND q.is_del = 0",
|
||||
"LEFT JOIN orders o ON q.code_id = o.code_id",
|
||||
" AND o.order_status IN (3, 7)",
|
||||
" AND (o.pay_type = 1 OR o.pay_type IS NULL)",
|
||||
" <if test='p.startTime != null and p.startTime != \"\"'> AND o.create_time >= #{p.startTime} </if>",
|
||||
" <if test='p.endTime != null and p.endTime != \"\"'> AND o.create_time <= #{p.endTime} </if>",
|
||||
" <if test='p.qrcodeId != null and p.qrcodeId != \"\"'> AND o.code_id = #{p.qrcodeId} </if>",
|
||||
" <if test='p.deviceSn != null and p.deviceSn != \"\"'> AND o.device_sn = #{p.deviceSn} </if>",
|
||||
"WHERE t.is_del = 0",
|
||||
"<if test='p.tourismId != null'>",
|
||||
" AND t.id = #{p.tourismId}",
|
||||
"</if>",
|
||||
"<if test='p.tourismIds != null and p.tourismIds.size > 0'>",
|
||||
" AND t.id IN",
|
||||
" <foreach collection='p.tourismIds' item='tid' open='(' separator=',' close=')'>#{tid}</foreach>",
|
||||
"</if>",
|
||||
"GROUP BY t.id, t.tourism_name",
|
||||
"ORDER BY orderCount DESC",
|
||||
"</script>"
|
||||
})
|
||||
List<TourismOrderDataVO> getTourismOrderCount(@Param("p") Map<String, Object> params);
|
||||
|
||||
@Select({
|
||||
"<script>",
|
||||
"SELECT COUNT(*) as count",
|
||||
|
||||
+3
@@ -20,6 +20,9 @@ public class ChartStatistics {
|
||||
@Schema(description = "二维码订单数量")
|
||||
private List<QrcodeOrderDataVO> qrcodeOrderCount;
|
||||
|
||||
@Schema(description = "景区订单数量统计(用于横向条形图)")
|
||||
private List<TourismOrderDataVO> tourismOrderCount;
|
||||
|
||||
@Schema(description = "每日订单总数与订单总金额(元)")
|
||||
private List<TrendDataVO> dailySummary;
|
||||
}
|
||||
|
||||
+4
@@ -279,6 +279,10 @@ public class DashboardServiceImpl implements IDashboardService {
|
||||
List<QrcodeOrderDataVO> qrcodeOrderCount = dashboardMapper.getQrcodeOrderCount(params);
|
||||
chartStats.setQrcodeOrderCount(qrcodeOrderCount);
|
||||
|
||||
// 景区订单数量(用于横向条形图)
|
||||
List<TourismOrderDataVO> tourismOrderCount = dashboardMapper.getTourismOrderCount(params);
|
||||
chartStats.setTourismOrderCount(tourismOrderCount);
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("获取图表统计数据失败", e);
|
||||
// 设置空数据避免前端报错
|
||||
|
||||
Reference in New Issue
Block a user