/** * Copyright (c) 2011-2014, hubin (jobob@qq.com). * <p> * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * <p> * http://www.apache.org/licenses/LICENSE-2.0 * <p> * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ package com.baomidou.mybatisplus.test.h2.entity.persistent; import java.io.Serializable; import java.math.BigDecimal; import com.baomidou.mybatisplus.annotations.TableField; import com.baomidou.mybatisplus.annotations.TableId; import com.baomidou.mybatisplus.annotations.TableName; import com.baomidou.mybatisplus.annotations.Version; import com.baomidou.mybatisplus.enums.FieldStrategy; /** * <p> * 测试用户类 * </p> * * @author hubin sjy */ /* 表名 value 注解【 驼峰命名可无 】, resultMap 注解测试【 映射 xml 的 resultMap 内容 】 */ @TableName public class H2User implements Serializable { /* 表字段注解,false 表中不存在的字段,可无该注解 默认 true */ @TableField(exist = false) private static final long serialVersionUID = 1L; /* 主键ID 注解,value 字段名,type 用户输入ID */ @TableId(value = "test_id") private Long id; /* 测试忽略验证 */ private String name; private Integer age; /*BigDecimal 测试*/ private BigDecimal price; /* 测试下划线字段命名类型, 字段填充 */ @TableField(value = "test_type", validate = FieldStrategy.IGNORED) private Integer testType; private String desc; @Version private Integer version; public H2User() { } public H2User(String name) { this.name = name; } public H2User(Integer testType) { this.testType = testType; } public H2User(String name, Integer age) { this.name = name; this.age = age; } public H2User(Long id, String name) { this.id = id; this.name = name; } public H2User(Long id, Integer age) { this.id = id; this.age = age; } public H2User(Long id, String name, Integer age, Integer testType) { this.id = id; this.name = name; this.age = age; this.testType = testType; } public H2User(String name, Integer age, Integer testType) { this.name = name; this.age = age; this.testType = testType; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public BigDecimal getPrice() { return price; } public void setPrice(BigDecimal price) { this.price = price; } public Integer getAge() { return age; } public void setAge(Integer age) { this.age = age; } public Integer getTestType() { return testType; } public void setTestType(Integer testType) { this.testType = testType; } public String getDesc() { return desc; } public void setDesc(String desc) { this.desc = desc; } public Integer getVersion() { return version; } public void setVersion(Integer version) { this.version = version; } @Override public String toString() { return "H2User{" + "id=" + id + ", name='" + name + '\'' + ", age=" + age + ", price=" + price + ", testType=" + testType + ", desc='" + desc + '\'' + ", version=" + version + '}'; } }