MyBatis中动态SQL语句完成多条件查询

 
<select id="queryEmp"  resultType="cn.test.entity.Emp">
          select * from emp where 1=1
          <if test="deptNo!=null">
          and deptno=#{deptNO}
          </if>
          <if test="deptName!=null">
          and deptno=#{deptName}
          </if>
          </select>
posted @ 2018-03-26 23:06  青蛙跳跳  阅读(107)  评论(0编辑  收藏  举报