發現mybatis-plus 3.4.1與pagehelper-spring-boot-starter 1.4.7有衝突,編譯時能成功,但是運行時,查詢記錄條數拼接出來的count() 會運行異常!
2024-05-07 08:42:54,177|WARN|org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver|207|Resolved [org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: com.microsoft.sqlserver.jdbc.SQLServerException: COUNT 函數要求有 1 個參數。 ### The error may exist in com/soft/htgl/mapper/JtjyNcctoszyyHtqdMapper.java (best guess) ### The error may involve defaultParameterMap ### The error occurred while setting parameters ### SQL: SELECT COUNT() FROM JTJY_NCCToSZYY_HTQD WHERE (groupid = ?) ### Cause: com.microsoft.sqlserver.jdbc.SQLServerException: COUNT 函數要求有 1 個參數。]
解決方法:將pagehelper-spring-boot-starter降爲1.4.4即可!