开发者社区> 问答> 正文

通用mapper 继承InsertListMapper 后 updateByPrimaryKey 配

mapper配置 :

public interface TPreferenceMapper extends Mapper<TPreference>,InsertListMapper<TPreference> {

}

xml 配置:
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="mapperLocations" value="classpath*:com/logistics//service/sqlmapers/.xml" /> <!--<property name="mapperLocations"> <array> <value>classpath:sqlmapers/*Mapper.xml</value> </array> </property>--> <!-- mybatis plugins --> <property name="typeAliasesPackage" value="com.isea533.mybatis.model"/> <property name="plugins"> <array> <bean class="com.github.pagehelper.PageInterceptor"> <!-- 这里的几个配置主要演示如何使用,如果不理解,一定要去掉下面的配置 --> <property name="properties"> <value> helperDialect=mysql </value> </property> </bean> </array> </property> </bean> <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"> <property name="basePackage" value="tk.mybatis.mapper.common.Mapper"/> </bean> <!-- 通用mapper --> <bean class="tk.mybatis.spring.mapper.MapperScannerConfigurer"> <property name="basePackage" value="com.logistics..service.dao"/> <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory" /> <property name="properties"> <value> mappers=tk.mybatis.mapper.common.Mapper,tk.mybatis.mapper.common.special.InsertListMapper IDENTITY=select uuid() notEmpty=true </value> </property> </bean>
代码:

preferenceMapper.updateByPrimaryKey
referenceMapper.selectByPrimaryKey
无效。 无奈改为以下代码可以执行:
TPreference preference = new TPreference();
preference.setUid(qo.getUpreferenceid());
preference = preferenceMapper.selectOne(preference);
preference.setIsdelete(1);

Example example = new Example(TPreference.class);
example.createCriteria().andCondition("uid=",preference.getUid());
Integer flag = preferenceMapper.updateByExample(preference,example);
帮忙看一下 这是怎么回事。

展开
收起
kun坤 2020-06-04 13:12:42 669 0
1 条回答
写回答
取消 提交回答
  • 你实体类中有@Id的字段吗?######代码在下面######

    引用来自“Liuzh_533”的评论

    你实体类中有@Id的字段吗?
     import org.springframework.data.annotation.Id;

    import javax.persistence.Table;

     @Table(name = "t_preference") public class TPreference {

    @Id
    private String uid;
    
    private Integer itype;
    

             ...

    public String getUid() {
        return uid;
    }
    
    public void setUid(String uid) {
        this.uid = uid;
    }
    
    public Integer getItype() {
        return itype;
    }
    
    public void setItype(Integer itype) {
        this.itype = itype;
    }
    
    ...
    
    public TPreference() {
    }
    

    }

    ######无效情况下输出的日志能提供吗?######你好,日志输出在下面######

    引用来自“Liuzh_533”的评论

    无效情况下输出的日志能提供吗?

    代码:

    //        TPreference preference = new TPreference(); //        preference.setUid(qo.getUpreferenceid()); //        preference = preferenceMapper.selectOne(preference); TPreference preference = preferenceMapper.selectByPrimaryKey(qo.getUpreferenceid());//这行报错,日志如下 preference.setIsdelete(1);

        Example example = new Example(TPreference.class);
        example.createCriteria().andCondition("uid=",preference.getUid());
        Integer flag = preferenceMapper.updateByExample(preference,example);
        return flag;</pre> 
    

    日志: [09:25:42.327]|[org.apache.shiro.session.mgt.DefaultSessionManager.retrieveSession line:218] - Unable to resolve session ID from SessionKey [org.apache.shiro.web.session.mgt.WebSessionKey@4a9b3b99].  Returning null to indicate a session could not be found. [09:25:42.330]|[com.logistics.user.service.dao.TPreferenceMapper.selectByPrimaryKey.debug line:139] - ==>  Preparing: SELECT uid,itype,uuserid,ufleetid,ucompanyid,cassociatedid,cbgnprovince,cbgncity,cendprovince,cendcity,isdelete FROM t_preference WHERE uid = ? AND itype = ? AND uuserid = ? AND ufleetid = ? AND ucompanyid = ? AND cassociatedid = ? AND cbgnprovince = ? AND cbgncity = ? AND cendprovince = ? AND cendcity = ? AND isdelete = ?  org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:  ### Error querying database.  Cause: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer ### The error may exist in com/logistics/user/service/dao/TPreferenceMapper.java (best guess) ### The error may involve com.logistics.user.service.dao.TPreferenceMapper.selectByPrimaryKey-Inline ### The error occurred while setting parameters ### SQL: SELECT uid,itype,uuserid,ufleetid,ucompanyid,cassociatedid,cbgnprovince,cbgncity,cendprovince,cendcity,isdelete  FROM t_preference  WHERE  uid = ? AND itype = ? AND uuserid = ? AND ufleetid = ? AND ucompanyid = ? AND cassociatedid = ? AND cbgnprovince = ? AND cbgncity = ? AND cendprovince = ? AND cendcity = ? AND isdelete = ? ### Cause: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer     at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:75)     at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:371)     at com.sun.proxy.$Proxy130.selectOne(Unknown Source)     at org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:163)     at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:68)     at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:52)     at com.sun.proxy.$Proxy146.selectByPrimaryKey(Unknown Source)     at com.logistics.user.service.service.impl.UserServiceImpl.delPreferenceGoods(UserServiceImpl.java:573)     at com.logistics.admin.controller.user.LoadBearController.delPreference(LoadBearController.java:106)     at com.logistics.admin.controller.user.LoadBearController$$FastClassBySpringCGLIB$$c01ccdce.invoke(<generated>)     at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)     at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:720)     at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)     at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:52)     at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)     at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:85)     at com.logistics.admin.aop.LogAspect.doAround(LogAspect.java:133)     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:629)     at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:618)     at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70)     at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)     at org.springframework.aop.aspectj.AspectJAfterAdvice.invoke(AspectJAfterAdvice.java:47)     at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)     at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)     at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)     at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:655)     at com.logistics.admin.controller.user.LoadBearController$$EnhancerBySpringCGLIB$$6591c7aa.delPreference(<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:221)     at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)     at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:114)     at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)     at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)     at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)     at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963)     at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897)     at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)     at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)     at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)     at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)     at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)     at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)     at com.logistics.admin.filter.RequestHeaderFilter.doFilter(RequestHeaderFilter.java:39)     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [09:25:42.349]|[com.logistics.admin.aop.LogAspect.doAfterInServiceLayer line:71] -      at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)     at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ===================接口日志=========================== 请求ID: null     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) 请求人: null     at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449) 请求地址: /bear/del     at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365) 请求时间: 2017-06-22 09:25:42     at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90) 处理用时: 21ms     at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83) 客户端IP: 0:0:0:0:0:0:0:1     at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383) 参数: {"upreferenceid":"93432782-2072-47e4-8741-aba6966ba601"}     at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362) 返回结果: {}     at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) ===================接口日志===========================     at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)     at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:94)     at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)     at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:502)     at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1132)     at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)     at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1533)     at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1489)     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)     at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)     at java.lang.Thread.run(Thread.java:745) Caused by: org.apache.ibatis.exceptions.PersistenceException:  ### Error querying database.  Cause: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer ### The error may exist in com/logistics/user/service/dao/TPreferenceMapper.java (best guess) ### The error may involve com.logistics.user.service.dao.TPreferenceMapper.selectByPrimaryKey-Inline ### The error occurred while setting parameters ### SQL: SELECT uid,itype,uuserid,ufleetid,ucompanyid,cassociatedid,cbgnprovince,cbgncity,cendprovince,cendcity,isdelete  FROM t_preference  WHERE  uid = ? AND itype = ? AND uuserid = ? AND ufleetid = ? AND ucompanyid = ? AND cassociatedid = ? AND cbgnprovince = ? AND cbgncity = ? AND cendprovince = ? AND cendcity = ? AND isdelete = ? ### Cause: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer     at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:26)     at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:111)     at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:102)     at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:66)     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:358)     ... 85 more Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer     at org.apache.ibatis.type.IntegerTypeHandler.setNonNullParameter(IntegerTypeHandler.java:26)     at org.apache.ibatis.type.BaseTypeHandler.setParameter(BaseTypeHandler.java:50)     at org.apache.ibatis.scripting.defaults.DefaultParameterHandler.setParameters(DefaultParameterHandler.java:81)     at org.apache.ibatis.executor.statement.PreparedStatementHandler.parameterize(PreparedStatementHandler.java:80)     at org.apache.ibatis.executor.statement.RoutingStatementHandler.parameterize(RoutingStatementHandler.java:61)     at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:74)     at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:59)     at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:267)     at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:137)     at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:96)     at com.github.pagehelper.PageInterceptor.intercept(PageInterceptor.java:141)     at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:60)     at com.sun.proxy.$Proxy152.query(Unknown Source)     at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:108)     ... 92 more java.lang.ClassCastException: java.lang.Object cannot be cast to java.util.Map     at com.logistics.admin.controller.user.LoadBearController$$EnhancerBySpringCGLIB$$6591c7aa.delPreference(<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:221)     at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)     at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:114)     at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)     at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)     at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)     at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963)     at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897)     at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)     at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)     at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)     at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)     at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)     at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)     at com.logistics.admin.filter.RequestHeaderFilter.doFilter(RequestHeaderFilter.java:39)     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)     at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)     at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)     at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)     at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)     at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)     at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)     at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)     at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)     at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)     at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)     at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:94)     at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)     at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:502)     at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1132)     at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)     at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1533)     at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1489)     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)     at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)     at java.lang.Thread.run(Thread.java:745) java.lang.ClassCastException: java.lang.Object cannot be cast to java.util.Map     at com.logistics.admin.controller.user.LoadBearController$$EnhancerBySpringCGLIB$$6591c7aa.delPreference(<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:221)     at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)     at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:114)     at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)     at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)     at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)     at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963)     at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897)     at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)     at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)     at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)     at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)     at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)     at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)     at com.logistics.admin.filter.RequestHeaderFilter.doFilter(RequestHeaderFilter.java:39)     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)     at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)     at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)     at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)     at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)     at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)     at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)     at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)     at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)     at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)     at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)     at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:94)     at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)     at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:502)     at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1132)     at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)     at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1533)     at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1489)     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)     at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)     at java.lang.Thread.run(Thread.java:745)  ######回复 @Liuzh_533 : 好的######看不出来原因,查询的SQL有问题,如果方便,可以加我QQ120807756,晚上远程看看。######

    引用来自“Liuzh_533”的评论

    无效情况下输出的日志能提供吗?

    代码:

    TPreference preference = new TPreference(); preference.setUid(qo.getUpreferenceid()); preference = preferenceMapper.selectOne(preference); //        TPreference preference = preferenceMapper.selectByPrimaryKey(qo.getUpreferenceid()); preference.setIsdelete(1);

    // Example example = new Example(TPreference.class); // example.createCriteria().andCondition("uid=",preference.getUid()); // Integer flag = preferenceMapper.updateByExample(preference,example); Integer flag = preferenceMapper.updateByPrimaryKey(preference);//更新失败,受影响0

    日志: [09:33:20.731]|[org.apache.shiro.session.mgt.DefaultSessionManager.retrieveSession line:218] - Unable to resolve session ID from SessionKey [org.apache.shiro.web.session.mgt.WebSessionKey@11428f2a].  Returning null to indicate a session could not be found. [09:33:20.734]|[com.logistics.user.service.dao.TPreferenceMapper.selectOne.debug line:139] - ==>  Preparing: SELECT uid,itype,uuserid,ufleetid,ucompanyid,cassociatedid,cbgnprovince,cbgncity,cendprovince,cendcity,isdelete FROM t_preference WHERE uid = ?  [09:33:20.735]|[com.logistics.user.service.dao.TPreferenceMapper.selectOne.debug line:139] - ==> Parameters: 93432782-2072-47e4-8741-aba6966ba601(String) [09:33:20.736]|[com.logistics.user.service.dao.TPreferenceMapper.selectOne.debug line:139] - <==      Total: 1 [09:33:20.739]|[com.logistics.user.service.dao.TPreferenceMapper.u

    2020-06-05 13:16:08
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
继承与功能组合 立即下载
低代码开发师(初级)实战教程 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载