作者:chenshu华 | 来源:互联网 | 2014-06-09 00:50
mysqlmybatis返回插入的主键id[html]<insertid"insertCompanyInfo"parameterType"com.yjf.entity.TCompanyInfo">insertintoT_Company_Info(Company_Id,
mysql mybatis返回插入的主键id
insert into T_Company_Info (Company_Id, IsFranchisee, Company_Code, Company_Name)
values (#{companyId}, #{isfranchisee}, #{companyCode}, #{companyName})
SELECT LAST_INSERT_ID() AS ID
www.2cto.com
在执行插入之后执行,查询到 主键id
[html]
SELECT LAST_INSERT_ID() AS ID
通过对象 com.yjf.entity.TCompanyInfo.companyId 取得主键
[java]
company.getCompanyId()