diff --git a/src/main/java/com/example/takeawaysystemserver/entity/Address.java b/src/main/java/com/example/takeawaysystemserver/entity/Address.java new file mode 100644 index 0000000..611d34a --- /dev/null +++ b/src/main/java/com/example/takeawaysystemserver/entity/Address.java @@ -0,0 +1,124 @@ +package com.example.takeawaysystemserver.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import lombok.Data; + +/** + * + * @TableName address + */ +@TableName(value ="address") +@Data +public class Address implements Serializable { + /** + * 主键ID + */ + @TableId(type = IdType.AUTO) + private Integer id; + + /** + * 用户ID + */ + private Integer userId; + + /** + * 收货人 + */ + private String consignee; + + /** + * 手机号 + */ + private String phone; + + /** + * 省份 + */ + private String province; + + /** + * 市级名 + */ + private String city; + + /** + * 区级名 + */ + private String district; + + /** + * 详细地址 + */ + private String detail; + + /** + * 默认(0否 1是) + */ + private Integer isDefault; + + @TableField(exist = false) + private static final long serialVersionUID = 1L; + + @Override + public boolean equals(Object that) { + if (this == that) { + return true; + } + if (that == null) { + return false; + } + if (getClass() != that.getClass()) { + return false; + } + Address other = (Address) that; + return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) + && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId())) + && (this.getConsignee() == null ? other.getConsignee() == null : this.getConsignee().equals(other.getConsignee())) + && (this.getPhone() == null ? other.getPhone() == null : this.getPhone().equals(other.getPhone())) + && (this.getProvince() == null ? other.getProvince() == null : this.getProvince().equals(other.getProvince())) + && (this.getCity() == null ? other.getCity() == null : this.getCity().equals(other.getCity())) + && (this.getDistrict() == null ? other.getDistrict() == null : this.getDistrict().equals(other.getDistrict())) + && (this.getDetail() == null ? other.getDetail() == null : this.getDetail().equals(other.getDetail())) + && (this.getIsDefault() == null ? other.getIsDefault() == null : this.getIsDefault().equals(other.getIsDefault())); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); + result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode()); + result = prime * result + ((getConsignee() == null) ? 0 : getConsignee().hashCode()); + result = prime * result + ((getPhone() == null) ? 0 : getPhone().hashCode()); + result = prime * result + ((getProvince() == null) ? 0 : getProvince().hashCode()); + result = prime * result + ((getCity() == null) ? 0 : getCity().hashCode()); + result = prime * result + ((getDistrict() == null) ? 0 : getDistrict().hashCode()); + result = prime * result + ((getDetail() == null) ? 0 : getDetail().hashCode()); + result = prime * result + ((getIsDefault() == null) ? 0 : getIsDefault().hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", id=").append(id); + sb.append(", userId=").append(userId); + sb.append(", consignee=").append(consignee); + sb.append(", phone=").append(phone); + sb.append(", province=").append(province); + sb.append(", city=").append(city); + sb.append(", district=").append(district); + sb.append(", detail=").append(detail); + sb.append(", isDefault=").append(isDefault); + sb.append(", serialVersionUID=").append(serialVersionUID); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/src/main/java/com/example/takeawaysystemserver/mapper/AddressMapper.java b/src/main/java/com/example/takeawaysystemserver/mapper/AddressMapper.java new file mode 100644 index 0000000..8352796 --- /dev/null +++ b/src/main/java/com/example/takeawaysystemserver/mapper/AddressMapper.java @@ -0,0 +1,21 @@ +package com.example.takeawaysystemserver.mapper; + +import com.example.takeawaysystemserver.entity.Address; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import jdk.jfr.MemoryAddress; +import org.apache.ibatis.annotations.Mapper; + +/** +* @author qiushengyu +* @description 针对表【address】的数据库操作Mapper +* @createDate 2024-07-13 09:22:38 +* @Entity com.example.takeawaysystemserver.entity.Address +*/ +@Mapper +public interface AddressMapper extends BaseMapper
{ + +} + + + + diff --git a/src/main/java/com/example/takeawaysystemserver/service/AddressService.java b/src/main/java/com/example/takeawaysystemserver/service/AddressService.java new file mode 100644 index 0000000..c3aa737 --- /dev/null +++ b/src/main/java/com/example/takeawaysystemserver/service/AddressService.java @@ -0,0 +1,13 @@ +package com.example.takeawaysystemserver.service; + +import com.example.takeawaysystemserver.entity.Address; +import com.baomidou.mybatisplus.extension.service.IService; + +/** +* @author qiushengyu +* @description 针对表【address】的数据库操作Service +* @createDate 2024-07-13 09:22:38 +*/ +public interface AddressService extends IService
{ + +} diff --git a/src/main/java/com/example/takeawaysystemserver/service/impl/AddressServiceImpl.java b/src/main/java/com/example/takeawaysystemserver/service/impl/AddressServiceImpl.java new file mode 100644 index 0000000..f3906eb --- /dev/null +++ b/src/main/java/com/example/takeawaysystemserver/service/impl/AddressServiceImpl.java @@ -0,0 +1,22 @@ +package com.example.takeawaysystemserver.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.example.takeawaysystemserver.entity.Address; +import com.example.takeawaysystemserver.service.AddressService; +import com.example.takeawaysystemserver.mapper.AddressMapper; +import org.springframework.stereotype.Service; + +/** +* @author qiushengyu +* @description 针对表【address】的数据库操作Service实现 +* @createDate 2024-07-13 09:22:38 +*/ +@Service +public class AddressServiceImpl extends ServiceImpl + implements AddressService{ + +} + + + + diff --git a/src/main/resources/mapper/AddressMapper.xml b/src/main/resources/mapper/AddressMapper.xml new file mode 100644 index 0000000..7f06b5a --- /dev/null +++ b/src/main/resources/mapper/AddressMapper.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + id,user_id,consignee, + phone,province,city, + district,detail,is_default + +