学习笔记——mybatis的sql拼接与log4j调试

接上篇内容:




<mapper namespace="Book">
    <resultMap type="com.lijie.bean.Book" id="BookResult">
        <id column="ID" jdbcType="INTEGER" property="id"/>
        <result column="NAME" jdbcType="VARCHAR" property="name"/>
    resultMap>
    <select id="queryBookList" parameterType="com.lijie.bean.Book" resultMap="BookResult">
        select id,name from book
        <where>
            <if test="id !=null">
                and ID=#{id}
            if>

        where>
    select>
mapper>

log4j中properties配置如下
log4j.properties:

log4j.rootLogger=DEBUG,Console
log4j.appender.Console=org.apache.log4j.ConsoleAppender
log4j.appender.Console.layout=org.apache.log4j.PatternLayout
log4j.appender.Console.layout.ConversionPattern=%d [%t] %-5p [%c] - %m%n
log4j.logger.org.apache=INFO

你可能感兴趣的:(学习笔记,mybatis)