peixue-dev/Archive/peidu-temp-files/sql/🔍精确匹配后端查询-2026-01-23.sql

49 lines
935 B
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.

-- 精确匹配后端的查询条件
-- 这个查询应该和后端Service层的查询完全一致
SELECT
id,
order_id,
teacher_id,
student_id,
student_name,
record_date,
record_type,
content,
images,
videos,
status,
is_archived,
create_time,
update_time
FROM growth_record
WHERE student_id = 1
AND record_type = 'daily'
AND status = 1
ORDER BY record_date DESC, create_time DESC
LIMIT 10;
-- 检查是否有deleted字段软删除
SHOW COLUMNS FROM growth_record LIKE 'deleted';
-- 如果有deleted字段加上deleted=0的条件
SELECT
id,
student_id,
student_name,
record_type,
record_date,
status,
deleted,
LEFT(content, 30) as content_preview
FROM growth_record
WHERE student_id = 1
AND record_type = 'daily'
AND status = 1
AND deleted = 0
ORDER BY record_date DESC
LIMIT 10;
-- 检查表结构
DESCRIBE growth_record;