关于Mybatis 查询 查到空数据列的情况


<pre style="background-color:#2b2b2b;color:#a9b7c6;font-family:'宋体';font-size:12.0pt;"><span style="color:#e8bf6a;"><select </span><span style="color:#bababa;">id</span><span style="color:#6a8759;">="getlist" </span><span style="color:#bababa;">resultType</span><span style="color:#6a8759;">="WordBook"</span><span style="color:#e8bf6a;">>
</span><span style="color:#e8bf6a;">    </span>SELECT  a.key_ AS  WordBook_KEY , a.value_ AS WordBook_VALUE
    FROM  wordbook a
    WHERE key_=#{key}
<span style="color:#e8bf6a;"></select></span>

这个是查询
下面是结果







2016-06-13 09:48:26,503 INFO [jeesite.modules.sys.interceptor.LogInterceptor] - ViewName: zopsen/bhgjypfbb/jgjbhgjypfbbList2016-06-13 09:48:26,537 DEBUG [jeesite.modules.sys.interceptor.LogInterceptor] - 计时结束:09:48:26.537 耗时:0:0:0.114 URI: /zopsenFramework/a/bhgjyfbb/jgjbhgjyfbb 最大内存: 2715m 已分配内存: 1001m 已分配内存中的剩余空间: 619m 最大可用内存: 2333m2016-06-13 09:48:26,538 DEBUG [modules.sys.dao.LogDao.insert] - ==> Preparing: INSERT INTO sys_log( id, type, title, create_by, create_date, remote_addr, user_agent, request_uri, method, params, exception ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ) 2016-06-13 09:48:26,541 DEBUG [modules.sys.dao.LogDao.insert] - ==> Parameters: 5dbf0267518f48d7b57d96760db00314(String), 1(String), 柳钉(String), e273f2f0fcb84bb09f57e4ec9115c94c(String), 2016-06-13 09:48:26.538(Timestamp), 0:0:0:0:0:0:0:1(String), Mozilla/5.0 (Windows NT 10.0; WOW64; rv:47.0) Gecko/20100101 Firefox/47.0(String), /zopsenFramework/a/bhgjyfbb/jgjbhgjyfbb(String), GET(String), (String), (String)2016-06-13 09:48:26,589 DEBUG [modules.sys.dao.LogDao.insert] - <== Updates: 12016-06-13 09:48:28,352 DEBUG [jeesite.modules.sys.interceptor.LogInterceptor] - 开始计时: 09:48:28.352 URI: /zopsenFramework/a/bhgjyfbb/jgjbhgjyfbb/formldbhgjcxm[null, null, null, null, null, null, null]2016-06-13 09:48:28,409 INFO [jeesite.modules.sys.interceptor.LogInterceptor] - ViewName: zopsen/bhgjypfbb/jgjbhgjypfbbForm2016-06-13 09:48:28,567 DEBUG [jeesite.modules.sys.interceptor.LogInterceptor] - 计时结束:09:48:28.566 耗时:0:0:0.214 URI: /zopsenFramework/a/bhgjyfbb/jgjbhgjyfbb/form 最大内存: 2715m 已分配内存: 1001m 已分配内存中的剩余空间: 605m 最大可用内存: 2318m2016-06-13 09:48:28,633 DEBUG [modules.sys.dao.LogDao.insert] - ==> Preparing: INSERT INTO sys_log( id, type, title, create_by, create_date, remote_addr, user_agent, request_uri, method, params, exception ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )



修改xml


<?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.zopsen.wordbook.dao.WordBookDao">
    <!--T get(String key);-->
    <!--List<T> getlist(String key);-->
    <resultMap id="wordBook" type="WordBook">
        <result column="key_" property="WordBook_KEY"></result>
        <result column="value_" property="WordBook_VALUE"></result>
    </resultMap>


    <select id="get"  parameterType="java.lang.String"  resultMap="wordBook">
--         SELECT  a.key_ AS  WordBook_KEY , a.value_ AS WordBook_VALUE
           SELECT  key_ AS , value_
        FROM  wordbook
        WHERE key_=#{key}

    </select>

    <select id="getlist" parameterType="java.lang.String"  resultMap="wordBook">
--         SELECT  a.key_ AS  WordBook_KEY , a.value_ AS WordBook_VALUE
           SELECT  key_  , value_
        FROM  wordbook
        WHERE key_=#{key}
    </select>

</mapper>

结果为

2016-06-13 10:14:09,858 DEBUG [jeesite.modules.sys.interceptor.LogInterceptor] - 开始计时: 10:14:09.858  URI: /zopsenFramework/a/bhgjyfbb/jgjbhgjyfbb/form
ldbhgjcxm
[WordBook{WordBook_KEY='ldbhgjcxm', WordBook_VALUE='其它'}, WordBook{WordBook_KEY='ldbhgjcxm', WordBook_VALUE='剪切'}, WordBook{WordBook_KEY='ldbhgjcxm', WordBook_VALUE='外观尺寸'}, WordBook{WordBook_KEY='ldbhgjcxm', WordBook_VALUE='拉托'}, WordBook{WordBook_KEY='ldbhgjcxm', WordBook_VALUE='裂纹'}, WordBook{WordBook_KEY='ldbhgjcxm', WordBook_VALUE='锁紧性能'}, WordBook{WordBook_KEY='ldbhgjcxm', WordBook_VALUE='预紧力'}]
2016-06-13 10:14:09,917 INFO  [jeesite.modules.sys.interceptor.LogInterceptor] - ViewName: zopsen/bhgjypfbb/jgjbhgjypfbbForm
2016-06-13 10:14:10,014 DEBUG [jeesite.modules.sys.interceptor.LogInterceptor] - 计时结束:10:14:10.014 


结果表明 当为空时一般是值没法赋值完毕  

 持续更新中。。。。   分析原理。。。。


没有更多推荐了,返回首页