The problem of arithmetic Operation of mybatis dynamic sql

the dynamic sql of mybatis is as follows in the xml file:


    count( DISTINCT item.RECORD_ID ) AS borrowNum -- ()
</if>

as above, I want to judge whether the eachBook field is 0 or 1 . May I ask how to write it? I didn"t say it even after reading the official mybatis document.

those who want to know will let me know, thank you.

Mar.28,2021

MyBatis is parsed using OGNL expressions, so to determine that a variable is equal to a certain value, use the following:

<if test='optionType == "1" '>

</if>

or

<if test="optionType == '1'.toString() ">

</if>

or

<if test="optionType == "1" ">

</if>

Why not use case when statement blocks


select sno,sname,age,saddress,
(case sex 
    when '0' then '' 
    when '1' then '' 
 else '' end) as  

from stud;
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eafa80-2277.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eafa80-2277.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?