weixin_44184703 2019-03-20 11:16 采纳率: 0%
浏览 1021

mybatis怎么传带<where><if>..标签的sql,急急急在线等!!!!!!

图片说明
传任意带动态标签的sql,!!!

  • 写回答

3条回答 默认 最新

  • 故木 2019-03-20 11:27
    关注
    select * from user
    <where>
    
     <if test="id != null ">id=#{id}</if>
    
    <if test="name != null and name.length()>0" >and name=#{name}</if>
    
    <if test="gender != null and gender.length()>0">and gender = #{gender}</if>
    
    </where>
    
        根据test的值 来判定是否显示if标签中的语句
    
    评论

报告相同问题?