xml writing of mybatis3 multi-condition query

多条件查询时,用<where>

  <select id="findAllSelective" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from sys_user
    <where>
      <if test="id != null">
        and id = #{id,jdbcType=BIGINT}
      </if>
      <if test="username != null">
        and username = #{username,jdbcType=VARCHAR}
      </if>
    </where>
  </select>

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326775778&siteId=291194637