mybatis中判断两个集合是否为空

在工作中遇到mybatis中判断两个集合是否为空,不为空的话遍历;都为空执行  1=0 or 1=0,则查询出来空集合

select login,name,email from users u where

    test="sameEmailList != null and sameEmailList.size > 0 ">
        email in collection="sameEmailList" item="email" open="(" separator="," close=")">
        #{email, jdbcType=VARCHAR}
        
    
    
        1 = 0
    


    test="sameNameList != null and sameNameList.size > 0">
        or name in collection="sameNameList" item="name" open="(" separator="," close=")">
        #{name, jdbcType=VARCHAR}
    
    
    
        or 1 = 0
    

ORDER by name, email ASC


你可能感兴趣的:(MySQL)