qq_37990007
qq_37990007
2021-06-10 12:29
采纳率: 100%
浏览 45
已采纳

Mybatis连接查询查询不到数据,但是把参数和语句写在SQlServer中能查到

控制台输出的是==>  Preparing: select count(*) as count from( select * from ( select d.order_id,d.agent,d.order_number,d.model,d.order_quantity,d.nocheduled_quantity ,d.acceptance_date,d.delivery_date,d.norder_number,d.shipserver,d.dischargeserver,d.navigationarea,d.state,d.order_remarks, e.progress_id,e.machine_number,e.task_number,e.progress_state,e.progress_investment,e.progress_online,e.progress_offline,e.progress_testrun,e.progress_finished, e.progress_shipment,e.progress_remarks from order1 d left join (select * from progress) e on d.order_id=e.order_id )f where 1=1 and progress_investment >= ? )g
==> Parameters: 2021-06-01(String)
<==    Columns: count
<==        Row: 0
<==      Total: 1
Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@5c9d1904]
Creating a new SqlSession
SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@44b11bf6] was not registered for synchronization because synchronization is not active
JDBC Connection [HikariProxyConnection@1996920418 wrapping ConnectionID:1 ClientConnectionId: 2aaaf779-5d90-42e8-975f-89ff90b131e4] will not be managed by Spring
==>  Preparing: select * from( select top 0 * from( select top 0* FROM (select * from (select d.order_id,d.agent,d.order_number,d.model,d.order_quantity,d.nocheduled_quantity ,d.acceptance_date,d.delivery_date,d.norder_number,d.shipserver,d.dischargeserver,d.navigationarea,d.state,d.order_remarks, e.progress_id,e.machine_number,e.task_number,e.progress_state,e.progress_investment,e.progress_online,e.progress_offline,e.progress_testrun,e.progress_finished, e.progress_shipment,e.progress_remarks from order1 d left join (select * from progress) e on d.order_id=e.order_id)d where 1=1 and progress_investment >= ? )a order by order_id desc )b order by order_id asc )c order by order_id desc
==> Parameters: 2021-06-01(String)
<==      Total: 0

但是在sqlserver中使用相同的语句,和参数能查询到数据,能帮我看看这是什么问题,应该怎么解决呢?(datetime类型的日期查询查询不到,其它参数能查到)

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

4条回答 默认 最新

  • technologist_36
    CSDN专家-sinjack 2021-06-10 12:37
    已采纳

    不加条件的情况下,能不能查询到。检查一下mapper.xml中返回的类型。

    点赞 1 评论
  • technologist_48
    CSDN专家-Fay 2021-06-10 12:38

    查询分析器中能查询因为是静态传参,程序中查不到是因为参数是变量,重点排查参数是否传递正确,或者可以在程序中先使用静态数据测试

    点赞 1 评论
  • qq_37990007
    qq_37990007 2021-06-10 16:08

    问题已得到解决,感谢各位专家的解答。

    点赞 评论
  • QA_Assistant
    有问必答小助手 2021-06-11 11:14

    您好,我是有问必答小助手,您的问题已经有小伙伴解答了,您看下是否解决,可以追评进行沟通哦~

    如果有您比较满意的答案 / 帮您提供解决思路的答案,可以点击【采纳】按钮,给回答的小伙伴一些鼓励哦~~

    ps:问答VIP仅需29元,即可享受5次/月 有问必答服务,了解详情>>>https://vip.csdn.net/askvip?utm_source=1146287632

    点赞 评论

相关推荐