1.首先@TableName是让此实体类映射表名,从而使用BaseMapper的插入方法时能插入正确的表
2.TableFeild就是对字段映射
import com.baomidou.mybatisplus.annotation.TableName;
import com.htyd.common.base.BaseDomain;
import lombok.Data;
import java.util.List;
@Data
@TableName("sys_region")
public class City extends BaseDomain {
private static final long serialVersionUID = 1340260058262822126L;
private String fullName;
private String shortName;
private String code;
private String typeName;
private String parentId;
private Integer level;
private Double locationLong;
private Double locationLati;
private Integer childCount;//子级城市数
private List<City> child;//子级城市
}
3.BaseMapper方法
a)insert(Entity e);