Entity.java.vm 2.95 KB
Newer Older
fangxinjiang's avatar
fangxinjiang committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
/*
 *    Copyright (c) 2018-2025, lengleng All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the yifu4cloud.com developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: lengleng (wangiegie@gmail.com)
 */
fangxinjiang's avatar
fangxinjiang committed
17
#*#set($excludeColumns = ["create_time","update_time","create_by","update_by"])*#
fangxinjiang's avatar
fangxinjiang committed
18 19
package ${package}.${moduleName}.entity;

fangxinjiang's avatar
fangxinjiang committed
20
import com.alibaba.excel.annotation.ExcelProperty;
fangxinjiang's avatar
fangxinjiang committed
21 22 23 24 25 26 27
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
fangxinjiang's avatar
fangxinjiang committed
28 29 30
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
fangxinjiang's avatar
fangxinjiang committed
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
#if(${hasBigDecimal})
import java.math.BigDecimal;
#end

/**
 * ${comments}
 *
 * @author ${author}
 * @date ${datetime}
 */
@Data
@TableName("${tableName}")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "${comments}")
public class ${className} extends BaseEntity {

#foreach ($column in $columns)
fangxinjiang's avatar
fangxinjiang committed
48 49 50 51 52 53 54
    ## 排除部分字段
    #if(!$excludeColumns.contains($column.columnName))
        /**
         * $column.comments
         */
        #if($column.columnName == $pk.columnName)
            @TableId(type = IdType.ASSIGN_ID)
fangxinjiang's avatar
fangxinjiang committed
55
        #else
fangxinjiang's avatar
fangxinjiang committed
56
            @ExcelAttribute(name = "$column.comments"#if($column.nullable), isNotEmpty = true,errorInfo  = "$column.comments不能为空" #end #if($column.attrType =='LocalDate' || $column.attrType =='LocalDateTime') ,isDate = true #end #if($column.maxLength), maxLength = $column.maxLength #end)
fangxinjiang's avatar
fangxinjiang committed
57
            #if($column.nullable)
fangxinjiang's avatar
fangxinjiang committed
58
            @NotBlank(message = "$column.comments不能为空")
fangxinjiang's avatar
fangxinjiang committed
59 60
            #end
            #if($column.maxLength && $column.attrType =='String')
fangxinjiang's avatar
fangxinjiang committed
61
            @Length(max=$column.maxLength,message = "$column.comments不能超过$column.maxLength个字符")
fangxinjiang's avatar
fangxinjiang committed
62
            #end
fangxinjiang's avatar
fangxinjiang committed
63 64
        #end
    #end
fangxinjiang's avatar
fangxinjiang committed
65
    @ExcelProperty("$column.comments")
fangxinjiang's avatar
fangxinjiang committed
66
    @Schema(description ="$column.comments"#if($column.hidden),hidden=$column.hidden#end)
fangxinjiang's avatar
fangxinjiang committed
67 68 69
    #if($column.attrType =='LocalDate' || $column.attrType =='LocalDateTime' || $column.attrType =='Date')
    private Date $column.lowerAttrName;
    #else
fangxinjiang's avatar
fangxinjiang committed
70
    private $column.attrType $column.lowerAttrName;
fangxinjiang's avatar
fangxinjiang committed
71
    #end
fangxinjiang's avatar
fangxinjiang committed
72 73 74
#end

}