当前位置:Gxlcms > 数据库问题 > Mybatis 查询传参SQL拼写实例

Mybatis 查询传参SQL拼写实例

时间:2021-07-01 10:21:17 帮助过:18人阅读

);

2、对应的***Mapper.xml中SQL的拼写

<select id="selectZjxqList" resultMap="BaseResultMap">
select c_ah,c_wsmc,c_bh_ws
from {db.t_tjfx_wsgz}
where c_bh_gzdy = #{cbhgzdy}
<if test="cropid !=null">
and c_bh_dw3 in ( ${cropid} )
</if>
order by c_ah
</select>

 

注意:参数前面有#号和$符号之分,他们的区别是,#号有防止SQL注入的功能,会对参数进行一些处理,但是$符号是获取你原始传过来的值

Mybatis 查询传参SQL拼写实例

标签:rom   and   span   mapper   where   注意   order by   poj   ring   

人气教程排行