controller
service:
xml
<insert id="insertUser" keyProperty="id" useGeneratedKeys="true" parameterType="SysUser"> insert into sys_user(name,user_name,phone,pwd,status,create_time,is_del,company_id,last_login_time,salt)values(#{name},#{userName},#{phone},#{pwd},#{status},CURRENT_TIMESTAMP,0,#{companyId},#{lastLoginTime},#{salt}) </insert>
通过service里面的sysUser.getId就可以拿到自增长的id了