domain.java.vm 1.44 KB
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();
    }
}