Mybatis设置主键自动生成UUID与批量删除

设置主键自动生成UUID:

1 <insert id="add" useGeneratedKeys="true" parameterType="com.linyr.bean.Person">
2       <selectKey keyProperty="id" order="BEFORE" resultType="java.lang.String">
3           select UUID()
4       </selectKey>
5     insert into person(id,name,sex,age,address) 
6     values(#{id},#{name},#{sex},#{age},#{address})
7 </insert>

批量删除:

1 <delete id="delete" parameterType="java.util.Arrays" >
2     delete from person
3        where id  in
4          <foreach item="item" index="index" collection="array" open="(" separator="*" close=")">
5             #{item}
6          </foreach> 
7 </delete>

 

posted @ 2017-05-18 14:28  不速之客  阅读(4875)  评论(0编辑  收藏  举报