diff --git a/SpringCloud/pom.xml b/SpringCloud/pom.xml index 254e478..a10cf82 100644 --- a/SpringCloud/pom.xml +++ b/SpringCloud/pom.xml @@ -13,6 +13,7 @@ 0.0.1-SNAPSHOT SpringCloud SpringCloud + pom diff --git a/SpringDemo/src/main/java/cn/whaifree/springdemo/mybatis/domain/Orders.java b/SpringDemo/src/main/java/cn/whaifree/springdemo/mybatis/domain/Orders.java new file mode 100644 index 0000000..98ab6bf --- /dev/null +++ b/SpringDemo/src/main/java/cn/whaifree/springdemo/mybatis/domain/Orders.java @@ -0,0 +1,111 @@ +package cn.whaifree.springdemo.mybatis.domain; + +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 lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +/** + * + * @TableName orders + */ +@TableName(value ="orders") +@Data +public class Orders implements Serializable { + /** + * + */ + @TableId(type = IdType.AUTO) + private Integer id; + + /** + * 订单号 + */ + private String orderNo; + + /** + * 用户ID + */ + private Integer userId; + + /** + * 订单总金额 + */ + private BigDecimal totalAmount; + + /** + * 订单状态: 0-未支付, 1-已支付 + */ + private Integer status; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * + */ + private Integer version; + + @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; + } + Orders other = (Orders) that; + return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) + && (this.getOrderNo() == null ? other.getOrderNo() == null : this.getOrderNo().equals(other.getOrderNo())) + && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId())) + && (this.getTotalAmount() == null ? other.getTotalAmount() == null : this.getTotalAmount().equals(other.getTotalAmount())) + && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus())) + && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) + && (this.getVersion() == null ? other.getVersion() == null : this.getVersion().equals(other.getVersion())); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); + result = prime * result + ((getOrderNo() == null) ? 0 : getOrderNo().hashCode()); + result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode()); + result = prime * result + ((getTotalAmount() == null) ? 0 : getTotalAmount().hashCode()); + result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode()); + result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); + result = prime * result + ((getVersion() == null) ? 0 : getVersion().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(", orderNo=").append(orderNo); + sb.append(", userId=").append(userId); + sb.append(", totalAmount=").append(totalAmount); + sb.append(", status=").append(status); + sb.append(", createTime=").append(createTime); + sb.append(", version=").append(version); + sb.append(", serialVersionUID=").append(serialVersionUID); + sb.append("]"); + return sb.toString(); + } +} diff --git a/SpringDemo/src/main/java/cn/whaifree/springdemo/mybatis/mapper/OrdersMapper.java b/SpringDemo/src/main/java/cn/whaifree/springdemo/mybatis/mapper/OrdersMapper.java new file mode 100644 index 0000000..75eff77 --- /dev/null +++ b/SpringDemo/src/main/java/cn/whaifree/springdemo/mybatis/mapper/OrdersMapper.java @@ -0,0 +1,26 @@ +package cn.whaifree.springdemo.mybatis.mapper; + +import cn.whaifree.springdemo.mybatis.domain.Orders; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Select; + +import java.util.List; + +/** +* @author wenhai +* @description 针对表【orders】的数据库操作Mapper +* @createDate 2024-11-01 12:45:47 +* @Entity generator.domain.Orders +*/ +@Mapper +public interface OrdersMapper extends BaseMapper { + + @Select("SELECT * FROM orders") + List selectByExample(); + +} + + + + diff --git a/SpringDemo/src/main/java/cn/whaifree/springdemo/mybatis/service/OrdersService.java b/SpringDemo/src/main/java/cn/whaifree/springdemo/mybatis/service/OrdersService.java new file mode 100644 index 0000000..ed1f4f0 --- /dev/null +++ b/SpringDemo/src/main/java/cn/whaifree/springdemo/mybatis/service/OrdersService.java @@ -0,0 +1,13 @@ +package cn.whaifree.springdemo.mybatis.service; + +import cn.whaifree.springdemo.mybatis.domain.Orders; +import com.baomidou.mybatisplus.extension.service.IService; + +/** +* @author wenhai +* @description 针对表【orders】的数据库操作Service +* @createDate 2024-11-01 12:45:47 +*/ +public interface OrdersService extends IService { + +} diff --git a/SpringDemo/src/main/java/cn/whaifree/springdemo/mybatis/service/impl/OrdersServiceImpl.java b/SpringDemo/src/main/java/cn/whaifree/springdemo/mybatis/service/impl/OrdersServiceImpl.java new file mode 100644 index 0000000..53159d7 --- /dev/null +++ b/SpringDemo/src/main/java/cn/whaifree/springdemo/mybatis/service/impl/OrdersServiceImpl.java @@ -0,0 +1,22 @@ +package cn.whaifree.springdemo.mybatis.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import cn.whaifree.springdemo.mybatis.domain.Orders; +import cn.whaifree.springdemo.mybatis.service.OrdersService; +import cn.whaifree.springdemo.mybatis.mapper.OrdersMapper; +import org.springframework.stereotype.Service; + +/** +* @author wenhai +* @description 针对表【orders】的数据库操作Service实现 +* @createDate 2024-11-01 12:45:47 +*/ +@Service +public class OrdersServiceImpl extends ServiceImpl + implements OrdersService{ + +} + + + + diff --git a/SpringDemo/src/main/resources/mapper/OrdersMapper.xml b/SpringDemo/src/main/resources/mapper/OrdersMapper.xml new file mode 100644 index 0000000..57f3789 --- /dev/null +++ b/SpringDemo/src/main/resources/mapper/OrdersMapper.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + id,order_no,user_id, + total_amount,status,create_time, + version + +