查询全部数据都出来了,就是条件查询没有数据,怎么回事啊

<mapper namespace="Message">

  <resultMap type="com.ljm.java.entity.Message" id="MessageResult">
    <id column="ID" jdbcType="INTEGER" property="id"/>
    <result column="COMMAND" jdbcType="VARCHAR" property="command"/>
    <result column="DESCRIPTION" jdbcType="VARCHAR" property="description"/>
    <result column="CONTENT" jdbcType="VARCHAR" property="content"/>
  </resultMap>

  <select id="queryMessageList" parameterType="com.ljm.java.entity.Message" resultMap="MessageResult">
    select ID,COMMAND,DESCRIPTION,CONTENT from MESSAGE
    <where>
    	<if test="command != null and !&quot;&quot;.equals(command.trim())">
	    	and COMMAND like '%' #{command}'%'
	    </if>
	    <if test="description != null and !&quot;&quot;.equals(description.trim())">
	    	and DESCRIPTION like '%' #{description} '%' 
	    </if>
    </where>
  </select>

http://img.mukewang.com/5928075100010dfc06420270.jpg

http://img.mukewang.com/5928075100018c1813660736.jpg

http://img.mukewang.com/5928075200012a2111970732.jpg


qq_i_18
浏览 1655回答 1
1回答

qq_飘随风_0

你的sql写错了   like  ‘%  #{command} %'  你那里多了两个分号
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java