mybatis 注解方式插入,主键由uuid函数生成
作者:互联网
@SelectKey(keyProperty = "record.id", resultType = String.class, before = true, statement = "select replace(uuid(), '-', '')") @Options(keyProperty = "record.id", useGeneratedKeys = true) @Insert("insert into T_USER(ID,OPEN_ID,NICKNANE,AVATARURL,SEX,COUNTRY,PROVINCE,CITY,CTIME,MOBILE) " + "values(#{record.id},#{record.openId},#{record.nicknane},#{record.avatarurl},#{record.sex},#{record.country},#{record.province},#{record.city},#{record.ctime},#{record.mobile})")
int insert(@Param("record")TUser record);
标签:keyProperty,uuid,主键,record,mybatis,ID,true,id 来源: https://www.cnblogs.com/nongzihong/p/11152760.html