日期:2014-05-18  浏览次数:20724 次

mybatis if标签判断的问题
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 
          "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> 
          <mapper namespace="com.lypaydb.mapper.Order_DayMapper">
            <resultMap type="com.lypaydb.pojo.Order_Day" id="odMap">
              <id property="id" column="id" />
              <result property="date" column="date" />
              <result property="total" column="total" />
              <result property="aisle" column="aisle" />
              <result property="operators" column="operators" />
              <result property="channelid" column="channelid" />
              <result property="appid" column="appid" />
              <result property="paycnt" column="paycnt" />
            </resultMap>
          
          <!-- /*sql -->
          <select id="findod" parameterType="java.util.Map" resultMap="odMap">
              select * from order_day where 1 = 1 
              <if test="${start} != null and ${start != ''}">
                and   date >= #{start} 
              </if>
              <if test="${end} != null and ${end} != ''">
                and #{end} > date  
              </if>
              <if test="appid != null and appid != ''">
                and  appid=${appid}
              </if>
              <if test="operators != null and operators != ''">
                and ope