MyBatis中只傳一個String引數時要注意的事項
阿新 • • 發佈:2019-01-03
引數名為_parameter,不需要指定成傳入的引數名,參考程式碼如下:
<select id="getLoop" resultMap="AAA" parameterType="String"> SELECT *, ROWNUM RN from tablename <where> <choose> <when test="_parameter != null and _parameter == '1'.toString()"> RN<=100000 and RN >=1 </when> <when test="_parameter != null and _parameter == '2'.toString()"> RN <=200000 and RN >=100001 </when> <when test="_parameter != null and _parameter == '3'.toString()"> RN <=300000 and RN >=200001 </when> <otherwise> RN <=1 and RN >=1 </otherwise> </choose> </where> </select>