为了方便创建实体类,我直接添加了@AllArgsConstructor注解,然后在查询数据库的时候就出现了错误:

Creating a new SqlSession
SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@723e5ca6] was not registered for synchronization because synchronization is not active
JDBC Connection [HikariProxyConnection@844208069 wrapping com.mysql.cj.jdbc.ConnectionImpl@4cfcac13] will not be managed by Spring
==>  Preparing: SELECT id,file_name,file_path,size,content_type,expiration_time,create_time,update_time FROM single_file WHERE id=?
==> Parameters: 1921124002837721088(String)
<==    Columns: id, file_name, file_path, size, content_type, expiration_time, create_time, update_time
<==        Row: 1921124002837721088, 992695.png, D:\Projects\FileBox\file\2025\05\10, 296762, application/octet-stream, null, 2025-05-10 16:43:49, 2025-05-10 16:43:49
Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@723e5ca6]
2025-05-10T16:55:48.274+08:00 ERROR 24268 --- [FileBox] [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed: org.mybatis.spring.MyBatisSystemException: 
### Error querying database.  Cause: org.apache.ibatis.executor.result.ResultMapException: Error attempting to get column 'file_path' from result set.  Cause: java.lang.NumberFormatException: For input string: "D:\Projects\FileBox\file\2025\05\10"
### The error may exist in site/lazyking/filebox/mapper/SingleFileMapper.java (best guess)
### The error may involve site.lazyking.filebox.mapper.SingleFileMapper.selectById
### The error occurred while handling results
### SQL: SELECT id,file_name,file_path,size,content_type,expiration_time,create_time,update_time FROM single_file WHERE id=?
### Cause: org.apache.ibatis.executor.result.ResultMapException: Error attempting to get column 'file_path' from result set.  Cause: java.lang.NumberFormatException: For input string: "D:\Projects\FileBox\file\2025\05\10"] with root cause
java.lang.NumberFormatException: For input string: "D:\Projects\FileBox\file\2025\05\10"
at java.base/jdk.internal.math.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2054) ~[na:na]
at java.base/jdk.internal.math.FloatingDecimal.parseDouble(FloatingDecimal.java:110) ~[na:na]

经过研究,是应为Mybatis是通过无参构造创建的对象,然后再将数据保存在其中。所以只需要实体类又无参构造就行了。
可以添加@NoArgsConstructor注解也可以直接添加代码。