1 回答

TA貢獻1818條經(jīng)驗 獲得超11個贊
問題已解決,在MyBatis的xml中替換成了when標簽,并且在判斷時,將判斷的值加上toString(),參數(shù)名為_parameter,不需要指定成傳入的參數(shù)名,參考代碼如下:
<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>
添加回答
舉報