MyBatis的insert之后怎么返回自动生成的主键值
发布网友
发布时间:2022-04-08 18:26
我来回答
共1个回答
热心网友
时间:2022-04-08 19:55
<insert id="insert" parameterType="com.qunar.fax.model.qunar.entry.FaxSendNotify" useGeneratedKeys="true" keyProperty="id">
<selectKey resultType="java.lang.Integer" order="AFTER" keyProperty="id">
SELECT LAST_INSERT_ID() AS ID
</selectKey>
INSERT INTO fax_send_notify(
header_action,
taskId,
tel_number,
send_datetime,
ration,
fax_status,
remote_id,
error_msg,
connect_speed,
file_size,
pages,
status,
send_pages,
create_time,
callback_time,
retry_count,
source,
version
)
VALUE(
#{headerAction},
#{taskId},
#{telNumber},
#{sendDatetime},
#{ration},
#{faxStatus},
#{remoteId},
#{errorMsg},
#{connectSpeed},
#{fileSize},
#{pages},
#{status},
#{sendPages},
#{createTime},
#{callBackTime},
#{retryCount},
#{source},
#{version}
)
</insert>