weixin_43634763 2019-01-18 19:45 采纳率: 100%
浏览 3494
已采纳

使用updateByPrimaryKeySelective生成的sql语句的where后除了id还有其他字段???导致更新失败

我有两个service都用了updateByPrimaryKeySelective
有一个成功了还有一个失败了。该如何解决这个问题?

成功那个打印出的sql

2019-01-18 19:43:50.550 DEBUG 9924 --- [nio-8080-exec-6] c.p.h.m.u.P.updateByPrimaryKeySelective  : ==>  Preparing: UPDATE sys_permission SET id = id,parent_id = ?,sort = ?,per_type = ?,is_show = ? WHERE id = ? 

2019-01-18 19:43:50.550 DEBUG 9924 --- [nio-8080-exec-6] c.p.h.m.u.P.updateByPrimaryKeySelective  : ==> Parameters: 1(Integer), 12(Integer), 0(Integer), 1(Integer), 65(Integer)

失败那个打印出的sql

2019-01-18 19:30:27.376 DEBUG 9924 --- [nio-8080-exec-8] c.p.h.m.u.U.updateByPrimaryKeySelective  : ==>  Preparing: UPDATE sys_user SET id = ?,password = ?,phone = ?,update_time = ?,status = ?,rid = ? WHERE id = ? AND username = ? AND password = ? AND phone = ? AND gender = ? AND create_time = ? AND update_time = ? AND status = ? AND rid = ? 

2019-01-18 19:30:27.377 DEBUG 9924 --- [nio-8080-exec-8] c.p.h.m.u.U.updateByPrimaryKeySelective  : ==> Parameters: 2(Long), 123456(String), 123456654(String), 2019-01-18 19:30:27.376(Timestamp), 0(Integer), 1(Integer), 2(Long), null, 123456(String), 123456654(String), null, null, 2019-01-18 19:30:27.376(Timestamp), 0(Integer), 1(Integer)

  • 写回答

2条回答

  • weixin_43634763 2019-01-24 11:26
    关注

    终于发现问题所在,就是实体类的id用的是Long类型,而我service层用的是Integer类型,把实体类的也改为Integer就成功了

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料