修改代码生成器实体生成类

This commit is contained in:
xuwenbo
2020-05-14 01:06:01 +08:00
parent b932122b11
commit 5809246814
3 changed files with 10 additions and 79 deletions

View File

@ -1,4 +1,5 @@
package co.yixiang.modules.activity.domain; package co.yixiang.modules.activity.domain;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic; import com.baomidou.mybatisplus.annotation.TableLogic;
import lombok.Data; import lombok.Data;
import com.baomidou.mybatisplus.annotation.FieldFill; import com.baomidou.mybatisplus.annotation.FieldFill;
@ -21,7 +22,7 @@ import java.io.Serializable;
public class YxStoreBargain implements Serializable { public class YxStoreBargain implements Serializable {
/** 砍价产品ID */ /** 砍价产品ID */
@Id @TableId
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id") @Column(name = "id")
private Integer id; private Integer id;
@ -203,4 +204,4 @@ public class YxStoreBargain implements Serializable {
public void copy(YxStoreBargain source){ public void copy(YxStoreBargain source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
} }
} }

View File

@ -1,12 +1,8 @@
package co.yixiang.modules.activity.domain; package co.yixiang.modules.activity.domain;
import com.baomidou.mybatisplus.annotation.TableLogic; import com.baomidou.mybatisplus.annotation.*;
import lombok.Data; import lombok.Data;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions; import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.io.Serializable; import java.io.Serializable;
@ -15,184 +11,127 @@ import java.io.Serializable;
* @author hupeng * @author hupeng
* @date 2020-05-13 * @date 2020-05-13
*/ */
@Entity
@Data @Data
@Table(name="yx_store_combination") @TableName(value="yx_store_combination")
public class YxStoreCombination implements Serializable { public class YxStoreCombination implements Serializable {
@Id @TableId
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Integer id; private Integer id;
/** 商品id */ /** 商品id */
@Column(name = "product_id",nullable = false)
@NotNull
private Integer productId; private Integer productId;
/** 商户id */ /** 商户id */
@Column(name = "mer_id")
private Integer merId; private Integer merId;
/** 推荐图 */ /** 推荐图 */
@Column(name = "image",nullable = false)
@NotBlank
private String image; private String image;
/** 轮播图 */ /** 轮播图 */
@Column(name = "images",nullable = false)
@NotBlank
private String images; private String images;
/** 活动标题 */ /** 活动标题 */
@Column(name = "title",nullable = false)
@NotBlank
private String title; private String title;
/** 活动属性 */ /** 活动属性 */
@Column(name = "attr")
private String attr; private String attr;
/** 参团人数 */ /** 参团人数 */
@Column(name = "people",nullable = false)
@NotNull
private Integer people; private Integer people;
/** 简介 */ /** 简介 */
@Column(name = "info",nullable = false)
@NotBlank
private String info; private String info;
/** 价格 */ /** 价格 */
@Column(name = "price",nullable = false)
@NotNull
private BigDecimal price; private BigDecimal price;
/** 排序 */ /** 排序 */
@Column(name = "sort",nullable = false)
@NotNull
private Integer sort; private Integer sort;
/** 销量 */ /** 销量 */
@Column(name = "sales",nullable = false)
@NotNull
private Integer sales; private Integer sales;
/** 库存 */ /** 库存 */
@Column(name = "stock",nullable = false)
@NotNull
private Integer stock; private Integer stock;
/** 添加时间 */ /** 添加时间 */
@Column(name = "add_time",nullable = false)
@NotBlank
private String addTime; private String addTime;
/** 推荐 */ /** 推荐 */
@Column(name = "is_host",nullable = false)
@NotNull
private Integer isHost; private Integer isHost;
/** 产品状态 */ /** 产品状态 */
@Column(name = "is_show",nullable = false)
@NotNull
private Integer isShow; private Integer isShow;
@Column(name = "is_del",nullable = false)
@NotNull
private Integer isDel; private Integer isDel;
@Column(name = "combination",nullable = false)
@NotNull
private Integer combination; private Integer combination;
/** 商户是否可用1可用0不可用 */ /** 商户是否可用1可用0不可用 */
@Column(name = "mer_use")
private Integer merUse; private Integer merUse;
/** 是否包邮1是0否 */ /** 是否包邮1是0否 */
@Column(name = "is_postage",nullable = false)
@NotNull
private Integer isPostage; private Integer isPostage;
/** 邮费 */ /** 邮费 */
@Column(name = "postage",nullable = false)
@NotNull
private BigDecimal postage; private BigDecimal postage;
/** 拼团内容 */ /** 拼团内容 */
@Column(name = "description",nullable = false)
@NotBlank
private String description; private String description;
/** 拼团开始时间 */ /** 拼团开始时间 */
@Column(name = "start_time",nullable = false)
@NotNull
private Integer startTime; private Integer startTime;
/** 拼团结束时间 */ /** 拼团结束时间 */
@Column(name = "stop_time",nullable = false)
@NotNull
private Integer stopTime; private Integer stopTime;
/** 拼团订单有效时间 */ /** 拼团订单有效时间 */
@Column(name = "effective_time",nullable = false)
@NotNull
private Integer effectiveTime; private Integer effectiveTime;
/** 拼图产品成本 */ /** 拼图产品成本 */
@Column(name = "cost",nullable = false)
@NotNull
private Integer cost; private Integer cost;
/** 浏览量 */ /** 浏览量 */
@Column(name = "browse")
private Integer browse; private Integer browse;
/** 单位名 */ /** 单位名 */
@Column(name = "unit_name",nullable = false)
@NotBlank
private String unitName; private String unitName;
@Column(name = "end_time_date",nullable = false)
@NotNull
private Timestamp endTimeDate; private Timestamp endTimeDate;
@Column(name = "start_time_date",nullable = false)
@NotNull
private Timestamp startTimeDate; private Timestamp startTimeDate;
public void copy(YxStoreCombination source){ public void copy(YxStoreCombination source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
} }
} }

View File

@ -5,14 +5,10 @@ import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions; import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
<#if isNotNullColumns??> <#if isNotNullColumns??>
import javax.validation.constraints.*; import javax.validation.constraints.*;
</#if> </#if>
<#if hasDateAnnotation> <#if hasDateAnnotation>
import javax.persistence.Entity;
import javax.persistence.Table;
import org.hibernate.annotations.*;
</#if> </#if>
<#if hasTimestamp> <#if hasTimestamp>
import java.sql.Timestamp; import java.sql.Timestamp;
@ -26,9 +22,8 @@ import java.io.Serializable;
* @author ${author} * @author ${author}
* @date ${date} * @date ${date}
*/ */
@Entity
@Data @Data
@Table(name="${tableName}") @TableName(name="${tableName}")
public class ${className} implements Serializable { public class ${className} implements Serializable {
<#if columns??> <#if columns??>
<#list columns as column> <#list columns as column>
@ -37,12 +32,8 @@ public class ${className} implements Serializable {
/** ${column.remark} */ /** ${column.remark} */
</#if> </#if>
<#if column.columnKey = 'PRI'> <#if column.columnKey = 'PRI'>
@Id @TableId
<#if auto>
@GeneratedValue(strategy = GenerationType.IDENTITY)
</#if> </#if>
</#if>
@Column(name = "${column.columnName}"<#if column.columnKey = 'UNI'>,unique = true</#if><#if column.istNotNull && column.columnKey != 'PRI'>,nullable = false</#if>)
<#if column.istNotNull && column.columnKey != 'PRI'> <#if column.istNotNull && column.columnKey != 'PRI'>
<#if column.columnType = 'String'> <#if column.columnType = 'String'>
@NotBlank @NotBlank
@ -77,4 +68,4 @@ public class ${className} implements Serializable {
public void copy(${className} source){ public void copy(${className} source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
} }
} }