使用ssm编写的一个功能
输入机器编号,开始时间,结束时间,查找
实现过程中,当机器编号输入一个不存在的值,或者开始时间空着,都会报错,错误显示是sql语句错误
mybatis的xml文件中,sql语句如下:
<select id="findByRowBounds" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from yujing_record
        <where>
            <if test="macid != null  and macid !=''">
                and macid like concat('%',#{macid},'%')
            </if>
            <if test="start != null and start !=''">
                and time <![CDATA[>]]>
                #{start}
            </if>
            <if test="end != null and end !=''">
                and time <![CDATA[<]]>
                #{end}
            </if>
        </where>
        order by time desc limit #{sindex},#{size}
    </select>
Liu__
sunbohan00