当前位置:网站首页>Live classroom system 03 model class and entity
Live classroom system 03 model class and entity
2022-07-23 14:53:00 【z754916067】
Catalog
enums

CouponType
The type of coupon
package enums;
import com.baomidou.mybatisplus.annotation.EnumValue;
import lombok.Getter;
@Getter
public enum CouponType {
// Provide enumeration class objects
REGISTER(1," register "),
RECOMMEND(2," Recommend buying ");
// Declare this as an enumeration class
@EnumValue
private Integer code;
private String comment;
// Constructors
CouponType(Integer code,String comment){
this.code = code;
this.comment = comment;
}
}
CouponStatus
Coupon status
import com.baomidou.mybatisplus.annotation.EnumValue;
import lombok.Getter;
@Getter
public enum CouponStatus {
NOT_USED(0," not used "),
USED(1," Already used ");
@EnumValue
private Integer code ;
private String comment ;
CouponStatus(Integer code, String comment ){
this.code=code;
this.comment=comment;
}
}
CouponRangeType
The scope of the coupon
import com.baomidou.mybatisplus.annotation.EnumValue;
import lombok.Getter;
@Getter
public enum CouponRangeType {
ALL(1," Universal "),
;
@EnumValue
private Integer code ;
private String comment ;
CouponRangeType(Integer code, String comment ){
this.code=code;
this.comment=comment;
}
}
OrderStatus
The order status , At present, only two are listed
import com.baomidou.mybatisplus.annotation.EnumValue;
import lombok.Getter;
@Getter
public enum OrderStatus {
// The order status 【0-> To be paid ;1-> To be delivered ;2-> To be received by the head ;3-> Waiting for the user to receive the goods , Completed ;-1-> Cancelled 】
UNPAID(0," To be paid "),
PAID(1," Paid "),
;
@EnumValue
private Integer code ;
private String comment ;
OrderStatus(Integer code, String comment ){
this.code = code;
this.comment=comment;
}
}
PaymentStatus
Status of payment , It should be displayed by the user interface
import com.baomidou.mybatisplus.annotation.EnumValue;
import lombok.Getter;
@Getter
public enum PaymentStatus {
UNPAID(1," In the payment "),
PAID(2," Paid ");
//REFUND(-1," Refunded ");
@EnumValue
private Integer code ;
private String comment ;
PaymentStatus(Integer code, String comment) {
this.code = code;
this.comment = comment;
}
}
PaymentType
Method of payment , Alipay or WeChat?
import com.baomidou.mybatisplus.annotation.EnumValue;
import lombok.Getter;
@Getter
public enum PaymentType {
ALIPAY(1," Alipay "),
WEIXIN(2," WeChat " );
@EnumValue
private Integer code ;
private String comment ;
PaymentType(Integer code, String comment ){
this.code = code;
this.comment=comment;
}
}
model
base
BaseEntity
seeing the name of a thing one thinks of its function , It is the parent of almost all entity classes , Need to implement serialization interface .
@ApiModel It is an annotation that acts on interface related entity classes , It is used to add additional description information to the entity classes related to the interface
@ApiModelProperty It is an annotation that acts on the parameters of interface related entity classes , It is used to add additional description information to the parameters in the specific interface related entity classes
It is generally declared on entity classes @ApiModel, Declare in its specific attributes @ApiModelProperty
@TableName Can be mapped to table names in the database
@JsonFormat Used to represent json A format or type of serialization , For example, it is stored in mysql The data in is date Type of , When it is read out and encapsulated in an entity class , It will become an English time format , instead of yyyy-MM-dd HH:mm:ss Such Chinese time , So we need to use JsonFormat Annotation to format time .
@TableField(exist = false) Annotation loading bean Attribute , Indicates that the current property is not a field in the database , But in a project you have to use , In this way, it can be used in addition bean When ,mybatis-plus I'll ignore this , No mistake. , pure @TableField It corresponds to the fields in the database .
@JsonIgnore This annotation is used for properties or methods ( It's better to attribute ), Return to the entity class in the front end , Some attributes don't want to be exposed , Returned with this annotation json The data does not contain the attribute .
@Data
public class BaseEntity implements Serializable {
//value Describe it
@ApiModelProperty(value = "id")
//AUTO Is self increasing
@TableId(type = IdType.AUTO)
private Long id;
@ApiModelProperty(value=" Creation time ")
// The format in which a fixed database is materialized after it is taken out
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
// Declare that there may not be , But you need to use
@TableField("create_time")
private Date createTime;
@ApiModelProperty(value = " Update time ")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@TableField("update_time")
private Date updateTime;
@ApiModelProperty(value = " Logical deletion (1: deleted ,0: Not delete )")
// Don't let this data be returned
@JsonIgnore
// Whether it can be deleted logically
@TableLogic
@TableField("is_deleted")
private Integer isDeleted;
@ApiModelProperty(value = " The other parameters ")
@TableField(exist = false)
private Map<String,Object> param = new HashMap<>();
}
BaseMongoEntity
@CreatedDate @LastModifiedDate You can assign values automatically when entities are inserted or updated , What it assigns is the declared value .
@Data
public class BaseMongoEntity {
@ApiModelProperty(value = "id")
@Id
private String id;
@ApiModelProperty(value = " Creation time ")
// You can assign values automatically when creating entities
@CreatedDate
private Date createTime;
@ApiModelProperty(value = " Update time ")
// It can be assigned automatically when the entity is last modified
@LastModifiedDate
private Date updateTime;
@ApiModelProperty(value = " The other parameters ")
@Transient // Marked by the note , Will not be entered into the database . Just as ordinary javaBean attribute
private Map<String,Object> param = new HashMap<>();
}
MqRepeatRecord
This original project is placed in base In the , But I think it is inherited baseEntity Of , So I raised it alone , I don't understand what this entity does , The watch it refers to cannot be found , Put it here first .
@Data
@ApiModel(description = "MqRepeatRecord")
@TableName("mq_repeat_record")
public class MqRepeatRecord extends BaseEntity {
// implements Serializable
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = " Business number ")
@TableField("business_no")
private String businessNo;
}
activity
Go to the database table , There are two tables , So create two entities correspondingly , Ahead base Don't read this if you understand .
CouponInfo
// Statement getter setter Wait for a series of methods
@Data
// The annotation indicates that this is an annotation that acts on the interface related entity class , It is used to add additional description information to the entity classes related to the interface
@ApiModel(description = "CouponInfo")
@TableName("coupon_info")
public class CouponInfo extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = " Type of shopping voucher 1 cash coupon ")
@TableField("coupon_type")
private String couponType;
@ApiModelProperty(value = " Coupon name ")
@TableField("coupon_name")
private String couponName;
@ApiModelProperty(value = " amount of money ")
@TableField("amount")
private BigDecimal amount;
@ApiModelProperty(value = " Use threshold 0-> No threshold ")
@TableField("condition_amount")
private BigDecimal conditionAmount;
@ApiModelProperty(value = " Start date of claim ")
@TableField("start_time")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date startTime;
@ApiModelProperty(value = " End date of claim ")
@TableField("end_time")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date endTime;
@ApiModelProperty(value = " Using range [1-> It's universal ]")
@TableField("range_type")
private String rangeType;
@ApiModelProperty(value = " Description of scope of use ")
@TableField("rule_desc")
private String ruleDesc;
@ApiModelProperty(value = " Issue number ")
@TableField("publish_count")
private Integer publishCount;
@ApiModelProperty(value = " Limit the number of tickets per person ")
@TableField("per_limit")
private Integer perLimit;
@ApiModelProperty(value = " Quantity used ")
@TableField("use_count")
private Integer useCount;
@ApiModelProperty(value = " Received quantity ")
@TableField("receive_count")
private Integer receiveCount;
@ApiModelProperty(value = " Expiration time ")
@TableField("expire_time")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date expireTime;
@ApiModelProperty(value = " Release status [0- Unpublished ,1- The published ]")
@TableField("publish_status")
private Boolean publishStatus;
@ApiModelProperty(value = " Using a state ")
@TableField(exist = false)
private String couponStatus;
@ApiModelProperty(value = " Coupon collection form id")
@TableField(exist = false)
private Long couponUseId;
@ApiModelProperty(value = " Collection time ")
@TableField(exist = false)
@JsonFormat(pattern = "yyyy-MM-dd")
private Date getTime;
}
CouponUse
@Data
@ApiModel(description = "CouponUse")
@TableName("coupon_use")
public class CouponUse extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = " Shopping voucher ID")
@TableField("coupon_id")
private Long couponId;
@ApiModelProperty(value = " user ID")
@TableField("user_id")
private Long userId;
@ApiModelProperty(value = " Order ID")
@TableField("order_id")
private Long orderId;
@ApiModelProperty(value = " Shopping voucher status (0: not used 1: Already used )")
@TableField("coupon_status")
private String couponStatus;
@ApiModelProperty(value = " Acquisition time ")
@TableField("get_time")
private Date getTime;
@ApiModelProperty(value = " Use your time ")
@TableField("using_time")
private Date usingTime;
@ApiModelProperty(value = " Time of payment ")
@TableField("used_time")
private Date usedTime;
@ApiModelProperty(value = " Expiration time ")
@TableField("expire_time")
private Date expireTime;
}
live
There is nothing new in it , According to the database table to build the corresponding entity , Just list one , Just skip .
package model.live;
@Data
@ApiModel(description = "LiveCourse")
@TableName("live_course")
public class LiveCourse extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = " Course id")
@TableField("course_id")
private Long courseId;
@ApiModelProperty(value = " The name of the live broadcast ")
@TableField("course_name")
private String courseName;
@ApiModelProperty(value = " Live broadcast start time ")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@TableField("start_time")
private Date startTime;
@ApiModelProperty(value = " Live end time ")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@TableField("end_time")
private Date endTime;
@ApiModelProperty(value = " Anchor teacher id")
@TableField("teacher_id")
private Long teacherId;
@ApiModelProperty(value = " Course cover image path ")
@TableField("cover")
private String cover;
}
order
It's almost the same inside , Pay attention to payment Several of them are enum The entity class in .
@Data
@ApiModel(description = "PaymentInfo")
@TableName("payment_info")
public class PaymentInfo extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = " External business No ")
@TableField("out_trade_no")
private String outTradeNo;
@ApiModelProperty(value = " The order no. ")
@TableField("order_id")
private Long orderId;
@ApiModelProperty(value = " user id")
@TableField("user_id")
private Long userId;
@ApiModelProperty(value = " Alipay transaction number ")
@TableField("alipay_trade_no")
private String alipayTradeNo;
@ApiModelProperty(value = " Pay the amount ")
@TableField("total_amount")
private BigDecimal totalAmount;
@ApiModelProperty(value = " Transaction content ")
@TableField("trade_body")
private String tradeBody;
@ApiModelProperty(value = "paymentType")
@TableField("payment_type")
private PaymentType paymentType;
@ApiModelProperty(value = " Payment status ")
@TableField("payment_status")
private PaymentStatus paymentStatus;
@ApiModelProperty(value = " Callback information ")
@TableField("callback_content")
private String callbackContent;
@ApiModelProperty(value = " Callback time ")
@TableField("callback_time")
private Date callbackTime;
}
user
skip
package model.user;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import model.base.BaseEntity;
@Data
@ApiModel(description = "UserInfo")
@TableName("user_info")
public class UserInfo extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = " cell-phone number ")
@TableField("phone")
private String phone;
@ApiModelProperty(value = " User password ")
@TableField("password")
private String password;
@ApiModelProperty(value = " User name ")
@TableField("name")
private String name;
@ApiModelProperty(value = " nickname ")
@TableField("nick_name")
private String nickName;
@ApiModelProperty(value = " Gender ")
@TableField("sex")
private Integer sex;
@ApiModelProperty(value = " Head portrait ")
@TableField("avatar")
private String avatar;
@ApiModelProperty(value = " province ")
@TableField("province")
private String province;
@ApiModelProperty(value = "0: Unsubscribed 1: Subscribed ")
@TableField("subscribe")
private Integer subscribe;
@ApiModelProperty(value = " Applet open id")
@TableField("open_id")
private String openId;
@ApiModelProperty(value = " Wechat open platform unionID")
@TableField("union_id")
private String unionId;
@ApiModelProperty(value = " Recommender user id")
@TableField("recommend_id")
private Long recommendId;
@ApiModelProperty(value = "status")
@TableField("status")
private Integer status;
}
vod
vod It's the live broadcast section , skip .
@Data
@ApiModel(description = "Subject")
@TableName("subject")
public class Subject {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "id")
private Long id;
@ApiModelProperty(value = " Creation time ")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@TableField("create_time")
private Date createTime;
@ApiModelProperty(value = " Update time ")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@TableField("update_time")
private Date updateTime;
@ApiModelProperty(value = " Logical deletion (1: deleted ,0: Not delete )")
@JsonIgnore
@TableLogic
@TableField("is_deleted")
private Integer isDeleted;
@ApiModelProperty(value = " The other parameters ")
@TableField(exist = false)
private Map<String,Object> param = new HashMap<>();
@ApiModelProperty(value = " Category name ")
@TableField("title")
private String title;
@ApiModelProperty(value = " Father ID")
@TableField("parent_id")
private Long parentId;
@ApiModelProperty(value = " Sort field ")
@TableField("sort")
private Integer sort;
@ApiModelProperty(value = " Whether to include child nodes ")
@TableField(exist = false)
private boolean hasChildren;
}
边栏推荐
- Jetpack系列之Room中存Map结构
- Design and implementation of websocket universal packaging
- Yunna | how to manage fixed assets? How to manage fixed assets?
- C thread lock and single multithreading are simple to use
- C language project practice: 24 point game calculator (based on knowledge points such as structure, pointer, function, array, loop, etc.)
- [test platform development] 21. complete sending interface request and display response header information
- 微信官方出品!小程序自动化框架 minium 分享预告
- Sword finger offer19 regular expression
- [applet automation minium] i. framework introduction and environment construction
- FastAPI应用加入Nacos
猜你喜欢

mysql 之general_log日志

OpenCV计算外包矩形

Qu'est - ce que le codage par titre?

基于nextcloud构建个人网盘

String function of MySQL function summary

Advanced operation and maintenance 02

Detailed tutorial of typora drawing bed configuration
![[untitled] test [untitled] test](/img/9d/c80dd9a1df2cd6cbbfc597d73a63b2.png)
[untitled] test [untitled] test
![[test platform development] 20. Complete the function of sending interface request on the edit page](/img/ab/fed56b5bec990a25303c327733a8e6.png)
[test platform development] 20. Complete the function of sending interface request on the edit page
![[C language] number guessing game + shutdown applet](/img/2f/643ec964dba7643f91b1bd679a9284.png)
[C language] number guessing game + shutdown applet
随机推荐
Transferred from Yuxi information disclosure: products such as mRNA covid-19 vaccine and Jiuzhou horse tetanus immunoglobulin are expected to be on the market within this year.
Qt|模仿文字浮动字母
Right click to create a new TXT. The new text file is missing. You can solve it by adding a registry. Find the ultimate solution that can't be solved
[can I do your first project?] Detailed introduction and Simulation Implementation of gzip
[array & String & Macro exercise]
Using shell script to block IP with high scanning frequency
Program design of dot matrix Chinese character display of basic 51 single chip microcomputer
cmake笔记
数字相加的精度问题
Advanced operation and maintenance 03
ArgoCD 用户管理、RBAC 控制、脚本登录、App 同步
[applet automation minium] i. framework introduction and environment construction
[software testing] how to sort out your testing business
Wacom firmware update error 123, digital board driver cannot be updated
Fastapi application joins Nacos
身份证号正则验证
Jetpack系列之Room中存Map结构
[转]基于POI的功能区划分()
[WinForm] desktop program implementation scheme for screenshot recognition and calculation
工作小记:一次抓包