The plug-in currently supports the following database of physical pages :
Oracle
Mysql
MariaDB
SQLite
Hsqldb
PostgreSQL
DB2
SqlServer(2005,2008)
Informix
H2
SqlServer2012
Derby
Phoenix
-
Dream up a database
-
Ali cloud PPAS
5.1.10
In 5.1.0 --2017-08-28 release, increasing ReplaceSql
the interface for processing sqlServer the with(nolock)
problem, increase the pertinence of replaceSql
the parameter, optional values simple
, and regex
, or to achieve a fully qualified class name ReplaceSql interface. The default value is simple
still using the original manner, the new regex
will as table with(nolock)
treatment is table_PAGEWITHNOLOCK
.
This update is only from the default values simple
instead of regex
using the regex
way of almost 100% solve the paging problem sqlServer.
Starter upgrade to 1.2.12
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.2.12</version>
</dependency>
The following are examples of two issue.
Examples of SQL # 76
Original SQL:
SELECT *
FROM
forum_post_info a with(nolock)
LEFT JOIN forum_carcase_tags as b with(nolock) on a.id = b.carcase_id where b.tag_id = 127
Conversion of Count SQL:
SELECT COUNT(0)
FROM forum_post_info a WITH (NOLOCK)
LEFT JOIN forum_carcase_tags b WITH (NOLOCK) ON a.id = b.carcase_id
WHERE b.tag_id = 127
Conversion tab SQL:
SELECT TOP 10 *
FROM (
SELECT ROW_NUMBER() OVER (ORDER BY RAND()) AS PAGE_ROW_NUMBER, *
FROM (
SELECT *
FROM forum_post_info a WITH (NOLOCK)
LEFT JOIN forum_carcase_tags b WITH (NOLOCK) ON a.id = b.carcase_id
WHERE b.tag_id = 127
) PAGE_TABLE_ALIAS
) PAGE_TABLE_ALIAS
WHERE PAGE_ROW_NUMBER > 1
ORDER BY PAGE_ROW_NUMBER
Examples of SQL # 398
Original SQL:
Select AUS.ScheduleID, AUS.SystemID, AUS.ClinicID, AUS.DoctorID, AUS.ScheduleDate,
AUS.StartTime, AUS.EndTime, AUS.Status, AUS.BookBy, AUS.Note, AUS.Remark, AUS.SourceType, CM.CompanyName,
AU.UserName As DoctorName, AU.UserNumber As DoctorNumber, CC.CodeDesc As ClinicName, CD.Lat, CD.Lng,
CD.ContactTel, CD.Address, CR.ConsultationStatusID, CR.RegisterStatus,A1.CodeDesc as AreaLevel1, A2.CodeDesc as AreaLevel2
From ACM_User_Schedule AUS with(nolock)
Left Join Client_Register CR with(nolock) On AUS.BookBy=CR.ClientID And CR.SourceType='F' And AUS.ClientRegisterNum=CR.ClientRegisterNum
Inner Join ACM_User AU with(nolock) On AU.UserID = AUS.DoctorID
Inner Join Code_Clinic CC with(nolock) On AUS.ClinicID=CC.CodeID
Inner Join Clinic_Detail CD with(nolock) On CC.CodeID = CD.ClinicID
Inner Join Code_Area A1 with(nolock) On CD.AreaLevel1ID=A1.CodeID
Inner Join Code_Area A2 with(nolock) On CD.AreaLevel2ID=A2.CodeID
Inner Join Company_Master CM with(nolock) On CC.SystemID = CM.SystemID
Where BookBy=1
Conversion of Count SQL:
SELECT COUNT(0)
FROM ACM_User_Schedule AUS WITH (NOLOCK)
LEFT JOIN Client_Register CR WITH (NOLOCK)
ON AUS.BookBy = CR.ClientID
AND CR.SourceType = 'F'
AND AUS.ClientRegisterNum = CR.ClientRegisterNum
INNER JOIN ACM_User AU WITH (NOLOCK) ON AU.UserID = AUS.DoctorID
INNER JOIN Code_Clinic CC WITH (NOLOCK) ON AUS.ClinicID = CC.CodeID
INNER JOIN Clinic_Detail CD WITH (NOLOCK) ON CC.CodeID = CD.ClinicID
INNER JOIN Code_Area A1 WITH (NOLOCK) ON CD.AreaLevel1ID = A1.CodeID
INNER JOIN Code_Area A2 WITH (NOLOCK) ON CD.AreaLevel2ID = A2.CodeID
INNER JOIN Company_Master CM WITH (NOLOCK) ON CC.SystemID = CM.SystemID
WHERE BookBy = 1
Conversion tab SQL:
SELECT TOP 10 ScheduleID, SystemID, ClinicID, DoctorID, ScheduleDate
, StartTime, EndTime, Status, BookBy, Note
, Remark, SourceType, CompanyName, DoctorName, DoctorNumber
, ClinicName, Lat, Lng, ContactTel, Address
, ConsultationStatusID, RegisterStatus, AreaLevel1, AreaLevel2
FROM (
SELECT ROW_NUMBER() OVER (ORDER BY RAND()) AS PAGE_ROW_NUMBER, ScheduleID, SystemID, ClinicID, DoctorID
, ScheduleDate, StartTime, EndTime, Status, BookBy
, Note, Remark, SourceType, CompanyName, DoctorName
, DoctorNumber, ClinicName, Lat, Lng, ContactTel
, Address, ConsultationStatusID, RegisterStatus, AreaLevel1, AreaLevel2
FROM (
SELECT AUS.ScheduleID, AUS.SystemID, AUS.ClinicID, AUS.DoctorID, AUS.ScheduleDate
, AUS.StartTime, AUS.EndTime, AUS.Status, AUS.BookBy, AUS.Note
, AUS.Remark, AUS.SourceType, CM.CompanyName, AU.UserName AS DoctorName, AU.UserNumber AS DoctorNumber
, CC.CodeDesc AS ClinicName, CD.Lat, CD.Lng, CD.ContactTel, CD.Address
, CR.ConsultationStatusID, CR.RegisterStatus, A1.CodeDesc AS AreaLevel1, A2.CodeDesc AS AreaLevel2
FROM ACM_User_Schedule AUS WITH (NOLOCK)
LEFT JOIN Client_Register CR WITH (NOLOCK)
ON AUS.BookBy = CR.ClientID
AND CR.SourceType = 'F'
AND AUS.ClientRegisterNum = CR.ClientRegisterNum
INNER JOIN ACM_User AU WITH (NOLOCK) ON AU.UserID = AUS.DoctorID
INNER JOIN Code_Clinic CC WITH (NOLOCK) ON AUS.ClinicID = CC.CodeID
INNER JOIN Clinic_Detail CD WITH (NOLOCK) ON CC.CodeID = CD.ClinicID
INNER JOIN Code_Area A1 WITH (NOLOCK) ON CD.AreaLevel1ID = A1.CodeID
INNER JOIN Code_Area A2 WITH (NOLOCK) ON CD.AreaLevel2ID = A2.CodeID
INNER JOIN Company_Master CM WITH (NOLOCK) ON CC.SystemID = CM.SystemID
WHERE BookBy = 1
) PAGE_TABLE_ALIAS
) PAGE_TABLE_ALIAS
WHERE PAGE_ROW_NUMBER > 1
ORDER BY PAGE_ROW_NUMBER
SQL through https://tool.oschina.net/codeformat/sql format.