一、该问题的重现步骤是什么?
1. 代码生成,选择的表包含 Costs字段,系统生成的代码,然后,重新启动idea
2. 访问新生成的代码的List API,返回错误
3.将实体类的costs字段注释,再此访问list接口,返回正常的数据
二、你期待的结果是什么?实际看到的又是什么?
实体类能使用costs字段,现在带上这个字段就报错
三、你正在使用的是什么产品,什么版本?在什么操作系统上?
bladex boot ,2.9 版本,mssql数据库,win10系统
四、请提供详细的错误堆栈信息,这很重要。
2022-03-28 10:47:23.010 ERROR 48412 --- [nio-8080-exec-1] o.s.c.l.e.BladeRestExceptionTranslator : 服务器异常
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: Failed to process, Error SQL: SELECT RecordId,Thisdate,Doc_person,Dept_code,Wh_code,Com_id,Batch_no,SupStorage,ReqStorage,Quantity,Com_type,Storein_Code,Myrow_id,Visible,Pro_date,Validity,Storein_price,Costs,Price_taxed,costs_taxed,storein_discount,Read_Person FROM MoveStorage_Record
### Cause: com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: Failed to process, Error SQL: SELECT RecordId,Thisdate,Doc_person,Dept_code,Wh_code,Com_id,Batch_no,SupStorage,ReqStorage,Quantity,Com_type,Storein_Code,Myrow_id,Visible,Pro_date,Validity,Storein_price,Costs,Price_taxed,costs_taxed,storein_discount,Read_Person FROM MoveStorage_Record
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:96)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy143.selectList(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:224)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.executeForIPage(MybatisMapperMethod.java:122)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:86)
at com.baomidou.mybatisplus.core.override.MybatisMapperProxy$PlainMethodInvoker.invoke(MybatisMapperProxy.java:148)
at com.baomidou.mybatisplus.core.override.MybatisMapperProxy.invoke(MybatisMapperProxy.java:89)
at com.sun.proxy.$Proxy311.selectPage(Unknown Source)
at com.baomidou.mybatisplus.extension.service.IService.page(IService.java:298)
at com.baomidou.mybatisplus.extension.service.IService$$FastClassBySpringCGLIB$$f8525d18.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688)
at org.springblade.yaoshenapi.service.impl.MovestorageRecordServiceImpl$$EnhancerBySpringCGLIB$$49e46b57.page(<generated>)
at org.springblade.yaoshenapi.controller.MovestorageRecordController.list(MovestorageRecordController.java:69)
at org.springblade.yaoshenapi.controller.MovestorageRecordController$$FastClassBySpringCGLIB$$1045ab31.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:779)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:750)
at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:88)
at org.springblade.core.log.aspect.RequestLogAspect.aroundApi(RequestLogAspect.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:644)
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:633)
at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:175)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:750)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:95)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:750)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:692)
at org.springblade.yaoshenapi.controller.MovestorageRecordController$$EnhancerBySpringCGLIB$$c441ff08.list(<generated>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:105)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:878)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:792)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:497)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:584)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.springblade.core.log.filter.LogTraceFilter.doFilter(LogTraceFilter.java:39)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.springblade.core.boot.request.BladeRequestFilter.doFilter(BladeRequestFilter.java:58)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:124)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:893)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1707)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: Failed to process, Error SQL: SELECT RecordId,Thisdate,Doc_person,Dept_code,Wh_code,Com_id,Batch_no,SupStorage,ReqStorage,Quantity,Com_type,Storein_Code,Myrow_id,Visible,Pro_date,Validity,Storein_price,Costs,Price_taxed,costs_taxed,storein_discount,Read_Person FROM MoveStorage_Record
### Cause: com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: Failed to process, Error SQL: SELECT RecordId,Thisdate,Doc_person,Dept_code,Wh_code,Com_id,Batch_no,SupStorage,ReqStorage,Quantity,Com_type,Storein_Code,Myrow_id,Visible,Pro_date,Validity,Storein_price,Costs,Price_taxed,costs_taxed,storein_discount,Read_Person FROM MoveStorage_Record
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:149)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:140)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:427)
... 90 common frames omitted
Caused by: com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: Failed to process, Error SQL: SELECT RecordId,Thisdate,Doc_person,Dept_code,Wh_code,Com_id,Batch_no,SupStorage,ReqStorage,Quantity,Com_type,Storein_Code,Myrow_id,Visible,Pro_date,Validity,Storein_price,Costs,Price_taxed,costs_taxed,storein_discount,Read_Person FROM MoveStorage_Record
at com.baomidou.mybatisplus.core.toolkit.ExceptionUtils.mpe(ExceptionUtils.java:39)
at com.baomidou.mybatisplus.extension.parser.JsqlParserSupport.parserSingle(JsqlParserSupport.java:52)
at com.baomidou.mybatisplus.extension.plugins.inner.TenantLineInnerInterceptor.beforeQuery(TenantLineInnerInterceptor.java:70)
at com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor.intercept(MybatisPlusInterceptor.java:78)
at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:61)
at com.sun.proxy.$Proxy344.query(Unknown Source)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:147)
... 96 common frames omitted
Caused by: net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "Costs" "COSTS"
at line 1, column 174.
Was expecting one of:
"!"
"("
"*"
"+"
"-"
":"
"?"
"@"
"@@"
"ACTION"
"ALL"
"ANY"
"BYTE"
"CASCADE"
"CASE"
"CAST"
"CHANGE"
"CHAR"
"CHARACTER"
"COLUMN"
"COLUMNS"
"COMMENT"
"COMMIT"
"CREATE"
"CURRENT"
"CYCLE"
"DESC"
"DESCRIBE"
"DISABLE"
"DIV"
"DO"
"DOUBLE"
"DUPLICATE"
"ENABLE"
"END"
"EXCLUDE"
"EXISTS"
"EXTRACT"
"FALSE"
"FIRST"
"FN"
"FOLLOWING"
"FORMAT"
"GROUP"
"GROUP_CONCAT"
"IF"
"IIF"
"INDEX"
"INSERT"
"INTERVAL"
"ISNULL"
"KEY"
"LAST"
"LEFT"
"LIMIT"
"MATCH"
"MATERIALIZED"
"NEXTVAL"
"NO"
"NOLOCK"
"NOT"
"NULL"
"NULLS"
"OF"
"OFFSET"
"ON"
"OPEN"
"OPTIMIZE"
"ORDER"
"OVER"
"PARTITION"
"PATH"
"PERCENT"
"PRECISION"
"PRIMARY"
"PRIOR"
"PROCEDURE"
"PUBLIC"
"RANGE"
"READ"
"REPLACE"
"RIGHT"
"ROW"
"ROWS"
"SCHEMA"
"SEPARATOR"
"SEQUENCE"
"SESSION"
"SET"
"SIBLINGS"
"SIZE"
"SOME"
"START"
"TABLE"
"TABLES"
"TEMP"
"TEMPORARY"
"TO"
"TOP"
"TRUE"
"TRUNCATE"
"TYPE"
"UNSIGNED"
"VALIDATE"
"VALUE"
"VALUES"
"VIEW"
"XML"
"XMLSERIALIZE"
"ZONE"
"{"
"{d"
"{t"
"{ts"
"~"
<K_DATETIMELITERAL>
<K_DATE_LITERAL>
<K_TIME_KEY_EXPR>
<S_CHAR_LITERAL>
<S_DOUBLE>
<S_HEX>
<S_IDENTIFIER>
<S_LONG>
<S_QUOTED_IDENTIFIER>
at net.sf.jsqlparser.parser.CCJSqlParser.generateParseException(CCJSqlParser.java:26538)
at net.sf.jsqlparser.parser.CCJSqlParser.jj_consume_token(CCJSqlParser.java:26377)
at net.sf.jsqlparser.parser.CCJSqlParser.SelectItem(CCJSqlParser.java:5038)
at net.sf.jsqlparser.parser.CCJSqlParser.SelectItemsList(CCJSqlParser.java:4789)
at net.sf.jsqlparser.parser.CCJSqlParser.PlainSelect(CCJSqlParser.java:4273)
at net.sf.jsqlparser.parser.CCJSqlParser.SetOperationList(CCJSqlParser.java:4496)
at net.sf.jsqlparser.parser.CCJSqlParser.SelectBody(CCJSqlParser.java:4163)
at net.sf.jsqlparser.parser.CCJSqlParser.Select(CCJSqlParser.java:4158)
at net.sf.jsqlparser.parser.CCJSqlParser.SingleStatement(CCJSqlParser.java:130)
at net.sf.jsqlparser.parser.CCJSqlParser.Statement(CCJSqlParser.java:81)
at net.sf.jsqlparser.parser.CCJSqlParserUtil.parseStatement(CCJSqlParserUtil.java:163)
at net.sf.jsqlparser.parser.CCJSqlParserUtil.parse(CCJSqlParserUtil.java:59)
at net.sf.jsqlparser.parser.CCJSqlParserUtil.parse(CCJSqlParserUtil.java:37)
at com.baomidou.mybatisplus.extension.parser.JsqlParserSupport.parserSingle(JsqlParserSupport.java:49)
... 101 common frames omitted
五、若有更多详细信息,请在下面提供。
SELECT RecordId,Thisdate,Doc_person,Dept_code,Wh_code,Com_id,Batch_no,SupStorage,ReqStorage,Quantity,Com_type,Storein_Code,Myrow_id,Visible,Pro_date,Validity,Storein_price,Costs,Price_taxed,costs_taxed,storein_discount,Read_Person FROM MoveStorage_Record
这段sql拿去数据库执行一下,如果也不行,就要把字段名换一下。
这个语句在数据库中运行时没问题的,正常
升级框架到2.9.1,问题解决
麻烦帮忙看一下,我们很多表有这个字段
2022-04-01 添加
升级到bladex到2.9.1版本,问题解决
扫一扫访问 Blade技术社区 移动端