Blame view

src/main/resources/templates/vm/java/domain.java.vm 1.44 KB
tangying authored
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
package ${package}.domain;

import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.annotations.TableField;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

#foreach ($column in $columns)
#if($column.attrType == 'Date')
    #break
#end
#end

/**
 * ${tableComment}表 ${tableName}
 * 
 * @author ${author}
 * @date ${datetime}
 */
#if ($tableName.contains("_"))
@TableName("${tableName}")
#end
public class ${className} extends Model<${className}>
{
	private static final long serialVersionUID = 1L;

#foreach ($column in $columns)
	/** $column.columnComment */
	private $column.attrType $column.attrname;
#end

#foreach ($column in $columns)
	public void set${column.attrName}($column.attrType $column.attrname) 
	{
		this.$column.attrname = $column.attrname;
	}

	public $column.attrType get${column.attrName}() 
	{
		return $column.attrname;
	}
#end

    @Override
    protected Serializable pkVal() { return this.id;}

    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
#foreach ($column in $columns)
            .append("${column.attrname}", get${column.attrName}())
#end
            .toString();
    }
}