美文网首页
MyBatis传入单个参数

MyBatis传入单个参数

作者: Hello_豆包 | 来源:发表于2017-04-14 10:05 被阅读0次

    在mybatis的使用中有时候需要传入一个简单参数,又需要对它进行判断,在判断时可以用 _parameter 进行替代

    <select id="selectByCid" parameterType="Integer" resultType="Category">
        select id,enterimg,name,number,outimg,remark,cid from category
        <where>
            <choose>
            
                <when test=" _parameter!=null">
                    cid=#{cid}
                </when>
                
                <otherwise>
                    cid is null
                </otherwise>
    
            </choose>
    
        </where>
    </select>

    相关文章

      网友评论

          本文标题: MyBatis传入单个参数

          本文链接:https://www.haomeiwen.com/subject/dhkwattx.html