Mybatis学习心得

插入一条数据后返回主键

<insert id="insertAndGetId" useGeneratedKeys="true" keyProperty="userId" parameterType="com.chenzhou.mybatis.User">  
    insert into user(userName,password,comment)  
    values(#{userName},#{password},#{comment})  
</insert>  

其中keyProperty是PO类中映射的字段

内置方法排序

CarouselExample carouselExample = new CarouselExample();
carouselExample.setOrderByClause("字段名 desc");

猜你喜欢

转载自blog.csdn.net/lxj673011332/article/details/76903784