sql
insert into tbl_sys_role (role_id, name, description,
create_time, record_status)
values (null, #{name,jdbcType=VARCHAR},
#{description,jdbcType=VARCHAR},
CURRENT_TIMESTAMP, #{recordStatus,jdbcType=SMALLINT}
)
spring-mybatis.xml
应该怎么配置insert才能返回key?
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
采用了批量更新模式是不能返回主键的,改为普通更新模式就好了。如果用批量更新模式,就是用
spring-batch来更新数据。你插入的role_id的值就是Null
去掉试试,如果插入成功返回的值应该是1,表示插入成功一条记录