2017-11-17 4 views
0

Verwendung:Database Ausführungsergebnisse und Mybatis Ausführungsergebnisse sind widersprüchlich

1.mysql 5.6.36 
2.mybatis 3.4.5 

in der Datenbank, i exceute die vier sql, hier die Protokolle:

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 

und ich finde jetzt die ersten drei konsistent mit der Datenbank, aber die letzte ist error.when ich es in der Datenbank ausführen, kann ich das richtige Ergebnis erhalten.

hier mein mapper.xml ist:

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

in Datenbank, erhalte ich dieses Ergebnis:

enter image description here

i upset.i bin weiß nicht, warum.

Antwort

0

Reslove. Ich spezifiziere die Kodierung mit utf8.

Verwandte Themen