peixue-dev/Archive/peidu-temp-files/sql/创建日历测试数据-简化版-2026-01-24.sql

50 lines
1.7 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- 创建日历测试数据 - 简化版 - 2026-01-24
-- 只使用最基本的必需字段
-- 1. 创建已完成的订单1月10日
INSERT INTO `order` (order_no, user_id, service_date, time_slot, status, deleted)
VALUES ('ORD20260124001', 1, '2026-01-10', '09:00-11:00', 4, 0);
-- 2. 创建待服务的订单1月15日
INSERT INTO `order` (order_no, user_id, service_date, time_slot, status, deleted)
VALUES ('ORD20260124002', 1, '2026-01-15', '14:00-16:00', 2, 0);
-- 3. 创建待接单的订单1月20日
INSERT INTO `order` (order_no, user_id, service_date, time_slot, status, deleted)
VALUES ('ORD20260124003', 1, '2026-01-20', '10:00-12:00', 1, 0);
-- 4. 创建服务中的订单1月24日 - 今天)
INSERT INTO `order` (order_no, user_id, service_date, time_slot, status, deleted)
VALUES ('ORD20260124004', 1, '2026-01-24', '15:00-17:00', 3, 0);
-- 5. 创建待服务的订单1月25日 - 明天)
INSERT INTO `order` (order_no, user_id, service_date, time_slot, status, deleted)
VALUES ('ORD20260124005', 1, '2026-01-25', '09:00-11:00', 2, 0);
-- 6. 创建待服务的订单1月28日
INSERT INTO `order` (order_no, user_id, service_date, time_slot, status, deleted)
VALUES ('ORD20260124006', 1, '2026-01-28', '14:00-16:00', 2, 0);
-- 验证插入的数据
SELECT
id,
order_no,
user_id,
service_date,
time_slot,
status,
CASE status
WHEN 0 THEN '待支付'
WHEN 1 THEN '待接单'
WHEN 2 THEN '待服务'
WHEN 3 THEN '服务中'
WHEN 4 THEN '已完成'
ELSE '未知'
END as status_text
FROM `order`
WHERE user_id = 1
AND service_date >= '2026-01-01'
AND service_date <= '2026-01-31'
AND deleted = 0
ORDER BY service_date, time_slot;