<?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.mybatis.config.UserDao"> <select id="findUser" parameterType="int" resultType="com.mybatis.config.User"> select * from user where 0=0 <if test="userName != null"> and userName = #{userName,jdbcType=VARCHAR} </if> <if test="password != null"> and password = #{password,jdbcType=VARCHAR} </if> <if test="comment != null"> and comment = #{comment,jdbcType=VARCHAR} </if> </select> </mapper>
现在有个需求,就是根据表的任何属性来查询查找记录,项目没有用到hibernate,想用mybatis来做,我想问的就是:下面这样的配置会有被注入的危险么?因为mybatis的sql好像也是拼出来的。