<selectKey resultType="int64" order="AFTER">
SELECT LAST_INSERT_ID() AS id
</selectKey>
<insert id="insert">
<selectKey resultType="int64" order="AFTER">
SELECT LAST_INSERT_ID() AS id
</selectKey>
INSERT INTO
sys_user
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != nil">name,</if>
<if test="sex != nil">sex,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != nil">#{name},</if>
<if test="sex != nil">#{sex},</if>
</trim>
</insert>
import "time"
type User struct {
Id int64 `json:"id"`
Name string `json:"name"`
Sex int `json:"sex"`
CreateDate time.Time `json:"createTime"`
UpdateTime time.Time `json:"updateTime"`
}
type UserDao struct {
Insert func(user User) (int64, error)
//SelectById func(id int64) (User, error) `mapperParams:"id"`
}