在mybatis对应表的xml中
<insert id="insert" useGeneratedKeys="true" keyProperty="addrid" parameterType="com.softeem.dto.AddressDTO">
insert into eb_address(
province,city,area,street,otherInfo,receiveUser,phone,del,userId
) values(#{province},#{city},#{area},
#{street},#{otherInfo},#{receiveUser},#{phone},#{del},#{userId}
)
</insert>
public int addGetId(AddressDTO addressDTO) {
sqlSessionTemplate.insert(namespace+".insert", addressDTO);
return addressDTO.getAddrid();
}