2017-11-17 600 views
0

使用:データベースの実行結果とMyBatisの実行結果が矛盾している

SqlSession [[email protected]] was not registered for synchronization because synchronization is not active 
JDBC Connection [jdbc:mysql://xxxx/xxxx, [email protected], MySQL-AB JDBC Driver] will not be managed by Spring 
==> Preparing: select IFNULL(count(*),0) from goods_info 
==> Parameters: 
<== Columns: IFNULL(count(*),0) 
<==  Row: 149 
<==  Total: 1 
Closing non transactional SqlSession [[email protected]] 
Creating a new SqlSession 
SqlSession [[email protected]] was not registered for synchronization because synchronization is not active 
JDBC Connection [jdbc:mysql://xxxx/xxxx, [email protected], MySQL-AB JDBC Driver] will not be managed by Spring 
==> Preparing: select sum(browsed_times) from goods_info 
==> Parameters: 
<== Columns: sum(browsed_times) 
<==  Row: 10128 
<==  Total: 1 
Closing non transactional SqlSession [[email protected]] 
Creating a new SqlSession 
SqlSession [[email protected]] was not registered for synchronization because synchronization is not active 
JDBC Connection [jdbc:mysql://xxxx/xxxx, [email protected], MySQL-AB JDBC Driver] will not be managed by Spring 
==> Preparing: select IFNULL(count(*),0) from user 
==> Parameters: 
<== Columns: IFNULL(count(*),0) 
<==  Row: 694 
<==  Total: 1 
Closing non transactional SqlSession [[email protected]] 
Creating a new SqlSession 
SqlSession [[email protected]] was not registered for synchronization because synchronization is not active 
JDBC Connection [jdbc:mysql://xxxx/xxxxx, [email protected], MySQL-AB JDBC Driver] will not be managed by Spring 
==> Preparing: select IFNULL(sum(total_price),0) from order_build where order_status = '已支付' 
==> Parameters: 
<== Columns: IFNULL(sum(total_price),0) 
<==  Row: 0.00 
<==  Total: 1 

、今私は最初の3である見つける:データベース内

1.mysql 5.6.36 
2.mybatis 3.4.5 

は、私はここで、ログを4つのSQLをexceuteデータベースと一貫性がありますが、最後はエラーです。データベースでそれを実行すると正しい結果が得られます。

はここに私のmapper.xmlです:

enter image description here

私はupset.iはな​​ぜ知っている `tをしています:データベース内

<select id="getTotalMoney" resultType="String"> 
    select IFNULL(sum(total_price),0) 
    from order_build 
    where order_status = 
    '已支付' 
</select> 

、私はこの結果を得ます。

答えて

0

Reslove。 私はutf8でエンコーディングを指定します。

関連する問題