1.使用foreach来添加删除用户
<!--根据id集合删除用户-->
<!-- delete from user where id in(xxx,xxx) -->
<!-- forEach : 用来循环 collection : 用来指定循环的数据的类型 可以填的值有:array,list,map item
: 循环中为每个循环的数据指定一个别名 index : 循环中循环的下标 open : 开始 close : 结束 separator : 数组中元素之间的分隔符 -->
<delete id="delList">
delete from user where uid in
<foreach item="uid" collection="list" open="(" separator="," close=")">
#{uid}
</foreach>
</delete>
<!--根据用户集合添加用户-->
<insert id="insertList">
insert into user (uid,name) values
<foreach collection="list" item="user" separator=",">
(#{user.id},#{user.name})
</foreach>
</insert>
2.使用map作为参数传值(#{key}表示value)
<select id="selectUsers" resultType="map">
#(map中存入的key为id,value为xxx)
select id, username, hashedPassword
from some_table
where id = #{id}
</select>
3.选择输入的其中一个类型数据作条件
<if test="text!='' and text != null">
and (a.LAC_NAME like CONCAT('%',#{text, jdbcType=VARCHAR},'%')or USER_NAME like CONCAT('%',#{text, jdbcType=VARCHAR},'%'))
</if>