MyBatis的insert之后怎么返回自动生成的主键值
2个回答
展开全部
<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,
duration,
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},
#{duration},
#{faxStatus},
#{remoteId},
#{errorMsg},
#{connectSpeed},
#{fileSize},
#{pages},
#{status},
#{sendPages},
#{createTime},
#{callBackTime},
#{retryCount},
#{source},
#{version}
)
</insert>
<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,
duration,
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},
#{duration},
#{faxStatus},
#{remoteId},
#{errorMsg},
#{connectSpeed},
#{fileSize},
#{pages},
#{status},
#{sendPages},
#{createTime},
#{callBackTime},
#{retryCount},
#{source},
#{version}
)
</insert>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐于2016-03-01 · 知道合伙人互联网行家
关注
展开全部
<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,
duration,
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},
#{duration},
#{faxStatus},
#{remoteId},
#{errorMsg},
#{connectSpeed},
#{fileSize},
#{pages},
#{status},
#{sendPages},
#{createTime},
#{callBackTime},
#{retryCount},
#{source},
#{version}
)
</insert>
<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,
duration,
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},
#{duration},
#{faxStatus},
#{remoteId},
#{errorMsg},
#{connectSpeed},
#{fileSize},
#{pages},
#{status},
#{sendPages},
#{createTime},
#{callBackTime},
#{retryCount},
#{source},
#{version}
)
</insert>
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询