diff --git a/.gitignore b/.gitignore index 4788b4b..630fe11 100644 --- a/.gitignore +++ b/.gitignore @@ -111,3 +111,4 @@ buildNumber.properties # Common working directory run/ +/database/ \ No newline at end of file diff --git a/pom.xml b/pom.xml index 1edb4a1..71e1ead 100644 --- a/pom.xml +++ b/pom.xml @@ -41,6 +41,78 @@ + + + org.jooq + jooq-codegen-maven + + + + convergence + generate-sources + + generate + + + + + + + + org.sqlite.JDBC + jdbc:sqlite:database/database.db + + + + + org.jooq.codegen.JavaGenerator + + + + org.jooq.meta.sqlite.SQLiteDatabase + + + Version|LocationNotepad + + + + + true + + + + + ling.database + src/main/java + + + + + + + ^(.*)$ + + + PASCAL + $1_T_B + + + + PASCAL + $1_P_O + + + + PASCAL + $1_B_O + +
+
+
+
+
+
+
@@ -74,5 +146,11 @@ sqlite-jdbc 3.43.0.0 + + + org.jooq + jooq + 3.19.16 + diff --git a/src/main/java/ling/coordinateRecorder/CoordinateRecorder.java b/src/main/java/ling/coordinateRecorder/CoordinateRecorder.java index 967e0c4..57aaeda 100644 --- a/src/main/java/ling/coordinateRecorder/CoordinateRecorder.java +++ b/src/main/java/ling/coordinateRecorder/CoordinateRecorder.java @@ -1,17 +1,42 @@ package ling.coordinateRecorder; +import ling.coordinateRecorder.data.Database; import org.bukkit.plugin.java.JavaPlugin; +import java.sql.SQLException; + public final class CoordinateRecorder extends JavaPlugin { + private static CoordinateRecorder current; + private static Database database; + + private static void start() throws SQLException { + database.installPlugin(); + } + @Override public void onEnable() { // Plugin startup logic - + current = this; + try { + database = new Database(this); + start(); + getLogger().info("加载完毕"); + } catch (SQLException e) { + throw new RuntimeException("插件初始化失败", e); + } } @Override public void onDisable() { // Plugin shutdown logic } + + public static CoordinateRecorder getCurrent() { + return current; + } + + public static Database getDatabase() { + return database; + } } diff --git a/src/main/java/ling/coordinateRecorder/data/Database.java b/src/main/java/ling/coordinateRecorder/data/Database.java new file mode 100644 index 0000000..b863ded --- /dev/null +++ b/src/main/java/ling/coordinateRecorder/data/Database.java @@ -0,0 +1,106 @@ +package ling.coordinateRecorder.data; + +import ling.coordinateRecorder.CoordinateRecorder; +import ling.database.tables.VersionTB; +import ling.database.tables.records.VersionPO; +import org.bukkit.plugin.java.JavaPlugin; +import org.jooq.DSLContext; +import org.jooq.Record; +import org.jooq.impl.DSL; +import org.jooq.impl.SQLDataType; + +import java.io.File; +import java.math.BigDecimal; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; + +/// 用于提供数据库连接对象 +public class Database { + protected final JavaPlugin plugin; + protected final DSLContext ctx; + public static final int VERSION = 1; + public static final String VERSION_NAME = "V1.0"; + + public Database(JavaPlugin plugin) throws SQLException { + this.plugin = plugin; + File db = new File(plugin.getDataFolder(), "database.db"); + var connect = DriverManager.getConnection("jdbc:sqlite:" + db.getPath()); + ctx = DSL.using(connect); + } + + /// 获得一个数据库连接对象 + public Connection getDatabase() throws SQLException { + File db = new File(plugin.getDataFolder(), "database.db"); + return DriverManager.getConnection("jdbc:sqlite:" + db.getPath()); + } + + public DSLContext getDSL() throws SQLException { + return ctx; + } + + protected VersionPO getVersion() { + Record recordResult = ctx.select().from(VersionTB.VERSION).orderBy(VersionTB.VERSION.ID).limit(1).fetchOne(); + if (recordResult != null) { + return recordResult.into(VersionPO.class); + } + return null; + } + + protected void createVersion() { + if (ctx.meta().getTables("Version").isEmpty()) { + ctx.createTable("Version") + .column("ID", SQLDataType.INTEGER.identity(true)) + .column("version", SQLDataType.INTEGER.nullable(false)) + .column("versionName", SQLDataType.VARCHAR(32).nullable(false)) + .column("createTime", SQLDataType.BIGINTUNSIGNED.nullable(false)) + .constraint(DSL.primaryKey("ID")) + .execute(); + } + } + + /// 创建其他表 + protected void createTable() { + //玩家记录坐标点 + if (ctx.meta().getTables("LocationNotepad").isEmpty()) { + ctx.createTable("LocationNotepad") + .column("ID", SQLDataType.INTEGER.identity(true)) + .column("UID", SQLDataType.VARCHAR(64).nullable(false)) + .column("world", SQLDataType.VARCHAR(32).nullable(false)) + .column("name", SQLDataType.VARCHAR(64).nullable(false)) + .column("x", SQLDataType.INTEGER.nullable(false)) + .column("y", SQLDataType.INTEGER.nullable(false)) + .column("z", SQLDataType.INTEGER.nullable(false)) + .column("time", SQLDataType.BIGINTUNSIGNED.nullable(false)) + .column("isDelete", SQLDataType.BOOLEAN.nullable(false).default_(false)) + .execute(); + } + + } + + /// 初始化插件 + public void installPlugin() throws SQLException { + if (!plugin.getDataFolder().exists()) { + //noinspection ResultOfMethodCallIgnored + plugin.getDataFolder().mkdirs(); + } + createVersion(); + createTable(); + var version = getVersion(); + //数据库已经初始化 + if (version != null) { + CoordinateRecorder.getCurrent().getLogger().info("数据库版本:" + version.getVersion() + "," + version.getVersionname()); + return; + } + ctx.insertInto(VersionTB.VERSION) + .columns( + VersionTB.VERSION.VERSION_, + VersionTB.VERSION.VERSIONNAME, + VersionTB.VERSION.CREATETIME + ).values( + VERSION, + VERSION_NAME, + BigDecimal.valueOf(System.currentTimeMillis()) + ).execute(); + } +} diff --git a/src/main/java/ling/database/DefaultCatalog.java b/src/main/java/ling/database/DefaultCatalog.java new file mode 100644 index 0000000..5e8e34f --- /dev/null +++ b/src/main/java/ling/database/DefaultCatalog.java @@ -0,0 +1,54 @@ +/* + * This file is generated by jOOQ. + */ +package ling.database; + + +import java.util.Arrays; +import java.util.List; + +import org.jooq.Constants; +import org.jooq.Schema; +import org.jooq.impl.CatalogImpl; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class DefaultCatalog extends CatalogImpl { + + private static final long serialVersionUID = 1L; + + /** + * The reference instance of DEFAULT_CATALOG + */ + public static final DefaultCatalog DEFAULT_CATALOG = new DefaultCatalog(); + + /** + * The schema DEFAULT_SCHEMA. + */ + public final DefaultSchema DEFAULT_SCHEMA = DefaultSchema.DEFAULT_SCHEMA; + + /** + * No further instances allowed + */ + private DefaultCatalog() { + super(""); + } + + @Override + public final List getSchemas() { + return Arrays.asList( + DefaultSchema.DEFAULT_SCHEMA + ); + } + + /** + * A reference to the 3.19 minor release of the code generator. If this + * doesn't compile, it's because the runtime library uses an older minor + * release, namely: 3.19. You can turn off the generation of this reference + * by specifying /configuration/generator/generate/jooqVersionReference + */ + private static final String REQUIRE_RUNTIME_JOOQ_VERSION = Constants.VERSION_3_19; +} diff --git a/src/main/java/ling/database/DefaultSchema.java b/src/main/java/ling/database/DefaultSchema.java new file mode 100644 index 0000000..aab9d39 --- /dev/null +++ b/src/main/java/ling/database/DefaultSchema.java @@ -0,0 +1,61 @@ +/* + * This file is generated by jOOQ. + */ +package ling.database; + + +import java.util.Arrays; +import java.util.List; + +import ling.database.tables.LocationnotepadTB; +import ling.database.tables.VersionTB; + +import org.jooq.Catalog; +import org.jooq.Table; +import org.jooq.impl.SchemaImpl; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class DefaultSchema extends SchemaImpl { + + private static final long serialVersionUID = 1L; + + /** + * The reference instance of DEFAULT_SCHEMA + */ + public static final DefaultSchema DEFAULT_SCHEMA = new DefaultSchema(); + + /** + * The table LocationNotepad. + */ + public final LocationnotepadTB LOCATIONNOTEPAD = LocationnotepadTB.LOCATIONNOTEPAD; + + /** + * The table Version. + */ + public final VersionTB VERSION = VersionTB.VERSION; + + /** + * No further instances allowed + */ + private DefaultSchema() { + super("", null); + } + + + @Override + public Catalog getCatalog() { + return DefaultCatalog.DEFAULT_CATALOG; + } + + @Override + public final List> getTables() { + return Arrays.asList( + LocationnotepadTB.LOCATIONNOTEPAD, + VersionTB.VERSION + ); + } +} diff --git a/src/main/java/ling/database/Keys.java b/src/main/java/ling/database/Keys.java new file mode 100644 index 0000000..d6a77c8 --- /dev/null +++ b/src/main/java/ling/database/Keys.java @@ -0,0 +1,31 @@ +/* + * This file is generated by jOOQ. + */ +package ling.database; + + +import ling.database.tables.LocationnotepadTB; +import ling.database.tables.VersionTB; +import ling.database.tables.records.LocationnotepadPO; +import ling.database.tables.records.VersionPO; + +import org.jooq.TableField; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.Internal; + + +/** + * A class modelling foreign key relationships and constraints of tables in the + * default schema. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class Keys { + + // ------------------------------------------------------------------------- + // UNIQUE and PRIMARY KEY definitions + // ------------------------------------------------------------------------- + + public static final UniqueKey LOCATIONNOTEPAD__PK_LOCATIONNOTEPAD = Internal.createUniqueKey(LocationnotepadTB.LOCATIONNOTEPAD, DSL.name("pk_LocationNotepad"), new TableField[] { LocationnotepadTB.LOCATIONNOTEPAD.ID }, true); + public static final UniqueKey VERSION__PK_VERSION = Internal.createUniqueKey(VersionTB.VERSION, DSL.name("pk_Version"), new TableField[] { VersionTB.VERSION.ID }, true); +} diff --git a/src/main/java/ling/database/Tables.java b/src/main/java/ling/database/Tables.java new file mode 100644 index 0000000..5b95f83 --- /dev/null +++ b/src/main/java/ling/database/Tables.java @@ -0,0 +1,26 @@ +/* + * This file is generated by jOOQ. + */ +package ling.database; + + +import ling.database.tables.LocationnotepadTB; +import ling.database.tables.VersionTB; + + +/** + * Convenience access to all tables in the default schema. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class Tables { + + /** + * The table LocationNotepad. + */ + public static final LocationnotepadTB LOCATIONNOTEPAD = LocationnotepadTB.LOCATIONNOTEPAD; + + /** + * The table Version. + */ + public static final VersionTB VERSION = VersionTB.VERSION; +} diff --git a/src/main/java/ling/database/tables/LocationnotepadTB.java b/src/main/java/ling/database/tables/LocationnotepadTB.java new file mode 100644 index 0000000..f77aafe --- /dev/null +++ b/src/main/java/ling/database/tables/LocationnotepadTB.java @@ -0,0 +1,265 @@ +/* + * This file is generated by jOOQ. + */ +package ling.database.tables; + + +import java.math.BigDecimal; +import java.util.Collection; + +import ling.database.DefaultSchema; +import ling.database.Keys; +import ling.database.tables.records.LocationnotepadPO; + +import org.jooq.Condition; +import org.jooq.Field; +import org.jooq.Identity; +import org.jooq.Name; +import org.jooq.PlainSQL; +import org.jooq.QueryPart; +import org.jooq.SQL; +import org.jooq.Schema; +import org.jooq.Select; +import org.jooq.Stringly; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.TableOptions; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.SQLDataType; +import org.jooq.impl.TableImpl; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class LocationnotepadTB extends TableImpl { + + private static final long serialVersionUID = 1L; + + /** + * The reference instance of LocationNotepad + */ + public static final LocationnotepadTB LOCATIONNOTEPAD = new LocationnotepadTB(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return LocationnotepadPO.class; + } + + /** + * The column LocationNotepad.ID. + */ + public final TableField ID = createField(DSL.name("ID"), SQLDataType.INTEGER.nullable(false).identity(true), this, ""); + + /** + * The column LocationNotepad.UID. + */ + public final TableField UID = createField(DSL.name("UID"), SQLDataType.VARCHAR(64).nullable(false), this, ""); + + /** + * The column LocationNotepad.world. + */ + public final TableField WORLD = createField(DSL.name("world"), SQLDataType.VARCHAR(32).nullable(false), this, ""); + + /** + * The column LocationNotepad.name. + */ + public final TableField NAME = createField(DSL.name("name"), SQLDataType.VARCHAR(64).nullable(false), this, ""); + + /** + * The column LocationNotepad.x. + */ + public final TableField X = createField(DSL.name("x"), SQLDataType.INTEGER.nullable(false), this, ""); + + /** + * The column LocationNotepad.y. + */ + public final TableField Y = createField(DSL.name("y"), SQLDataType.INTEGER.nullable(false), this, ""); + + /** + * The column LocationNotepad.z. + */ + public final TableField Z = createField(DSL.name("z"), SQLDataType.INTEGER.nullable(false), this, ""); + + /** + * The column LocationNotepad.time. + */ + public final TableField TIME = createField(DSL.name("time"), SQLDataType.NUMERIC.nullable(false), this, ""); + + /** + * The column LocationNotepad.isDelete. + */ + public final TableField ISDELETE = createField(DSL.name("isDelete"), SQLDataType.BOOLEAN.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BOOLEAN)), this, ""); + + private LocationnotepadTB(Name alias, Table aliased) { + this(alias, aliased, (Field[]) null, null); + } + + private LocationnotepadTB(Name alias, Table aliased, Field[] parameters, Condition where) { + super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.table(), where); + } + + /** + * Create an aliased LocationNotepad table reference + */ + public LocationnotepadTB(String alias) { + this(DSL.name(alias), LOCATIONNOTEPAD); + } + + /** + * Create an aliased LocationNotepad table reference + */ + public LocationnotepadTB(Name alias) { + this(alias, LOCATIONNOTEPAD); + } + + /** + * Create a LocationNotepad table reference + */ + public LocationnotepadTB() { + this(DSL.name("LocationNotepad"), null); + } + + @Override + public Schema getSchema() { + return aliased() ? null : DefaultSchema.DEFAULT_SCHEMA; + } + + @Override + public Identity getIdentity() { + return (Identity) super.getIdentity(); + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.LOCATIONNOTEPAD__PK_LOCATIONNOTEPAD; + } + + @Override + public LocationnotepadTB as(String alias) { + return new LocationnotepadTB(DSL.name(alias), this); + } + + @Override + public LocationnotepadTB as(Name alias) { + return new LocationnotepadTB(alias, this); + } + + @Override + public LocationnotepadTB as(Table alias) { + return new LocationnotepadTB(alias.getQualifiedName(), this); + } + + /** + * Rename this table + */ + @Override + public LocationnotepadTB rename(String name) { + return new LocationnotepadTB(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public LocationnotepadTB rename(Name name) { + return new LocationnotepadTB(name, null); + } + + /** + * Rename this table + */ + @Override + public LocationnotepadTB rename(Table name) { + return new LocationnotepadTB(name.getQualifiedName(), null); + } + + /** + * Create an inline derived table from this table + */ + @Override + public LocationnotepadTB where(Condition condition) { + return new LocationnotepadTB(getQualifiedName(), aliased() ? this : null, null, condition); + } + + /** + * Create an inline derived table from this table + */ + @Override + public LocationnotepadTB where(Collection conditions) { + return where(DSL.and(conditions)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public LocationnotepadTB where(Condition... conditions) { + return where(DSL.and(conditions)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public LocationnotepadTB where(Field condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public LocationnotepadTB where(SQL condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public LocationnotepadTB where(@Stringly.SQL String condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public LocationnotepadTB where(@Stringly.SQL String condition, Object... binds) { + return where(DSL.condition(condition, binds)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public LocationnotepadTB where(@Stringly.SQL String condition, QueryPart... parts) { + return where(DSL.condition(condition, parts)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public LocationnotepadTB whereExists(Select select) { + return where(DSL.exists(select)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public LocationnotepadTB whereNotExists(Select select) { + return where(DSL.notExists(select)); + } +} diff --git a/src/main/java/ling/database/tables/VersionTB.java b/src/main/java/ling/database/tables/VersionTB.java new file mode 100644 index 0000000..83484d1 --- /dev/null +++ b/src/main/java/ling/database/tables/VersionTB.java @@ -0,0 +1,240 @@ +/* + * This file is generated by jOOQ. + */ +package ling.database.tables; + + +import java.math.BigDecimal; +import java.util.Collection; + +import ling.database.DefaultSchema; +import ling.database.Keys; +import ling.database.tables.records.VersionPO; + +import org.jooq.Condition; +import org.jooq.Field; +import org.jooq.Identity; +import org.jooq.Name; +import org.jooq.PlainSQL; +import org.jooq.QueryPart; +import org.jooq.SQL; +import org.jooq.Schema; +import org.jooq.Select; +import org.jooq.Stringly; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.TableOptions; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.SQLDataType; +import org.jooq.impl.TableImpl; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class VersionTB extends TableImpl { + + private static final long serialVersionUID = 1L; + + /** + * The reference instance of Version + */ + public static final VersionTB VERSION = new VersionTB(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return VersionPO.class; + } + + /** + * The column Version.ID. + */ + public final TableField ID = createField(DSL.name("ID"), SQLDataType.INTEGER.nullable(false).identity(true), this, ""); + + /** + * The column Version.version. + */ + public final TableField VERSION_ = createField(DSL.name("version"), SQLDataType.INTEGER.nullable(false), this, ""); + + /** + * The column Version.versionName. + */ + public final TableField VERSIONNAME = createField(DSL.name("versionName"), SQLDataType.VARCHAR(32).nullable(false), this, ""); + + /** + * The column Version.createTime. + */ + public final TableField CREATETIME = createField(DSL.name("createTime"), SQLDataType.NUMERIC.nullable(false), this, ""); + + private VersionTB(Name alias, Table aliased) { + this(alias, aliased, (Field[]) null, null); + } + + private VersionTB(Name alias, Table aliased, Field[] parameters, Condition where) { + super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.table(), where); + } + + /** + * Create an aliased Version table reference + */ + public VersionTB(String alias) { + this(DSL.name(alias), VERSION); + } + + /** + * Create an aliased Version table reference + */ + public VersionTB(Name alias) { + this(alias, VERSION); + } + + /** + * Create a Version table reference + */ + public VersionTB() { + this(DSL.name("Version"), null); + } + + @Override + public Schema getSchema() { + return aliased() ? null : DefaultSchema.DEFAULT_SCHEMA; + } + + @Override + public Identity getIdentity() { + return (Identity) super.getIdentity(); + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.VERSION__PK_VERSION; + } + + @Override + public VersionTB as(String alias) { + return new VersionTB(DSL.name(alias), this); + } + + @Override + public VersionTB as(Name alias) { + return new VersionTB(alias, this); + } + + @Override + public VersionTB as(Table alias) { + return new VersionTB(alias.getQualifiedName(), this); + } + + /** + * Rename this table + */ + @Override + public VersionTB rename(String name) { + return new VersionTB(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public VersionTB rename(Name name) { + return new VersionTB(name, null); + } + + /** + * Rename this table + */ + @Override + public VersionTB rename(Table name) { + return new VersionTB(name.getQualifiedName(), null); + } + + /** + * Create an inline derived table from this table + */ + @Override + public VersionTB where(Condition condition) { + return new VersionTB(getQualifiedName(), aliased() ? this : null, null, condition); + } + + /** + * Create an inline derived table from this table + */ + @Override + public VersionTB where(Collection conditions) { + return where(DSL.and(conditions)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public VersionTB where(Condition... conditions) { + return where(DSL.and(conditions)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public VersionTB where(Field condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public VersionTB where(SQL condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public VersionTB where(@Stringly.SQL String condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public VersionTB where(@Stringly.SQL String condition, Object... binds) { + return where(DSL.condition(condition, binds)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public VersionTB where(@Stringly.SQL String condition, QueryPart... parts) { + return where(DSL.condition(condition, parts)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public VersionTB whereExists(Select select) { + return where(DSL.exists(select)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public VersionTB whereNotExists(Select select) { + return where(DSL.notExists(select)); + } +} diff --git a/src/main/java/ling/database/tables/pojos/LocationnotepadBO.java b/src/main/java/ling/database/tables/pojos/LocationnotepadBO.java new file mode 100644 index 0000000..b892fd9 --- /dev/null +++ b/src/main/java/ling/database/tables/pojos/LocationnotepadBO.java @@ -0,0 +1,290 @@ +/* + * This file is generated by jOOQ. + */ +package ling.database.tables.pojos; + + +import java.io.Serializable; +import java.math.BigDecimal; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class LocationnotepadBO implements Serializable { + + private static final long serialVersionUID = 1L; + + private Integer id; + private String uid; + private String world; + private String name; + private Integer x; + private Integer y; + private Integer z; + private BigDecimal time; + private Boolean isdelete; + + public LocationnotepadBO() {} + + public LocationnotepadBO(LocationnotepadBO value) { + this.id = value.id; + this.uid = value.uid; + this.world = value.world; + this.name = value.name; + this.x = value.x; + this.y = value.y; + this.z = value.z; + this.time = value.time; + this.isdelete = value.isdelete; + } + + public LocationnotepadBO( + Integer id, + String uid, + String world, + String name, + Integer x, + Integer y, + Integer z, + BigDecimal time, + Boolean isdelete + ) { + this.id = id; + this.uid = uid; + this.world = world; + this.name = name; + this.x = x; + this.y = y; + this.z = z; + this.time = time; + this.isdelete = isdelete; + } + + /** + * Getter for LocationNotepad.ID. + */ + public Integer getId() { + return this.id; + } + + /** + * Setter for LocationNotepad.ID. + */ + public void setId(Integer id) { + this.id = id; + } + + /** + * Getter for LocationNotepad.UID. + */ + public String getUid() { + return this.uid; + } + + /** + * Setter for LocationNotepad.UID. + */ + public void setUid(String uid) { + this.uid = uid; + } + + /** + * Getter for LocationNotepad.world. + */ + public String getWorld() { + return this.world; + } + + /** + * Setter for LocationNotepad.world. + */ + public void setWorld(String world) { + this.world = world; + } + + /** + * Getter for LocationNotepad.name. + */ + public String getName() { + return this.name; + } + + /** + * Setter for LocationNotepad.name. + */ + public void setName(String name) { + this.name = name; + } + + /** + * Getter for LocationNotepad.x. + */ + public Integer getX() { + return this.x; + } + + /** + * Setter for LocationNotepad.x. + */ + public void setX(Integer x) { + this.x = x; + } + + /** + * Getter for LocationNotepad.y. + */ + public Integer getY() { + return this.y; + } + + /** + * Setter for LocationNotepad.y. + */ + public void setY(Integer y) { + this.y = y; + } + + /** + * Getter for LocationNotepad.z. + */ + public Integer getZ() { + return this.z; + } + + /** + * Setter for LocationNotepad.z. + */ + public void setZ(Integer z) { + this.z = z; + } + + /** + * Getter for LocationNotepad.time. + */ + public BigDecimal getTime() { + return this.time; + } + + /** + * Setter for LocationNotepad.time. + */ + public void setTime(BigDecimal time) { + this.time = time; + } + + /** + * Getter for LocationNotepad.isDelete. + */ + public Boolean getIsdelete() { + return this.isdelete; + } + + /** + * Setter for LocationNotepad.isDelete. + */ + public void setIsdelete(Boolean isdelete) { + this.isdelete = isdelete; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final LocationnotepadBO other = (LocationnotepadBO) obj; + if (this.id == null) { + if (other.id != null) + return false; + } + else if (!this.id.equals(other.id)) + return false; + if (this.uid == null) { + if (other.uid != null) + return false; + } + else if (!this.uid.equals(other.uid)) + return false; + if (this.world == null) { + if (other.world != null) + return false; + } + else if (!this.world.equals(other.world)) + return false; + if (this.name == null) { + if (other.name != null) + return false; + } + else if (!this.name.equals(other.name)) + return false; + if (this.x == null) { + if (other.x != null) + return false; + } + else if (!this.x.equals(other.x)) + return false; + if (this.y == null) { + if (other.y != null) + return false; + } + else if (!this.y.equals(other.y)) + return false; + if (this.z == null) { + if (other.z != null) + return false; + } + else if (!this.z.equals(other.z)) + return false; + if (this.time == null) { + if (other.time != null) + return false; + } + else if (!this.time.equals(other.time)) + return false; + if (this.isdelete == null) { + if (other.isdelete != null) + return false; + } + else if (!this.isdelete.equals(other.isdelete)) + return false; + return true; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((this.id == null) ? 0 : this.id.hashCode()); + result = prime * result + ((this.uid == null) ? 0 : this.uid.hashCode()); + result = prime * result + ((this.world == null) ? 0 : this.world.hashCode()); + result = prime * result + ((this.name == null) ? 0 : this.name.hashCode()); + result = prime * result + ((this.x == null) ? 0 : this.x.hashCode()); + result = prime * result + ((this.y == null) ? 0 : this.y.hashCode()); + result = prime * result + ((this.z == null) ? 0 : this.z.hashCode()); + result = prime * result + ((this.time == null) ? 0 : this.time.hashCode()); + result = prime * result + ((this.isdelete == null) ? 0 : this.isdelete.hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("LocationnotepadBO ("); + + sb.append(id); + sb.append(", ").append(uid); + sb.append(", ").append(world); + sb.append(", ").append(name); + sb.append(", ").append(x); + sb.append(", ").append(y); + sb.append(", ").append(z); + sb.append(", ").append(time); + sb.append(", ").append(isdelete); + + sb.append(")"); + return sb.toString(); + } +} diff --git a/src/main/java/ling/database/tables/pojos/VersionBO.java b/src/main/java/ling/database/tables/pojos/VersionBO.java new file mode 100644 index 0000000..dd877f9 --- /dev/null +++ b/src/main/java/ling/database/tables/pojos/VersionBO.java @@ -0,0 +1,160 @@ +/* + * This file is generated by jOOQ. + */ +package ling.database.tables.pojos; + + +import java.io.Serializable; +import java.math.BigDecimal; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class VersionBO implements Serializable { + + private static final long serialVersionUID = 1L; + + private Integer id; + private Integer version; + private String versionname; + private BigDecimal createtime; + + public VersionBO() {} + + public VersionBO(VersionBO value) { + this.id = value.id; + this.version = value.version; + this.versionname = value.versionname; + this.createtime = value.createtime; + } + + public VersionBO( + Integer id, + Integer version, + String versionname, + BigDecimal createtime + ) { + this.id = id; + this.version = version; + this.versionname = versionname; + this.createtime = createtime; + } + + /** + * Getter for Version.ID. + */ + public Integer getId() { + return this.id; + } + + /** + * Setter for Version.ID. + */ + public void setId(Integer id) { + this.id = id; + } + + /** + * Getter for Version.version. + */ + public Integer getVersion() { + return this.version; + } + + /** + * Setter for Version.version. + */ + public void setVersion(Integer version) { + this.version = version; + } + + /** + * Getter for Version.versionName. + */ + public String getVersionname() { + return this.versionname; + } + + /** + * Setter for Version.versionName. + */ + public void setVersionname(String versionname) { + this.versionname = versionname; + } + + /** + * Getter for Version.createTime. + */ + public BigDecimal getCreatetime() { + return this.createtime; + } + + /** + * Setter for Version.createTime. + */ + public void setCreatetime(BigDecimal createtime) { + this.createtime = createtime; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final VersionBO other = (VersionBO) obj; + if (this.id == null) { + if (other.id != null) + return false; + } + else if (!this.id.equals(other.id)) + return false; + if (this.version == null) { + if (other.version != null) + return false; + } + else if (!this.version.equals(other.version)) + return false; + if (this.versionname == null) { + if (other.versionname != null) + return false; + } + else if (!this.versionname.equals(other.versionname)) + return false; + if (this.createtime == null) { + if (other.createtime != null) + return false; + } + else if (!this.createtime.equals(other.createtime)) + return false; + return true; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((this.id == null) ? 0 : this.id.hashCode()); + result = prime * result + ((this.version == null) ? 0 : this.version.hashCode()); + result = prime * result + ((this.versionname == null) ? 0 : this.versionname.hashCode()); + result = prime * result + ((this.createtime == null) ? 0 : this.createtime.hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("VersionBO ("); + + sb.append(id); + sb.append(", ").append(version); + sb.append(", ").append(versionname); + sb.append(", ").append(createtime); + + sb.append(")"); + return sb.toString(); + } +} diff --git a/src/main/java/ling/database/tables/records/LocationnotepadPO.java b/src/main/java/ling/database/tables/records/LocationnotepadPO.java new file mode 100644 index 0000000..0214ea8 --- /dev/null +++ b/src/main/java/ling/database/tables/records/LocationnotepadPO.java @@ -0,0 +1,207 @@ +/* + * This file is generated by jOOQ. + */ +package ling.database.tables.records; + + +import java.math.BigDecimal; + +import ling.database.tables.LocationnotepadTB; +import ling.database.tables.pojos.LocationnotepadBO; + +import org.jooq.Record1; +import org.jooq.impl.UpdatableRecordImpl; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class LocationnotepadPO extends UpdatableRecordImpl { + + private static final long serialVersionUID = 1L; + + /** + * Setter for LocationNotepad.ID. + */ + public void setId(Integer value) { + set(0, value); + } + + /** + * Getter for LocationNotepad.ID. + */ + public Integer getId() { + return (Integer) get(0); + } + + /** + * Setter for LocationNotepad.UID. + */ + public void setUid(String value) { + set(1, value); + } + + /** + * Getter for LocationNotepad.UID. + */ + public String getUid() { + return (String) get(1); + } + + /** + * Setter for LocationNotepad.world. + */ + public void setWorld(String value) { + set(2, value); + } + + /** + * Getter for LocationNotepad.world. + */ + public String getWorld() { + return (String) get(2); + } + + /** + * Setter for LocationNotepad.name. + */ + public void setName(String value) { + set(3, value); + } + + /** + * Getter for LocationNotepad.name. + */ + public String getName() { + return (String) get(3); + } + + /** + * Setter for LocationNotepad.x. + */ + public void setX(Integer value) { + set(4, value); + } + + /** + * Getter for LocationNotepad.x. + */ + public Integer getX() { + return (Integer) get(4); + } + + /** + * Setter for LocationNotepad.y. + */ + public void setY(Integer value) { + set(5, value); + } + + /** + * Getter for LocationNotepad.y. + */ + public Integer getY() { + return (Integer) get(5); + } + + /** + * Setter for LocationNotepad.z. + */ + public void setZ(Integer value) { + set(6, value); + } + + /** + * Getter for LocationNotepad.z. + */ + public Integer getZ() { + return (Integer) get(6); + } + + /** + * Setter for LocationNotepad.time. + */ + public void setTime(BigDecimal value) { + set(7, value); + } + + /** + * Getter for LocationNotepad.time. + */ + public BigDecimal getTime() { + return (BigDecimal) get(7); + } + + /** + * Setter for LocationNotepad.isDelete. + */ + public void setIsdelete(Boolean value) { + set(8, value); + } + + /** + * Getter for LocationNotepad.isDelete. + */ + public Boolean getIsdelete() { + return (Boolean) get(8); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + @Override + public Record1 key() { + return (Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached LocationnotepadPO + */ + public LocationnotepadPO() { + super(LocationnotepadTB.LOCATIONNOTEPAD); + } + + /** + * Create a detached, initialised LocationnotepadPO + */ + public LocationnotepadPO(Integer id, String uid, String world, String name, Integer x, Integer y, Integer z, BigDecimal time, Boolean isdelete) { + super(LocationnotepadTB.LOCATIONNOTEPAD); + + setId(id); + setUid(uid); + setWorld(world); + setName(name); + setX(x); + setY(y); + setZ(z); + setTime(time); + setIsdelete(isdelete); + resetChangedOnNotNull(); + } + + /** + * Create a detached, initialised LocationnotepadPO + */ + public LocationnotepadPO(LocationnotepadBO value) { + super(LocationnotepadTB.LOCATIONNOTEPAD); + + if (value != null) { + setId(value.getId()); + setUid(value.getUid()); + setWorld(value.getWorld()); + setName(value.getName()); + setX(value.getX()); + setY(value.getY()); + setZ(value.getZ()); + setTime(value.getTime()); + setIsdelete(value.getIsdelete()); + resetChangedOnNotNull(); + } + } +} diff --git a/src/main/java/ling/database/tables/records/VersionPO.java b/src/main/java/ling/database/tables/records/VersionPO.java new file mode 100644 index 0000000..d0f02e8 --- /dev/null +++ b/src/main/java/ling/database/tables/records/VersionPO.java @@ -0,0 +1,127 @@ +/* + * This file is generated by jOOQ. + */ +package ling.database.tables.records; + + +import java.math.BigDecimal; + +import ling.database.tables.VersionTB; +import ling.database.tables.pojos.VersionBO; + +import org.jooq.Record1; +import org.jooq.impl.UpdatableRecordImpl; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class VersionPO extends UpdatableRecordImpl { + + private static final long serialVersionUID = 1L; + + /** + * Setter for Version.ID. + */ + public void setId(Integer value) { + set(0, value); + } + + /** + * Getter for Version.ID. + */ + public Integer getId() { + return (Integer) get(0); + } + + /** + * Setter for Version.version. + */ + public void setVersion(Integer value) { + set(1, value); + } + + /** + * Getter for Version.version. + */ + public Integer getVersion() { + return (Integer) get(1); + } + + /** + * Setter for Version.versionName. + */ + public void setVersionname(String value) { + set(2, value); + } + + /** + * Getter for Version.versionName. + */ + public String getVersionname() { + return (String) get(2); + } + + /** + * Setter for Version.createTime. + */ + public void setCreatetime(BigDecimal value) { + set(3, value); + } + + /** + * Getter for Version.createTime. + */ + public BigDecimal getCreatetime() { + return (BigDecimal) get(3); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + @Override + public Record1 key() { + return (Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached VersionPO + */ + public VersionPO() { + super(VersionTB.VERSION); + } + + /** + * Create a detached, initialised VersionPO + */ + public VersionPO(Integer id, Integer version, String versionname, BigDecimal createtime) { + super(VersionTB.VERSION); + + setId(id); + setVersion(version); + setVersionname(versionname); + setCreatetime(createtime); + resetChangedOnNotNull(); + } + + /** + * Create a detached, initialised VersionPO + */ + public VersionPO(VersionBO value) { + super(VersionTB.VERSION); + + if (value != null) { + setId(value.getId()); + setVersion(value.getVersion()); + setVersionname(value.getVersionname()); + setCreatetime(value.getCreatetime()); + resetChangedOnNotNull(); + } + } +}