方法一 :
<!-- 增加用户 -->
<insert id="saveUser" parameterType="com.yh.model.UserModel">
<selectKey keyProperty="id" resultType="java.lang.Integer" order="BEFORE">
SELECT SEQUENCESID.NEXTVAL FROM DUAL
</selectKey>
insert into users1(id,username,userpwd,sex,userphone,address) values(#{id},#{username},#{userpwd},#{sex},#{userphone},#{address})
</insert>
方法二 简单粗暴 有力
<insert id="addUser" parameterType="Users" >
insert into users values(user_seq.nextval,#{user_name},#{user_pwd},#{sex},#{file_id},#{file_name})
</insert>
oracle 分页 例子:
<select id="getPageList" resultType="Users" parameterType="map" >
select * from (select a.*,rownum rnum from (select * from users order by user_id)a where rownum<=#{end}) where rnum>#{start}
</select>
本文介绍两种使用MyBatis实现用户数据插入的方法,并提供了一个Oracle数据库的分页查询示例。
5536

被折叠的 条评论
为什么被折叠?



