mybatis插入返回主键

时间:2022-05-19 15:11:35

 useGeneratedKeys="true" keyProperty="id"

<insert id="insertReturnPrimaryKey" parameterType="com.haitao55.spider.order.robot.platform.dos.TaskHistoryDO" useGeneratedKeys="true" keyProperty="id">
insert into task_history(
task_id,
agent_id,
assign_time,
start_time,
end_time,
status,
ctime,
utime,
account_id,
address_id,
coupon_id
) values(
#{taskId},
#{agentId},
#{assignTime},
#{startTime},
#{endTime},
#{status},
#{createTime},
#{updateTime},
#{accountId},
#{addressId},
#{couponId}
)
</insert>