<If test = "type == '0'"> Analyzing this problem did not go

if in the judgment of MyBatis mapp file is written like this

<= Test if "type == '0'">
and so1.id = # {unitcode}
</ if>
causing the problem is that if this did not go judgment, the condition and so1.id = # {unitcode} He did not add. Cause if the judge does not execute sql, run the program without error, without any prompting. Remove takeWay == "1" and can be implemented. I am puzzled,

   Read:

<= IF Test "type == '0'.toString ()">
and so1.id unitcode = # {}
</ IF>
or changed:

<Test = IF 'type == "0"'>
and so1.id unitcode = # {}
</ IF>
This can be used.

Principle Analysis:

mybatis OGNL expression is resolved, the expression of OGNL, '1' is resolved into characters, java are strongly typed, char and a string leads to varying, so that if the label is not sql resolution.
Summary The following use: a single character to be written using double quotes or .toString () for the job!
 

Guess you like

Origin www.cnblogs.com/timao/p/11420357.html