首页 > 其他 > 详细

Mybatis的dao层传递单参出现的问题

时间:2019-09-16 13:53:31      阅读:86      评论:0      收藏:0      [点我收藏+]

通常情况下,mybatis传递单参可以直接传,不需要向多参一样加注解、设置接参名或者利用map那样麻烦,但遇到带if的sql语句

<select id="selectAll" resultMap="BaseResultMap" parameterType="Integer">
      select <include refid="Base_Column_List"/> from tb_cj
      <where>
          <if test="type!=null">
              cj_type=#{type}
          </if>
      </where>

这个if语句的条件似乎不支持type的自动解析,会报错,目前只能加注解或将type改为 _parameter 的方式:test中用 _parameter,sql语句用#{_parameter}

Mybatis的dao层传递单参出现的问题

原文:https://www.cnblogs.com/psxfd4/p/11526514.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!