mybatis中设置主键返回

mybatis中设置主键返回

     <insert id="insertSelective" parameterType="com.nwow.pss.model.User" useGeneratedKeys="true" keyProperty="id">

xml文件中加入 加入useGeneratedKeys="true" keyProperty="id"即可

tip:数据库中主键需要设置为自增
双引号要英文格式下的

猜你喜欢

转载自blog.csdn.net/qq_41969358/article/details/88135750
今日推荐