IDEA显示语法错误,将语法扒下来:
### SQL:
SELECT * FROM (SELECT TMP_PAGE.*,ROWNUMBER() OVER() AS ROW_ID
FROM
( SELECT id,company_id,company_name,name,users,tags,mt,st,grade,teachmode,description,pic,create_date,change_date,create_people,change_people,audit_status,status
FROM course_base
WHERE (name LIKE ? AND audit_status = ?) )
AS TMP_PAGE) TMP_PAGE WHERE ROW_ID BETWEEN ? AND ?
将SQL语句放在数据库中运行,发现是ROWNUMBER()中间需要添加一个"_"
SELECT * FROM (SELECT TMP_PAGE.*,ROW_NUMBER() OVER() AS ROW_ID
FROM
( SELECT id,company_id,company_name,name,users,tags,mt,st,grade,teachmode,description,pic,create_date,change_date,create_people,change_people,audit_status,status
FROM course_base
WHERE (name LIKE '%java%' AND audit_status = '202004') )
AS TMP_PAGE) TMP_PAGE WHERE ROW_ID BETWEEN 1 AND 2
得出了结果:
而后在mapper自定义一个sql语句,这里就不再说了