mybatis 插入时返回主键id,需要在xml里增加配置,useGeneratedKeys="true" keyProperty="id",例如
<insert id="save" parameterType="net.xxxxx" useGeneratedKeys="true" keyProperty="id" >
这样实体就主键字段就会有自增的值
mybatis 插入时返回主键id,需要在xml里增加配置,useGeneratedKeys="true" keyProperty="id",例如
<insert id="save" parameterType="net.xxxxx" useGeneratedKeys="true" keyProperty="id" >
这样实体就主键字段就会有自增的值