49 lines
935 B
SQL
49 lines
935 B
SQL
-- 精确匹配后端的查询条件
|
||
-- 这个查询应该和后端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;
|