添加订单接口

This commit is contained in:
muhua 2024-07-13 11:44:20 +08:00
parent b2dc2b0be4
commit fb4bdbdde3
5 changed files with 204 additions and 0 deletions

View File

@ -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();
}
}

View File

@ -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<Address> {
}

View File

@ -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<Address> {
}

View File

@ -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<AddressMapper, Address>
implements AddressService{
}

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.example.takeawaysystemserver.mapper.AddressMapper">
<resultMap id="BaseResultMap" type="com.example.takeawaysystemserver.entity.Address">
<id property="id" column="id" jdbcType="INTEGER"/>
<result property="userId" column="user_id" jdbcType="INTEGER"/>
<result property="consignee" column="consignee" jdbcType="VARCHAR"/>
<result property="phone" column="phone" jdbcType="VARCHAR"/>
<result property="province" column="province" jdbcType="VARCHAR"/>
<result property="city" column="city" jdbcType="VARCHAR"/>
<result property="district" column="district" jdbcType="VARCHAR"/>
<result property="detail" column="detail" jdbcType="VARCHAR"/>
<result property="isDefault" column="is_default" jdbcType="INTEGER"/>
</resultMap>
<sql id="Base_Column_List">
id,user_id,consignee,
phone,province,city,
district,detail,is_default
</sql>
</mapper>