欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

MyBatis多条件查询

程序员文章站 2022-03-01 17:24:26
...

DAO:

List<LimitApply> selectInformationByOptions(Map<String, Object> map );

MAPPER:

  <select id="selectInformationByOptions" resultMap="BaseResultMap" parameterType="java.util.HashMap">
    select
    <include refid="Base_Column_List" />
    from TB_LIMIT_APPLY
    where DEPARTMENT_ID = #{did}
      and STATE =#{state}
    <if test="startTime!=null">
     and  APPLY_TIME &gt;= #{startTime}  
     </if>
     <if test="endTime!=null">
     and  APPLY_TIME &lt;=#{endTime}
     </if>
    ORDER BY APPLY_TIME DESC 

  </select>

注意的是”>”和“<”在MAPPER文件中要用&gt;&lt;代替

<script type="text/javascript"> $(function () { $('pre.prettyprint code').each(function () { var lines = $(this).text().split('\n').length; var $numbering = $('<ul/>').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i <= lines; i++) { $numbering.append($('<li/>').text(i)); }; $numbering.fadeIn(1700); }); }); </script>