mybatis <if test else、mybatis多种情况的判断

mybatis没有if test else的写法,只能用choose when :

D:\szw\zjy-v2\com.cloud.apps\src\main\resources\mapper\exam\TbSchoolExamMapper.xml

        <choose>
            <when test="classList.size()>0">
                AND    tsa.CLASS_GID  IN
                <foreach collection="classList" item="item" index="index"  open="(" separator="," close=")">
                    #{item.classGid}
                </foreach>
            </when>
            <otherwise>
                AND    tsa.CLASS_GID  IN ('')
            </otherwise>
        </choose>

上一篇:【MySql】Update批量更新与批量更新多条记录的不同值实现方法


下一篇:sql 一条语句实现插入和更新