• 直播课堂系统03-model类及实体


    enums

    在这里插入图片描述

    CouponType

    优惠券的类型

    package enums;
    import com.baomidou.mybatisplus.annotation.EnumValue;
    import lombok.Getter;
    
    @Getter
    public enum CouponType {
        //提供枚举类对象
        REGISTER(1,"注册"),
        RECOMMEND(2,"推荐购买");
        
        //声明此为枚举类
        @EnumValue
        private Integer code;
        private String comment;
        
        //构造函数
        CouponType(Integer code,String comment){
            this.code = code;
            this.comment = comment;
        }
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21

    CouponStatus

    优惠券状态

    import com.baomidou.mybatisplus.annotation.EnumValue;
    import lombok.Getter;
    @Getter
    public enum CouponStatus {
        NOT_USED(0,"未使用"),
        USED(1,"已使用");
    
        @EnumValue
        private Integer code ;
        private String comment ;
    
        CouponStatus(Integer code, String comment ){
            this.code=code;
            this.comment=comment;
        }
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16

    CouponRangeType

    优惠券作用范围

    import com.baomidou.mybatisplus.annotation.EnumValue;
    import lombok.Getter;
    @Getter
    public enum CouponRangeType {
        ALL(1,"通用"),
        ;
        @EnumValue
        private Integer code ;
        private String comment ;
    
        CouponRangeType(Integer code, String comment ){
            this.code=code;
            this.comment=comment;
        }
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15

    OrderStatus

    订单状态,目前只列了两个

    import com.baomidou.mybatisplus.annotation.EnumValue;
    import lombok.Getter;
    
    @Getter
    public enum OrderStatus {
        //订单状态【0->待付款;1->待发货;2->待团长收货;3->待用户收货,已完成;-1->已取消】
        UNPAID(0,"待支付"),
        PAID(1,"已支付"),
        ;
    
        @EnumValue
        private Integer code ;
        private String comment ;
    
        OrderStatus(Integer code, String comment ){
            this.code = code;
            this.comment=comment;
        }
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19

    PaymentStatus

    支付的状态,应该是用户界面展示的

    import com.baomidou.mybatisplus.annotation.EnumValue;
    import lombok.Getter;
    
    @Getter
    public enum PaymentStatus {
        UNPAID(1,"支付中"),
        PAID(2,"已支付");
        //REFUND(-1,"已退款");
    
        @EnumValue
        private Integer code ;
        private String comment ;
    
        PaymentStatus(Integer code, String comment) {
            this.code = code;
            this.comment = comment;
        }
    
    }
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20

    PaymentType

    支付方式,支付宝还是微信

    import com.baomidou.mybatisplus.annotation.EnumValue;
    import lombok.Getter;
    
    @Getter
    public enum PaymentType {
        ALIPAY(1,"支付宝"),
        WEIXIN(2,"微信" );
    
        @EnumValue
        private Integer code ;
        private String comment ;
    
        PaymentType(Integer code, String comment ){
            this.code = code;
            this.comment=comment;
        }
    
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18

    model

    base

    BaseEntity

    顾名思义,其是几乎所有实体类的父类,需要实现序列化接口。
    @ApiModel是作用在接口相关实体类上的注解,用来对该接口相关实体类添加额外的描述信息
    @ApiModelProperty 是作用在接口相关实体类的参数上的注解,用来对具体的接口相关实体类中的参数添加额外的描述信息
    一般在实体类上声明@ApiModel,在其具体属性里声明@ApiModelProperty
    @TableName可以映射到数据库中的表名
    @JsonFormat用来表示json序列化的一种格式或者类型,比如存储在mysql中的数据是date类型的,当读取出来封装在实体类中的时候,就会变成英文时间格式,而不是yyyy-MM-dd HH:mm:ss这样的中文时间,因此需要用到JsonFormat注解来格式化时间。
    @TableField(exist = false) 注解加载bean属性上,表示当前属性不是数据库的字段,但在项目中必须使用,这样在新增等使用bean的时候,mybatis-plus就会忽略这个,不会报错,单纯@TableField就是对应着数据库内的字段。
    @JsonIgnore此注解用于属性或者方法上(最好是属性上),返回到前端的实体类中,有一些属性不想暴露出去,用这个注解返回的json数据即不包含该属性。

    @Data
    public class BaseEntity implements Serializable {
    
        //value 对其进行描述
        @ApiModelProperty(value = "id")
        //AUTO为自增
        @TableId(type = IdType.AUTO)
        private Long id;
    
        @ApiModelProperty(value="创建时间")
        //固定数据库从其取出后被实体化后的格式
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        //声明数据库中有可能没有,但需要使用
        @TableField("create_time")
        private Date createTime;
    
        @ApiModelProperty(value = "更新时间")
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        @TableField("update_time")
        private Date updateTime;
    
        @ApiModelProperty(value = "逻辑删除(1:已删除,0:未删除)")
        //不让这个数据被返回
        @JsonIgnore
        //是否能够逻辑删除
        @TableLogic
        @TableField("is_deleted")
        private Integer isDeleted;
    
        @ApiModelProperty(value = "其他参数")
        @TableField(exist = false)
        private Map<String,Object> param = new HashMap<>();
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33

    BaseMongoEntity

    @CreatedDate @LastModifiedDate可以在实体插入或更新时自动赋值,其赋的就是声明的值。

    @Data
    public class BaseMongoEntity {
        @ApiModelProperty(value = "id")
        @Id
        private String id;
    
        @ApiModelProperty(value = "创建时间")
        //可以在实体创建时自动赋值
        @CreatedDate
        private Date createTime;
    
        @ApiModelProperty(value = "更新时间")
        //可以在实体最后一次修改时自动赋值
        @LastModifiedDate
        private Date updateTime;
    
        @ApiModelProperty(value = "其他参数")
        @Transient //被该注解标注的,将不会被录入到数据库中。只作为普通的javaBean属性
        private Map<String,Object> param = new HashMap<>();
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20

    MqRepeatRecord

    这个原项目放在base里了,可是我寻思它是继承的baseEntity的,于是单独提出来了,没看懂这个实体是做什么的,它指的表也没找到,先放这吧。

    @Data
    @ApiModel(description = "MqRepeatRecord")
    @TableName("mq_repeat_record")
    public class MqRepeatRecord extends BaseEntity {
        //实现序列化接口
        private static final long serialVersionUID = 1L;
    
        @ApiModelProperty(value = "业务编号")
        @TableField("business_no")
        private String businessNo;
    }
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12

    activity

    去看数据库表,有两张表,所以对应创建两个实体,前面的base看懂了的话这块不用看。
    在这里插入图片描述

    CouponInfo

    //声明getter setter等一系列方法
    @Data
    //注解表明这是作用在接口相关实体类上的注解,用来对该接口相关实体类添加额外的描述信息
    @ApiModel(description = "CouponInfo")
    @TableName("coupon_info")
    public class CouponInfo extends BaseEntity {
        private static final long serialVersionUID = 1L;
    
        @ApiModelProperty(value = "购物券类型 1 现金券")
        @TableField("coupon_type")
        private String couponType;
    
        @ApiModelProperty(value = "优惠卷名字")
        @TableField("coupon_name")
        private String couponName;
    
        @ApiModelProperty(value = "金额")
        @TableField("amount")
        private BigDecimal amount;
    
        @ApiModelProperty(value = "使用门槛 0->没门槛")
        @TableField("condition_amount")
        private BigDecimal conditionAmount;
    
        @ApiModelProperty(value = "可以领取的开始日期")
        @TableField("start_time")
        @JsonFormat(pattern = "yyyy-MM-dd")
        private Date startTime;
    
        @ApiModelProperty(value = "可以领取的结束日期")
        @TableField("end_time")
        @JsonFormat(pattern = "yyyy-MM-dd")
        private Date endTime;
    
        @ApiModelProperty(value = "使用范围[1->全场通用]")
        @TableField("range_type")
        private String rangeType;
    
        @ApiModelProperty(value = "使用范围描述")
        @TableField("rule_desc")
        private String ruleDesc;
    
        @ApiModelProperty(value = "发行数量")
        @TableField("publish_count")
        private Integer publishCount;
    
        @ApiModelProperty(value = "每人限领张数")
        @TableField("per_limit")
        private Integer perLimit;
    
        @ApiModelProperty(value = "已使用数量")
        @TableField("use_count")
        private Integer useCount;
    
        @ApiModelProperty(value = "领取数量")
        @TableField("receive_count")
        private Integer receiveCount;
    
        @ApiModelProperty(value = "过期时间")
        @TableField("expire_time")
        @JsonFormat(pattern = "yyyy-MM-dd")
        private Date expireTime;
    
        @ApiModelProperty(value = "发布状态[0-未发布,1-已发布]")
        @TableField("publish_status")
        private Boolean publishStatus;
    
        @ApiModelProperty(value = "使用状态")
        @TableField(exist = false)
        private String couponStatus;
    
        @ApiModelProperty(value = "优惠券领取表id")
        @TableField(exist = false)
        private Long couponUseId;
    
        @ApiModelProperty(value = "领取时间")
        @TableField(exist = false)
        @JsonFormat(pattern = "yyyy-MM-dd")
        private Date getTime;
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80

    CouponUse

    @Data
    @ApiModel(description = "CouponUse")
    @TableName("coupon_use")
    public class CouponUse extends BaseEntity {
    
        private static final long serialVersionUID = 1L;
    
        @ApiModelProperty(value = "购物券ID")
        @TableField("coupon_id")
        private Long couponId;
    
        @ApiModelProperty(value = "用户ID")
        @TableField("user_id")
        private Long userId;
    
        @ApiModelProperty(value = "订单ID")
        @TableField("order_id")
        private Long orderId;
    
        @ApiModelProperty(value = "购物券状态(0:未使用 1:已使用)")
        @TableField("coupon_status")
        private String couponStatus;
    
        @ApiModelProperty(value = "获取时间")
        @TableField("get_time")
        private Date getTime;
    
        @ApiModelProperty(value = "使用时间")
        @TableField("using_time")
        private Date usingTime;
    
        @ApiModelProperty(value = "支付时间")
        @TableField("used_time")
        private Date usedTime;
    
        @ApiModelProperty(value = "过期时间")
        @TableField("expire_time")
        private Date expireTime;
    
    }
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41

    live

    里面也没啥新东西,按照数据库表来建对应的实体而已,随便列举一个,直接跳过。
    在这里插入图片描述

    package model.live;
    @Data
    @ApiModel(description = "LiveCourse")
    @TableName("live_course")
    public class LiveCourse extends BaseEntity {
    
    	private static final long serialVersionUID = 1L;
    
    	@ApiModelProperty(value = "课程id")
    	@TableField("course_id")
    	private Long courseId;
    
    	@ApiModelProperty(value = "直播名称")
    	@TableField("course_name")
    	private String courseName;
    
    	@ApiModelProperty(value = "直播开始时间")
    	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    	@TableField("start_time")
    	private Date startTime;
    
    	@ApiModelProperty(value = "直播结束时间")
    	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    	@TableField("end_time")
    	private Date endTime;
    
    	@ApiModelProperty(value = "主播老师id")
    	@TableField("teacher_id")
    	private Long teacherId;
    
    	@ApiModelProperty(value = "课程封面图片路径")
    	@TableField("cover")
    	private String cover;
    
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35

    order

    里面也差不多,注意下payment里面有几个是enum里的实体类即可。

    @Data
    @ApiModel(description = "PaymentInfo")
    @TableName("payment_info")
    public class PaymentInfo extends BaseEntity {
    
    	private static final long serialVersionUID = 1L;
    
    	@ApiModelProperty(value = "对外业务编号")
    	@TableField("out_trade_no")
    	private String outTradeNo;
    
    	@ApiModelProperty(value = "订单编号")
    	@TableField("order_id")
    	private Long orderId;
    
    	@ApiModelProperty(value = "用户id")
    	@TableField("user_id")
    	private Long userId;
    
    	@ApiModelProperty(value = "支付宝交易编号")
    	@TableField("alipay_trade_no")
    	private String alipayTradeNo;
    
    	@ApiModelProperty(value = "支付金额")
    	@TableField("total_amount")
    	private BigDecimal totalAmount;
    
    	@ApiModelProperty(value = "交易内容")
    	@TableField("trade_body")
    	private String tradeBody;
    
    	@ApiModelProperty(value = "paymentType")
    	@TableField("payment_type")
    	private PaymentType paymentType;
    
    	@ApiModelProperty(value = "支付状态")
    	@TableField("payment_status")
    	private PaymentStatus paymentStatus;
    
    	@ApiModelProperty(value = "回调信息")
    	@TableField("callback_content")
    	private String callbackContent;
    
    	@ApiModelProperty(value = "回调时间")
    	@TableField("callback_time")
    	private Date callbackTime;
    
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48

    user

    跳过

    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 = "手机号")
    	@TableField("phone")
    	private String phone;
    
    	@ApiModelProperty(value = "用户密码")
    	@TableField("password")
    	private String password;
    
    	@ApiModelProperty(value = "用户姓名")
    	@TableField("name")
    	private String name;
    
    	@ApiModelProperty(value = "昵称")
    	@TableField("nick_name")
    	private String nickName;
    
    	@ApiModelProperty(value = "性别")
    	@TableField("sex")
    	private Integer sex;
    
    	@ApiModelProperty(value = "头像")
    	@TableField("avatar")
    	private String avatar;
    
    	@ApiModelProperty(value = "省")
    	@TableField("province")
    	private String province;
    
    	@ApiModelProperty(value = "0:未订阅 1:已订阅")
    	@TableField("subscribe")
    	private Integer subscribe;
    
    	@ApiModelProperty(value = "小程序open id")
    	@TableField("open_id")
    	private String openId;
    
    	@ApiModelProperty(value = "微信开放平台unionID")
    	@TableField("union_id")
    	private String unionId;
    
    	@ApiModelProperty(value = "推荐人用户id")
    	@TableField("recommend_id")
    	private Long recommendId;
    
    	@ApiModelProperty(value = "status")
    	@TableField("status")
    	private Integer status;
    
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66

    vod

    vod就是直播板块,跳过。

    @Data
    @ApiModel(description = "Subject")
    @TableName("subject")
    public class Subject {
    
    	private static final long serialVersionUID = 1L;
    	@ApiModelProperty(value = "id")
    	private Long id;
    
    	@ApiModelProperty(value = "创建时间")
    	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    	@TableField("create_time")
    	private Date createTime;
    
    	@ApiModelProperty(value = "更新时间")
    	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    	@TableField("update_time")
    	private Date updateTime;
    
    	@ApiModelProperty(value = "逻辑删除(1:已删除,0:未删除)")
    	@JsonIgnore
    	@TableLogic
    	@TableField("is_deleted")
    	private Integer isDeleted;
    
    	@ApiModelProperty(value = "其他参数")
    	@TableField(exist = false)
    	private Map<String,Object> param = new HashMap<>();
    
    	@ApiModelProperty(value = "类别名称")
    	@TableField("title")
    	private String title;
    
    	@ApiModelProperty(value = "父ID")
    	@TableField("parent_id")
    	private Long parentId;
    
    	@ApiModelProperty(value = "排序字段")
    	@TableField("sort")
    	private Integer sort;
    
    	@ApiModelProperty(value = "是否包含子节点")
    	@TableField(exist = false)
    	private boolean hasChildren;
    
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
  • 相关阅读:
    Centos 7安装ansible自动化运维工具
    Windows 进程的创建和终止
    激光视觉惯导融合的slam系统
    5-什么是猴子补丁,有什么用途?什么是反射,python中如何使用反射?http和https的区别?
    机器学习-特征选择:使用Lassco回归精确选择最佳特征
    C++ 【多态】
    java 面试题 基础部分
    CTF-FTP后门利用
    上海IB国际学校介绍
    【VictoriaMetrics】单机版配置
  • 原文地址:https://blog.csdn.net/z754916067/article/details/125912580