当数据库的属性和实体类属性名不一致时,说白了就是映射不一致,只需要用resultMap
结果集映射去解决,而事实上,这种用法在实际工作中很常用
public class User {
private int id;
private String name;
private String password;//当数据库的属性和实体类属性名不一致时,用resultMap
select * from user where id = #{id};

当数据库的属性和实体类属性名不一致时,说白了就是映射不一致,只需要用resultMap
结果集映射去解决,而事实上,这种用法在实际工作中很常用
public class User {
private int id;
private String name;
private String password;//当数据库的属性和实体类属性名不一致时,用resultMap
select * from user where id = #{id};