MyBatis中只傳一個String參數時要注意的事項


參數名為_parameter,不需要指定成傳入的參數名,參考代碼如下:

<select id="getLoop" resultMap="AAA" parameterType="String">     
    SELECT *, ROWNUM RN from tablename
        <where>    
            <choose>    
                <when test="_parameter != null and _parameter == '1'.toString()">    
                    RN &lt;=100000  and RN &gt;=1   
                </when>   
                <when test="_parameter != null and _parameter == '2'.toString()">    
                    RN &lt;=200000  and RN &gt;=100001   
                </when>
                <when test="_parameter != null and _parameter == '3'.toString()">    
                    RN &lt;=300000  and RN &gt;=200001   
                </when>        
                <otherwise>    
                    RN &lt;=1  and RN &gt;=1     
                </otherwise>    
            </choose>    
        </where>   
</select>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM