添加实体类,接着又需要添加后的id值,只需要在xml文件对应方法添加 useGeneratedKeys=“true” keyProperty=“id” 即可如:
<insert id=“insertSelective” useGeneratedKeys=“true” keyProperty=“id” parameterType=“com.sinosoft.db.po.BacteriaChar”>
改方法返回的不是id,id是在你保存时的实体类中获得
添加实体类时,返回id
最新推荐文章于 2022-09-02 23:02:57 发布