一.效果展示
二.数据库文件
省市县三个表
省市县三级联动的SQL语句
三.编写后端代码
创建springboot项目
- 实体类
@Data
@Entity(name = "t_address_province")
@ApiModel(description = "省份信息实体模型")
public class AddressProvince {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@ApiModelProperty(name = "id", value = "主键")
@Column(name = "id")
private Integer id;
@ApiModelProperty(name = "code", value = "省份编码")
@Column(name = "code")
private String code;
@ApiModelProperty(name = "name", value = "省份名称")
@Column(name = "name")
private String name;
}
@Data
@Entity(name = "t_address_city")
@ApiModel(description = "城市信息实体模型")
public class AddressCity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@ApiModelProperty(name = "id",value = "主键")
@Column(name = "id")
private Integer id;
@ApiModelProperty(name = "code",value = "城市编码")
@Column(name = "code")
private String code;
@ApiModelProperty(name = "name",value = "城市名称")
@Column(name = "name")
private String name;
@ApiModelProperty(name = "provinceCode",value = "所属省份编码")
@Column(name = "provincecode")
private String provinceCode;
}
@Data