first commit

This commit is contained in:
2025-02-20 14:59:35 +08:00
bovenliggende d7be84fac6
commit d4a3bb8ffc
2541 gewijzigde bestanden met toevoegingen van 336536 en 0 verwijderingen
@@ -0,0 +1,162 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test;
import java.util.ArrayList;
import java.util.List;
import org.zhiqim.kernel.Global;
import org.zhiqim.kernel.Zhiqim;
import org.zhiqim.orm.ORMConstants;
import org.zhiqim.orm.ORMParameter;
import org.zhiqim.orm.ORMServer;
public class ORMBoot implements ORMConstants
{
public static void loadBin()
{
List<String> pathList = new ArrayList<>();
pathList.add("./bin");
Zhiqim.loadClassAliasName(pathList);
}
public static void initMySQLServer() throws Exception
{
loadBin();
ORMParameter parameter = new ORMParameter();
parameter.setDbType("mysql");
parameter.setDriver("com.mysql.jdbc.Driver");
parameter.setUrl("jdbc:mysql://127.0.0.1:3306/zhiqim_orm?useUnicode=true&amp;characterEncoding=UTF-8");
parameter.setUser("root");
parameter.setPass("root");
parameter.setUpdateSqlLog(true);
parameter.setQuerySqlLog(true);
ORMServer server = new ORMServer();
server.setId("orm");
server.create(parameter);
Global.addService(server);
}
public static void initOracleServer() throws Exception
{
loadBin();
ORMParameter parameter = new ORMParameter();
parameter.setDbType("oracle");
parameter.setDriver("oracle.jdbc.driver.OracleDriver");
parameter.setUrl("jdbc:oracle:thin:@127.0.0.1:1521:ORCL");
parameter.setUser("zhiqim");
parameter.setPass("zhiqim");
parameter.setUpdateSqlLog(true);
parameter.setQuerySqlLog(true);
ORMServer server = new ORMServer();
server.setId("orm");
server.create(parameter);
Global.addService(server);
}
public static void initMSSQLServer() throws Exception
{
loadBin();
ORMParameter parameter = new ORMParameter();
parameter.setDbType("mssql");
parameter.setDriver("com.microsoft.sqlserver.jdbc.SQLServerDriver");
parameter.setUrl("jdbc:sqlserver://127.0.0.1:1433;DatabaseName=zhiqim_orm_test");
parameter.setUser("sa");
parameter.setPass("taobug2012");
parameter.setUpdateSqlLog(true);
parameter.setQuerySqlLog(true);
ORMServer server = new ORMServer();
server.setId("orm");
server.create(parameter);
Global.addService(server);
}
public static void initPSQLServer() throws Exception
{
loadBin();
ORMParameter parameter = new ORMParameter();
parameter.setDbType("postgresql");
parameter.setDriver("org.postgresql.Driver");
parameter.setUrl("jdbc:postgresql://127.0.0.1:5432/zhiqim_orm_test");
parameter.setUser("postgres");
parameter.setPass("taobug2012");
parameter.setUpdateSqlLog(true);
parameter.setQuerySqlLog(true);
ORMServer server = new ORMServer();
server.setId("orm");
server.create(parameter);
Global.addService(server);
}
public static void initSQLiteServer() throws Exception
{
loadBin();
ORMParameter parameter = new ORMParameter();
parameter.setDbType("sqlite");
parameter.setDriver("org.sqlite.JDBC");
parameter.setUrl("jdbc:sqlite:./database/zhiqim_orm_test.db");
parameter.setUser("root");
parameter.setPass("root");
parameter.setUpdateSqlLog(true);
parameter.setQuerySqlLog(true);
ORMServer server = new ORMServer();
server.setId("orm");
server.create(parameter);
Global.addService(server);
}
public static void initHSQLServer() throws Exception
{
loadBin();
ORMParameter parameter = new ORMParameter();
parameter.setDbType("hsql");
parameter.setDriver("org.hsqldb.jdbc.JDBCDriver");
parameter.setUrl("jdbc:hsqldb:./database/hsql");
parameter.setUser("sa");
parameter.setPass("");
parameter.setUpdateSqlLog(true);
parameter.setQuerySqlLog(true);
ORMServer server = new ORMServer();
server.setId("orm");
server.create(parameter);
Global.addService(server);
}
}
@@ -0,0 +1,48 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test;
import org.zhiqim.kernel.util.Replaces;
public class TestPrintSQL
{
public static void main(String[] args)
{
String v = "~!@#$%^&*()_+?><:\"{}";
String str = "update TEST set abc=?";
//SQL转义
v = v.replaceAll("'", "''");
if (v.indexOf("?") == -1)
str = str.replaceFirst("\\?", "'"+ v +"'");
else
{//转义
v = Replaces.replaceAllEscape(v, "?", "-%6-%-3%-");
v = Replaces.toReplaceEscape(v);
str = str.replaceFirst("\\?", "'"+ v +"'");
// str = Replaces.replaceAllEscape(str, "?", "'"+ v +"'");
}
System.out.println(str);
}
}
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ZHIQIM-SQL PUBLIC "-//ZHIQIM //DTD Zhiqim-Sql Configuration 1.5.0//EN" "http://zhiqim.org/xmldtds/zhiqim_sql_1_5_0.dtd">
<zhiqim-sql>
<!-- 插入数据 -->
<sql id="insert_user_info">
<![CDATA[
insert into USER_INFO (USER_ID, USER_NAME, USER_PASS, USER_EMAIL, USER_NICK, USER_AVATAR)
values (#USER_ID#, #USER_NAME#, #USER_PASS#, #USER_EMAIL#, #USER_NICK#, #USER_AVATAR#)
]]>
</sql>
<!-- 删除数据 -->
<sql id="delete_user_info">
<![CDATA[
delete from USER_INFO where USER_ID=#USER_ID#
]]>
</sql>
<!-- 更新全部数据 -->
<sql id="update_user_info">
<![CDATA[
update USER_INFO set USER_NAME=#USER_NAME#, USER_PASS=#USER_PASS#, USER_EMAIL=#USER_EMAIL#, USER_NICK=#USER_NICK#, USER_AVATAR=#USER_AVATAR#
where USER_ID=#USER_ID#
]]>
</sql>
<!-- 查询指定数据 -->
<sql id="select_user_info">
<![CDATA[
select USER_NAME, USER_NICK from USER_INFO
where USER_NICK like '%#USER_NICK#%' and USER_EMAIL=#USER_EMAIL#
]]>
</sql>
<!-- 按月存储日志,查指定MONTH的日志列表 -->
<sql id="query_user_log">
<![CDATA[
select * from USER_LOG_$MONTH$ where USER_ID=?
]]>
</sql>
</zhiqim-sql>
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ZHIQIM-SQL PUBLIC "-//ZHIQIM //DTD Zhiqim-Sql Configuration 1.5.0//EN" "http://zhiqim.org/xmldtds/zhiqim_sql_1_5_0.dtd">
<zhiqim-sql>
<!-- 插入数据 -->
<sql id="insert_user_info_test2">
<![CDATA[
insert into USER_INFO (USER_ID, USER_NAME, USER_PASS, USER_EMAIL, USER_NICK, USER_AVATAR)
values (#USER_ID#, #USER_NAME#, #USER_PASS#, #USER_EMAIL#, #USER_NICK#, #USER_AVATAR#)
]]>
</sql>
<!-- 删除数据 -->
<sql id="delete_user_info_test2">
<![CDATA[
delete from USER_INFO where USER_ID=#USER_ID#
]]>
</sql>
<!-- 更新全部数据 -->
<sql id="update_user_info_test2">
<![CDATA[
update USER_INFO set USER_NAME=#USER_NAME#, USER_PASS=#USER_PASS#, USER_EMAIL=#USER_EMAIL#, USER_NICK=#USER_NICK#, USER_AVATAR=#USER_AVATAR#
where USER_ID=#USER_ID#
]]>
</sql>
<!-- 查询指定数据 -->
<sql id="select_user_info_test2">
<![CDATA[
select USER_NAME, USER_NICK from USER_INFO
where USER_NICK like '%#USER_NICK#%' and USER_EMAIL=#USER_EMAIL#
]]>
</sql>
<!-- 按月存储日志,查指定MONTH的日志列表 -->
<sql id="query_user_log_test2">
<![CDATA[
select * from USER_LOG_$MONTH$ where USER_ID=?
]]>
</sql>
</zhiqim-sql>
@@ -0,0 +1,78 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.dbo;
import java.io.Serializable;
import org.zhiqim.kernel.annotation.AnAlias;
import org.zhiqim.kernel.json.Jsons;
import org.zhiqim.orm.annotation.*;
/**
* 管理员表 对应表《ADMIN》
*/
@AnAlias("Admin")
@AnTable(table="ADMIN", key="ADMIN_NAME", type="InnoDB")
public class Admin implements Serializable
{
private static final long serialVersionUID = 1L;
@AnTableField(column="ADMIN_NAME", type="string,32", notNull=true) private String adminName; //1.管理员名称
@AnTableField(column="ADMIN_PASS", type="string,32", notNull=true) private String adminPass; //2.管理员密码
@AnTableField(column="ADMIN_TIME", type="string,19,char", notNull=true) private String adminTime; //3.管理员时间
public String toString()
{
return Jsons.toString(this);
}
public String getAdminName()
{
return adminName;
}
public void setAdminName(String adminName)
{
this.adminName = adminName;
}
public String getAdminPass()
{
return adminPass;
}
public void setAdminPass(String adminPass)
{
this.adminPass = adminPass;
}
public String getAdminTime()
{
return adminTime;
}
public void setAdminTime(String adminTime)
{
this.adminTime = adminTime;
}
}
@@ -0,0 +1,122 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.dbo;
import java.io.Serializable;
import org.zhiqim.kernel.annotation.AnAlias;
import org.zhiqim.kernel.json.Jsons;
import org.zhiqim.orm.annotation.*;
/**
* 留言表 对应表《MESSAGE》
*/
@AnAlias("Message")
@AnTable(table="MESSAGE", key="MESSAGE_ID", type="InnoDB")
public class Message implements Serializable
{
private static final long serialVersionUID = 1L;
@AnTableField(column="MESSAGE_ID", type="long", notNull=true) private long messageId; //1.留言编号
@AnTableField(column="MESSAGE_NAME", type="string,32", notNull=true) private String messageName; //2.访客称呼
@AnTableField(column="MESSAGE_CONTACTING", type="string,50", notNull=false) private String messageContacting; //3.访客联系方式
@AnTableField(column="MESSAGE_CONTENT", type="string,1000", notNull=true) private String messageContent; //4.访客留言内容
@AnTableField(column="MESSAGE_TIME", type="string,19,char", notNull=true) private String messageTime; //5.访客留言时间
@AnTableField(column="MESSAGE_RTIME", type="string,19,char", notNull=false) private String messageRtime; //6.管理员回复时间
@AnTableField(column="MESSAGE_REPLY", type="string,1000", notNull=false) private String messageReply; //7.管理员回复内容
public String toString()
{
return Jsons.toString(this);
}
public long getMessageId()
{
return messageId;
}
public void setMessageId(long messageId)
{
this.messageId = messageId;
}
public String getMessageName()
{
return messageName;
}
public void setMessageName(String messageName)
{
this.messageName = messageName;
}
public String getMessageContacting()
{
return messageContacting;
}
public void setMessageContacting(String messageContacting)
{
this.messageContacting = messageContacting;
}
public String getMessageContent()
{
return messageContent;
}
public void setMessageContent(String messageContent)
{
this.messageContent = messageContent;
}
public String getMessageTime()
{
return messageTime;
}
public void setMessageTime(String messageTime)
{
this.messageTime = messageTime;
}
public String getMessageRtime()
{
return messageRtime;
}
public void setMessageRtime(String messageRtime)
{
this.messageRtime = messageRtime;
}
public String getMessageReply()
{
return messageReply;
}
public void setMessageReply(String messageReply)
{
this.messageReply = messageReply;
}
}
@@ -0,0 +1,56 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.dbo;
import java.io.Serializable;
import org.zhiqim.kernel.annotation.AnAlias;
import org.zhiqim.kernel.json.Jsons;
import org.zhiqim.orm.annotation.*;
/**
* 订单表 对应表《ORDER》
*/
@AnAlias("Order")
@AnTable(table="ORDER", key="ORDER_ID", type="InnoDB")
public class Order implements Serializable
{
private static final long serialVersionUID = 1L;
@AnTableField(column="ORDER_ID", type="long", notNull=true) private long orderId; //1.订单编号
public String toString()
{
return Jsons.toString(this);
}
public long getOrderId()
{
return orderId;
}
public void setOrderId(long orderId)
{
this.orderId = orderId;
}
}
@@ -0,0 +1,67 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.dbo;
import java.io.Serializable;
import org.zhiqim.kernel.annotation.AnAlias;
import org.zhiqim.kernel.json.Jsons;
import org.zhiqim.orm.annotation.*;
/**
* 测试自增长字段 对应表《T_AUTO》
*/
@AnAlias("TAuto")
@AnTable(table="T_AUTO", key="T_ID", type="InnoDB")
public class TAuto implements Serializable
{
private static final long serialVersionUID = 1L;
@AnTableField(column="T_ID", type="long", notNull=true) private long tId; //1.测试编号
@AnTableField(column="T_VARCHAR", type="string,32", notNull=false) private String tVarchar; //2.变长字符串
public String toString()
{
return Jsons.toString(this);
}
public long getTId()
{
return tId;
}
public void setTId(long tId)
{
this.tId = tId;
}
public String getTVarchar()
{
return tVarchar;
}
public void setTVarchar(String tVarchar)
{
this.tVarchar = tVarchar;
}
}
@@ -0,0 +1,79 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.dbo;
import java.io.Serializable;
import java.sql.Timestamp;
import org.zhiqim.kernel.annotation.AnAlias;
import org.zhiqim.kernel.json.Jsons;
import org.zhiqim.orm.annotation.*;
/**
* 测试日期格式 对应表《T_DATETIME》
*/
@AnAlias("TDatetime")
@AnTable(table="T_DATETIME", key="T_ID", type="InnoDB")
public class TDatetime implements Serializable
{
private static final long serialVersionUID = 1L;
@AnTableField(column="T_ID", type="long", notNull=true) private long tId; //1.测试编号
@AnTableField(column="T_DATETIME", type="datetime", notNull=true) private Timestamp tDatetime; //2.测试日期
@AnTableField(column="T_DATETIME2", type="datetime", notNull=true) private Timestamp tDatetime2; //3.测试日期
public String toString()
{
return Jsons.toString(this);
}
public long getTId()
{
return tId;
}
public void setTId(long tId)
{
this.tId = tId;
}
public Timestamp getTDatetime()
{
return tDatetime;
}
public void setTDatetime(Timestamp tDatetime)
{
this.tDatetime = tDatetime;
}
public Timestamp getTDatetime2()
{
return tDatetime2;
}
public void setTDatetime2(Timestamp tDatetime2)
{
this.tDatetime2 = tDatetime2;
}
}
@@ -0,0 +1,89 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.dbo;
import java.io.Serializable;
import org.zhiqim.kernel.annotation.AnAlias;
import org.zhiqim.kernel.json.Jsons;
import org.zhiqim.orm.annotation.*;
/**
* 测试小数格式 对应表《T_DECIMAL》
*/
@AnAlias("TDecimal")
@AnTable(table="T_DECIMAL", key="T_ID", type="InnoDB")
public class TDecimal implements Serializable
{
private static final long serialVersionUID = 1L;
@AnTableField(column="T_ID", type="long", notNull=true) private long tId; //1.测试编号
@AnTableField(column="T_DM5_2", type="decimal,5,2", notNull=true) private double tDm52; //2.测试5位长度,小数2位
@AnTableField(column="T_DM10_3", type="decimal,10,3", notNull=true) private double tDm103; //3.测试10位长度,小数3位
@AnTableField(column="T_DM15_4", type="decimal,15,4", notNull=true) private double tDm154; //4.测试15位长度,小数4位
public String toString()
{
return Jsons.toString(this);
}
public long getTId()
{
return tId;
}
public void setTId(long tId)
{
this.tId = tId;
}
public double getTDm52()
{
return tDm52;
}
public void setTDm52(double tDm52)
{
this.tDm52 = tDm52;
}
public double getTDm103()
{
return tDm103;
}
public void setTDm103(double tDm103)
{
this.tDm103 = tDm103;
}
public double getTDm154()
{
return tDm154;
}
public void setTDm154(double tDm154)
{
this.tDm154 = tDm154;
}
}
@@ -0,0 +1,111 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.dbo;
import java.io.Serializable;
import org.zhiqim.kernel.annotation.AnAlias;
import org.zhiqim.kernel.json.Jsons;
import org.zhiqim.orm.annotation.*;
/**
* 整型测试表 对应表《T_INTEGER》
*/
@AnAlias("TInteger")
@AnTable(table="T_INTEGER", key="T_ID", type="InnoDB")
public class TInteger implements Serializable
{
private static final long serialVersionUID = 1L;
@AnTableField(column="T_ID", type="long", notNull=true) private long tId; //1.测试编号
@AnTableField(column="T_BOOLEAN", type="boolean", notNull=true) private boolean tBoolean; //2.布尔型
@AnTableField(column="T_BYTE", type="byte", notNull=true) private int tByte; //3.字节型
@AnTableField(column="T_SHORT", type="short", notNull=true) private int tShort; //4.短整型
@AnTableField(column="T_INT", type="int", notNull=true) private int tInt; //5.整型
@AnTableField(column="T_LONG", type="long", notNull=true) private long tLong; //6.长整型
public String toString()
{
return Jsons.toString(this);
}
public long getTId()
{
return tId;
}
public void setTId(long tId)
{
this.tId = tId;
}
public boolean isTBoolean()
{
return tBoolean;
}
public void setTBoolean(boolean tBoolean)
{
this.tBoolean = tBoolean;
}
public int getTByte()
{
return tByte;
}
public void setTByte(int tByte)
{
this.tByte = tByte;
}
public int getTShort()
{
return tShort;
}
public void setTShort(int tShort)
{
this.tShort = tShort;
}
public int getTInt()
{
return tInt;
}
public void setTInt(int tInt)
{
this.tInt = tInt;
}
public long getTLong()
{
return tLong;
}
public void setTLong(long tLong)
{
this.tLong = tLong;
}
}
@@ -0,0 +1,122 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.dbo;
import java.io.Serializable;
import org.zhiqim.kernel.annotation.AnAlias;
import org.zhiqim.kernel.json.Jsons;
import org.zhiqim.orm.annotation.*;
/**
* 测试字符串 对应表《T_STRING》
*/
@AnAlias("TString")
@AnTable(table="T_STRING", key="T_ID", type="InnoDB")
public class TString implements Serializable
{
private static final long serialVersionUID = 1L;
@AnTableField(column="T_ID", type="long", notNull=true) private long tId; //1.测试编号
@AnTableField(column="T_CHAR", type="string,19,char", notNull=false) private String tChar; //2.定长字符串
@AnTableField(column="T_VARCHAR", type="string,32", notNull=false) private String tVarchar; //3.变长字符串
@AnTableField(column="T_STRING2000", type="string,2000", notNull=false) private String tString2000; //4.变成2000长度
@AnTableField(column="T_STRING4000", type="string,4000", notNull=false) private String tString4000; //5.变长4000长度
@AnTableField(column="T_STRING8000", type="string,8000", notNull=false) private String tString8000; //6.变长8000长度
@AnTableField(column="T_STRING16000", type="string,16000", notNull=false) private String tString16000; //7.变长16000长度
public String toString()
{
return Jsons.toString(this);
}
public long getTId()
{
return tId;
}
public void setTId(long tId)
{
this.tId = tId;
}
public String getTChar()
{
return tChar;
}
public void setTChar(String tChar)
{
this.tChar = tChar;
}
public String getTVarchar()
{
return tVarchar;
}
public void setTVarchar(String tVarchar)
{
this.tVarchar = tVarchar;
}
public String getTString2000()
{
return tString2000;
}
public void setTString2000(String tString2000)
{
this.tString2000 = tString2000;
}
public String getTString4000()
{
return tString4000;
}
public void setTString4000(String tString4000)
{
this.tString4000 = tString4000;
}
public String getTString8000()
{
return tString8000;
}
public void setTString8000(String tString8000)
{
this.tString8000 = tString8000;
}
public String getTString16000()
{
return tString16000;
}
public void setTString16000(String tString16000)
{
this.tString16000 = tString16000;
}
}
@@ -0,0 +1,158 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.dbo;
import java.io.Serializable;
import org.zhiqim.kernel.annotation.AnAlias;
import org.zhiqim.kernel.annotation.AnNew;
import org.zhiqim.kernel.json.Jsons;
import org.zhiqim.orm.annotation.*;
/**
* 组织部门表 对应表《ZMR_DEPT》
*/
@AnAlias("ZmrDept")
@AnNew
@AnTable(table="ZMR_DEPT", key="DEPT_ID", type="InnoDB")
@AnIndex({@AnIndexValue(name="IX_ORG_ID", column="ORG_ID", unique=false)})
public class ZmrDept implements Serializable
{
private static final long serialVersionUID = 1L;
@AnTableField(column="ORG_ID", type="long", notNull=true) private long orgId; //1.组织编号
@AnTableField(column="PARENT_ID", type="long", notNull=true) private long parentId; //2.部门父编号
@AnTableField(column="DEPT_ID", type="long", notNull=true) private long deptId; //3.部门编号
@AnTableField(column="DEPT_NAME", type="string,32", notNull=true) private String deptName; //4.部门名称
@AnTableField(column="DEPT_LEVEL", type="int", notNull=true) private int deptLevel; //5.部门级别
@AnTableField(column="DEPT_STATUS", type="byte", notNull=true) private int deptStatus; //6.部门状态,0表示正常,1表示停用
@AnTableField(column="DEPT_SEQ", type="int", notNull=true) private int deptSeq; //7.部门排序数
@AnTableField(column="DEPT_PARENT_ALL", type="string,850", notNull=true) private String deptParentAll; //8.部门所有父节点,多个逗号隔开
@AnTableField(column="DEPT_MANAGER", type="string,32", notNull=false) private String deptManager; //9.部门负责人
@AnTableField(column="DEPT_DESC", type="string,100", notNull=false) private String deptDesc; //10.部门描述
public String toString()
{
return Jsons.toString(this);
}
public long getOrgId()
{
return orgId;
}
public void setOrgId(long orgId)
{
this.orgId = orgId;
}
public long getParentId()
{
return parentId;
}
public void setParentId(long parentId)
{
this.parentId = parentId;
}
public long getDeptId()
{
return deptId;
}
public void setDeptId(long deptId)
{
this.deptId = deptId;
}
public String getDeptName()
{
return deptName;
}
public void setDeptName(String deptName)
{
this.deptName = deptName;
}
public int getDeptLevel()
{
return deptLevel;
}
public void setDeptLevel(int deptLevel)
{
this.deptLevel = deptLevel;
}
public int getDeptStatus()
{
return deptStatus;
}
public void setDeptStatus(int deptStatus)
{
this.deptStatus = deptStatus;
}
public int getDeptSeq()
{
return deptSeq;
}
public void setDeptSeq(int deptSeq)
{
this.deptSeq = deptSeq;
}
public String getDeptParentAll()
{
return deptParentAll;
}
public void setDeptParentAll(String deptParentAll)
{
this.deptParentAll = deptParentAll;
}
public String getDeptManager()
{
return deptManager;
}
public void setDeptManager(String deptManager)
{
this.deptManager = deptManager;
}
public String getDeptDesc()
{
return deptDesc;
}
public void setDeptDesc(String deptDesc)
{
this.deptDesc = deptDesc;
}
}
@@ -0,0 +1,257 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.dbo;
import java.io.Serializable;
import org.zhiqim.kernel.annotation.AnAlias;
import org.zhiqim.kernel.annotation.AnNew;
import org.zhiqim.kernel.json.Jsons;
import org.zhiqim.orm.annotation.*;
/**
* 操作员表 对应表《ZMR_OPERATOR》
*/
@AnAlias("ZmrOperator")
@AnNew
@AnTable(table="ZMR_OPERATOR", key="OPERATOR_CODE", type="InnoDB")
@AnIndex({@AnIndexValue(name="IX_ORG_ID", column="ORG_ID", unique=false)})
public class ZmrOperator implements Serializable
{
private static final long serialVersionUID = 1L;
@AnTableField(column="ORG_ID", type="long", notNull=true) private long orgId; //1.组织编号
@AnTableField(column="OPERATOR_CODE", type="string,32", notNull=true) private String operatorCode; //2.操作员编码
@AnTableField(column="OPERATOR_PASS", type="string,64,char", notNull=true) private String operatorPass; //3.操作员密码
@AnTableField(column="OPERATOR_PASS_SALT", type="string,64,char", notNull=true) private String operatorPassSalt; //4.操作员密码盐值
@AnTableField(column="OPERATOR_STATUS", type="byte", notNull=true) private int operatorStatus; //5.操作员状态:0正常,1停用
@AnTableField(column="OPERATOR_TYPE", type="byte", notNull=true) private int operatorType; //6.操作员类型:0:超级管理员,1:管理员,2:操作员
@AnTableField(column="OPERATOR_NAME", type="string,64", notNull=true) private String operatorName; //7.操作员名称
@AnTableField(column="OPERATOR_AVATAR", type="long", notNull=false) private long operatorAvatar; //8.操作员头像编号
@AnTableField(column="OPERATOR_DEPT", type="string,850", notNull=false) private String operatorDept; //9.操作员所属部门,多个用逗号隔开,当前支持关联50个部门
@AnTableField(column="OPERATOR_DEPT_ALL", type="string,1700", notNull=false) private String operatorDeptAll; //10.操作员对应的所有部门,多个用逗号隔开,当前支持关联100个部门
@AnTableField(column="OPERATOR_ROLE", type="string,850", notNull=false) private String operatorRole; //11.操作员角色,多个用逗号隔开,当前支持关联50个角色
@AnTableField(column="OPERATOR_MOBILE", type="string,21", notNull=false) private String operatorMobile; //12.操作员手机号
@AnTableField(column="OPERATOR_EMAIL", type="string,64", notNull=false) private String operatorEmail; //13.操作员邮箱
@AnTableField(column="OPERATOR_SKIN", type="string,20", notNull=false) private String operatorSkin; //14.操作员主题肤色
@AnTableField(column="OPERATOR_IP", type="string,18", notNull=false) private String operatorIp; //15.操作员工作IP
@AnTableField(column="OPERATOR_URL", type="string,50", notNull=false) private String operatorUrl; //16.操作员登录后首页
@AnTableField(column="OPERATOR_PARAM", type="string,1024", notNull=false) private String operatorParam; //17.操作员参数,用于项目自定义设置
@AnTableField(column="OPERATOR_CREATED", type="string,19,char", notNull=true) private String operatorCreated; //18.操作员创建时间,格式:yyyy-MM-dd hh:mm:ss
@AnTableField(column="OPERATOR_MODIFIED", type="string,19,char", notNull=true) private String operatorModified; //19.操作员修改时间,格式:yyyy-MM-dd hh:mm:ss
public String toString()
{
return Jsons.toString(this);
}
public long getOrgId()
{
return orgId;
}
public void setOrgId(long orgId)
{
this.orgId = orgId;
}
public String getOperatorCode()
{
return operatorCode;
}
public void setOperatorCode(String operatorCode)
{
this.operatorCode = operatorCode;
}
public String getOperatorPass()
{
return operatorPass;
}
public void setOperatorPass(String operatorPass)
{
this.operatorPass = operatorPass;
}
public String getOperatorPassSalt()
{
return operatorPassSalt;
}
public void setOperatorPassSalt(String operatorPassSalt)
{
this.operatorPassSalt = operatorPassSalt;
}
public int getOperatorStatus()
{
return operatorStatus;
}
public void setOperatorStatus(int operatorStatus)
{
this.operatorStatus = operatorStatus;
}
public int getOperatorType()
{
return operatorType;
}
public void setOperatorType(int operatorType)
{
this.operatorType = operatorType;
}
public String getOperatorName()
{
return operatorName;
}
public void setOperatorName(String operatorName)
{
this.operatorName = operatorName;
}
public long getOperatorAvatar()
{
return operatorAvatar;
}
public void setOperatorAvatar(long operatorAvatar)
{
this.operatorAvatar = operatorAvatar;
}
public String getOperatorDept()
{
return operatorDept;
}
public void setOperatorDept(String operatorDept)
{
this.operatorDept = operatorDept;
}
public String getOperatorDeptAll()
{
return operatorDeptAll;
}
public void setOperatorDeptAll(String operatorDeptAll)
{
this.operatorDeptAll = operatorDeptAll;
}
public String getOperatorRole()
{
return operatorRole;
}
public void setOperatorRole(String operatorRole)
{
this.operatorRole = operatorRole;
}
public String getOperatorMobile()
{
return operatorMobile;
}
public void setOperatorMobile(String operatorMobile)
{
this.operatorMobile = operatorMobile;
}
public String getOperatorEmail()
{
return operatorEmail;
}
public void setOperatorEmail(String operatorEmail)
{
this.operatorEmail = operatorEmail;
}
public String getOperatorSkin()
{
return operatorSkin;
}
public void setOperatorSkin(String operatorSkin)
{
this.operatorSkin = operatorSkin;
}
public String getOperatorIp()
{
return operatorIp;
}
public void setOperatorIp(String operatorIp)
{
this.operatorIp = operatorIp;
}
public String getOperatorUrl()
{
return operatorUrl;
}
public void setOperatorUrl(String operatorUrl)
{
this.operatorUrl = operatorUrl;
}
public String getOperatorParam()
{
return operatorParam;
}
public void setOperatorParam(String operatorParam)
{
this.operatorParam = operatorParam;
}
public String getOperatorCreated()
{
return operatorCreated;
}
public void setOperatorCreated(String operatorCreated)
{
this.operatorCreated = operatorCreated;
}
public String getOperatorModified()
{
return operatorModified;
}
public void setOperatorModified(String operatorModified)
{
this.operatorModified = operatorModified;
}
}
@@ -0,0 +1,58 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.dboext;
import java.sql.Timestamp;
import org.zhiqim.orm.test.dbo.TInteger;
import org.zhiqim.kernel.annotation.AnAlias;
import org.zhiqim.kernel.json.Jsons;
import org.zhiqim.orm.annotation.*;
/**
* 整型和时间视图 对应视图《T_INTEGER_DATETIME》
*/
@AnAlias("TIntegerDatetime")
@AnView("T_INTEGER,T_DATETIME")
@AnViewJoin({@AnViewJoinValue(type="EQUAL", lTable="T_INTEGER", lColumn="T_ID", rTable="T_DATETIME", rColumn="T_ID")})
public class TIntegerDatetime extends TInteger
{
private static final long serialVersionUID = 1L;
@AnViewField(table="T_DATETIME", column="T_DATETIME") private Timestamp tDatetime; //2.测试日期
public String toString()
{
return Jsons.toString(this);
}
public Timestamp getTDatetime()
{
return tDatetime;
}
public void setTDatetime(Timestamp tDatetime)
{
this.tDatetime = tDatetime;
}
}
@@ -0,0 +1,90 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.dboext;
import java.io.Serializable;
import org.zhiqim.kernel.annotation.AnAlias;
import org.zhiqim.kernel.json.Jsons;
import org.zhiqim.orm.annotation.*;
/**
* 整型和小数视图 对应视图《T_INTEGER_DECIMAL》
*/
@AnAlias("TIntegerDecimal")
@AnView("T_INTEGER,T_DECIMAL")
@AnViewJoin({@AnViewJoinValue(type="EQUAL", lTable="T_INTEGER", lColumn="T_ID", rTable="T_DECIMAL", rColumn="T_ID")})
public class TIntegerDecimal implements Serializable
{
private static final long serialVersionUID = 1L;
@AnViewField(table="T_INTEGER", column="T_ID") private long tId; //1.测试编号
@AnViewField(table="T_INTEGER", column="T_BOOLEAN") private boolean tBoolean; //2.布尔型
@AnViewField(table="T_DECIMAL", column="T_DM5_2") private double tDm52; //3.测试5位长度,小数2位
@AnViewField(table="T_DECIMAL", column="T_DM10_3") private double tDm103; //4.测试10位长度,小数3位
public String toString()
{
return Jsons.toString(this);
}
public long getTId()
{
return tId;
}
public void setTId(long tId)
{
this.tId = tId;
}
public boolean isTBoolean()
{
return tBoolean;
}
public void setTBoolean(boolean tBoolean)
{
this.tBoolean = tBoolean;
}
public double getTDm52()
{
return tDm52;
}
public void setTDm52(double tDm52)
{
this.tDm52 = tDm52;
}
public double getTDm103()
{
return tDm103;
}
public void setTDm103(double tDm103)
{
this.tDm103 = tDm103;
}
}
@@ -0,0 +1,68 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.dboext;
import org.zhiqim.orm.test.dbo.TInteger;
import org.zhiqim.kernel.annotation.AnAlias;
import org.zhiqim.kernel.json.Jsons;
import org.zhiqim.orm.annotation.*;
/**
* 整型和字符串视图 对应视图《T_INTEGER_STRING》
*/
@AnAlias("TIntegerString")
@AnView("T_INTEGER,T_STRING")
@AnViewJoin({@AnViewJoinValue(type="EQUAL", lTable="T_INTEGER", lColumn="T_ID", rTable="T_STRING", rColumn="T_ID")})
public class TIntegerString extends TInteger
{
private static final long serialVersionUID = 1L;
@AnViewField(table="T_STRING", column="T_CHAR") private String tChar; //2.定长字符串
@AnViewField(table="T_STRING", column="T_VARCHAR") private String tVarchar; //3.变长字符串
public String toString()
{
return Jsons.toString(this);
}
public String getTChar()
{
return tChar;
}
public void setTChar(String tChar)
{
this.tChar = tChar;
}
public String getTVarchar()
{
return tVarchar;
}
public void setTVarchar(String tVarchar)
{
this.tVarchar = tVarchar;
}
}
@@ -0,0 +1,68 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.dboext;
import org.zhiqim.orm.test.dbo.TInteger;
import org.zhiqim.kernel.annotation.AnAlias;
import org.zhiqim.kernel.json.Jsons;
import org.zhiqim.orm.annotation.*;
/**
* 整型和字符串左联视图 对应视图《T_INTEGER_STRING_LEFT》
*/
@AnAlias("TIntegerStringLeft")
@AnView("T_INTEGER,T_STRING")
@AnViewJoin({@AnViewJoinValue(type="LEFT", lTable="T_INTEGER", lColumn="T_ID", rTable="T_STRING", rColumn="T_ID")})
public class TIntegerStringLeft extends TInteger
{
private static final long serialVersionUID = 1L;
@AnViewField(table="T_STRING", column="T_CHAR") private String tChar; //2.定长字符串
@AnViewField(table="T_STRING", column="T_VARCHAR") private String tVarchar; //3.变长字符串
public String toString()
{
return Jsons.toString(this);
}
public String getTChar()
{
return tChar;
}
public void setTChar(String tChar)
{
this.tChar = tChar;
}
public String getTVarchar()
{
return tVarchar;
}
public void setTVarchar(String tVarchar)
{
this.tVarchar = tVarchar;
}
}
@@ -0,0 +1,44 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.hsql;
import org.zhiqim.kernel.Global;
import org.zhiqim.orm.ZTable;
import org.zhiqim.orm.test.ORMBoot;
import org.zhiqim.orm.test.dbo.TDatetime;
import org.zhiqim.orm.test.dbo.TDecimal;
import org.zhiqim.orm.test.dbo.TInteger;
import org.zhiqim.orm.test.dbo.TString;
public class TableCreate
{
public static void main(String[] args) throws Exception
{
ORMBoot.initHSQLServer();
Global.get(ZTable.class).create(TInteger.class);
Global.get(ZTable.class).create(TString.class);
Global.get(ZTable.class).create(TDatetime.class);
Global.get(ZTable.class).create(TDecimal.class);
}
}
@@ -0,0 +1,62 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.hsql;
import org.zhiqim.kernel.Global;
import org.zhiqim.orm.ORMServer;
import org.zhiqim.orm.ZDDL;
import org.zhiqim.orm.ZTabler;
import org.zhiqim.orm.dbo.defined._Table;
import org.zhiqim.orm.test.ORMBoot;
public class TestAlterColumn
{
public static void main(String[] args) throws Exception
{
ORMBoot.initHSQLServer();
ORMServer server = Global.getService(ORMServer.class);
_Table _table = new _Table("T_ALERT_COLUMN", "USER_NAME");
_table.addField("USER_NAME", "string,32", true);
_table.addField("USER_PASS", "string,32", true);
_table.addIndex("USER_NAME", true);
Global.get(ZTabler.class).drop(_table);
Global.get(ZTabler.class).create(_table);
String intColumnType = server.getPolicy().toColumnType("int");
String longColumnType = server.getPolicy().toColumnType("long");
Global.get(ZDDL.class).alterColumnAdd("T_ALERT_COLUMN", "USER_STATUS", intColumnType, true);
System.out.println("添加字段USER_STATUS");
Global.get(ZDDL.class).alterColumnName("T_ALERT_COLUMN", "USER_STATUS", "USER_STATUS_2");
System.out.println("修改字段USER_STATUS");
Global.get(ZDDL.class).alterColumnType("T_ALERT_COLUMN", "USER_STATUS_2", longColumnType, true);
System.out.println("修改字段USER_STATUS");
Global.get(ZDDL.class).alterColumnDrop("T_ALERT_COLUMN", "USER_STATUS_2");
System.out.println("删除字段USER_STATUS");
}
}
@@ -0,0 +1,61 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.mssql;
import org.zhiqim.kernel.Global;
import org.zhiqim.orm.ORMServer;
import org.zhiqim.orm.ZDDL;
import org.zhiqim.orm.ZTabler;
import org.zhiqim.orm.dbo.defined._Table;
import org.zhiqim.orm.test.ORMBoot;
public class TestAlterColumn
{
public static void main(String[] args) throws Exception
{
ORMBoot.initMSSQLServer();
ORMServer server = Global.getService(ORMServer.class);
_Table _table = new _Table("T_ALERT_COLUMN", "USER_NAME");
_table.addField("USER_NAME", "string,32", true);
_table.addField("USER_PASS", "string,32", true);
_table.addIndex("USER_NAME", true);
Global.get(ZTabler.class).truncate(_table);
String intColumnType = server.getPolicy().toColumnType("int");
String longColumnType = server.getPolicy().toColumnType("long");
Global.get(ZDDL.class).alterColumnAdd("T_ALERT_COLUMN", "USER_STATUS", intColumnType, true);
System.out.println("添加字段USER_STATUS");
Global.get(ZDDL.class).alterColumnName("T_ALERT_COLUMN", "USER_STATUS", "USER_STATUS_2");
System.out.println("修改字段USER_STATUS");
Global.get(ZDDL.class).alterColumnType("T_ALERT_COLUMN", "USER_STATUS_2", longColumnType, true);
System.out.println("修改字段USER_STATUS");
Global.get(ZDDL.class).alterColumnDrop("T_ALERT_COLUMN", "USER_STATUS_2");
System.out.println("删除字段USER_STATUS");
}
}
@@ -0,0 +1,55 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.mssql;
import org.zhiqim.kernel.Global;
import org.zhiqim.orm.ZTable;
import org.zhiqim.orm.test.dbo.TInteger;
import org.zhiqim.kernel.util.Ids;
import org.zhiqim.orm.test.ORMBoot;
public class Test_Insert
{
public static void main(String[] args) throws Exception
{
ORMBoot.initMSSQLServer();
//1.数字
for (int i=0;i<10;i++)
{
TInteger data = new TInteger();
data.setTId(Ids.longId());
data.setTBoolean(i%2==0);
data.setTByte((byte)i);
data.setTShort((short)i);
data.setTInt(i);
data.setTLong(i);
Global.get(ZTable.class).insert(data);
System.out.println("插入数据["+i+"]条");
}
//2.文本
}
}
@@ -0,0 +1,73 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.mssql;
import org.zhiqim.kernel.Global;
import org.zhiqim.kernel.json.Jsons;
import org.zhiqim.orm.ZTable;
import org.zhiqim.orm.test.dbo.TInteger;
import org.zhiqim.kernel.paging.PageResult;
import org.zhiqim.kernel.util.Ids;
import org.zhiqim.orm.test.ORMBoot;
public class Test_Page
{
public static void main(String[] args) throws Exception
{
ORMBoot.initMSSQLServer();
Global.get(ZTable.class).truncate(TInteger.class);
for (int i=0;i<20;i++)
{
TInteger data = new TInteger();
data.setTId(Ids.longId());
data.setTBoolean(i%2==0);
data.setTByte((byte)i);
data.setTShort((short)i);
data.setTInt(i);
data.setTLong(i);
Global.get(ZTable.class).insert(data);
System.out.println("插入数据["+i+"]条");
}
System.out.println("第1页");
System.out.println(System.currentTimeMillis());
PageResult<TInteger> result = Global.get(ZTable.class).page(TInteger.class, 1, 2);
System.out.println(System.currentTimeMillis());
for (TInteger data : result.list())
{
System.out.println(Jsons.toString(data));
}
System.out.println("第8页");
System.out.println(System.currentTimeMillis());
result = Global.get(ZTable.class).page(TInteger.class, 8, 2);
System.out.println(System.currentTimeMillis());
for (TInteger data : result.list())
{
System.out.println(Jsons.toString(data));
}
}
}
@@ -0,0 +1,44 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.mssql;
import org.zhiqim.kernel.Global;
import org.zhiqim.orm.ZTable;
import org.zhiqim.orm.test.ORMBoot;
import org.zhiqim.orm.test.dbo.TDatetime;
import org.zhiqim.orm.test.dbo.TDecimal;
import org.zhiqim.orm.test.dbo.TInteger;
import org.zhiqim.orm.test.dbo.TString;
public class Test_TableCreate
{
public static void main(String[] args) throws Exception
{
ORMBoot.initMSSQLServer();
Global.get(ZTable.class).create(TInteger.class);
Global.get(ZTable.class).create(TString.class);
Global.get(ZTable.class).create(TDatetime.class);
Global.get(ZTable.class).create(TDecimal.class);
}
}
@@ -0,0 +1,55 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.mysql;
import java.sql.Connection;
import java.sql.ParameterMetaData;
import java.sql.PreparedStatement;
import org.zhiqim.kernel.Global;
import org.zhiqim.orm.ORMServer;
import org.zhiqim.orm.datasource.ZDBClose;
import org.zhiqim.orm.test.ORMBoot;
public class Statement
{
public static void main(String[] args) throws Exception
{
ORMBoot.initMySQLServer();
String sql = "select * from USER where USER_ID=? and USER_STATUS = ?";
Connection conn = Global.getService(ORMServer.class).getConnection();
PreparedStatement pstmt = conn.prepareStatement(sql);
ParameterMetaData meta = pstmt.getParameterMetaData();
int count = meta.getParameterCount();
System.out.println(count);
for (int i=0;i<count;i++)
{
System.out.println(meta.getParameterClassName(i));
}
ZDBClose.close(conn);
}
}
@@ -0,0 +1,44 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.mysql;
import org.zhiqim.kernel.Global;
import org.zhiqim.orm.ZTable;
import org.zhiqim.orm.test.ORMBoot;
import org.zhiqim.orm.test.dbo.TDatetime;
import org.zhiqim.orm.test.dbo.TDecimal;
import org.zhiqim.orm.test.dbo.TInteger;
import org.zhiqim.orm.test.dbo.TString;
public class TableCreate
{
public static void main(String[] args) throws Exception
{
ORMBoot.initMySQLServer();
Global.get(ZTable.class).create(TInteger.class);
Global.get(ZTable.class).create(TString.class);
Global.get(ZTable.class).create(TDatetime.class);
Global.get(ZTable.class).create(TDecimal.class);
}
}
@@ -0,0 +1,61 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.mysql;
import org.zhiqim.kernel.Global;
import org.zhiqim.orm.ORMServer;
import org.zhiqim.orm.ZDDL;
import org.zhiqim.orm.ZTabler;
import org.zhiqim.orm.dbo.defined._Table;
import org.zhiqim.orm.test.ORMBoot;
public class TestAlterColumn
{
public static void main(String[] args) throws Exception
{
ORMBoot.initMySQLServer();
ORMServer server = Global.getService(ORMServer.class);
_Table _table = new _Table("T_ALERT_COLUMN", "USER_NAME");
_table.addField("USER_NAME", "string,32", true);
_table.addField("USER_PASS", "string,32", true);
_table.addIndex("USER_NAME", true);
Global.get(ZTabler.class).truncate(_table);
String intColumnType = server.getPolicy().toColumnType("int");
String longColumnType = server.getPolicy().toColumnType("long");
Global.get(ZDDL.class).alterColumnAdd("T_ALERT_COLUMN", "USER_STATUS", intColumnType, true);
System.out.println("添加字段USER_STATUS");
Global.get(ZDDL.class).alterColumnName("T_ALERT_COLUMN", "USER_STATUS", "USER_STATUS_2");
System.out.println("修改字段名称USER_STATUS_2");
Global.get(ZDDL.class).alterColumnType("T_ALERT_COLUMN", "USER_STATUS_2", longColumnType, true);
System.out.println("修改字段USER_STATUS_2");
Global.get(ZDDL.class).alterColumnDrop("T_ALERT_COLUMN", "USER_STATUS_2");
System.out.println("删除字段USER_STATUS_2");
}
}
@@ -0,0 +1,69 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.mysql;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import org.zhiqim.kernel.Global;
import org.zhiqim.kernel.util.Files;
import org.zhiqim.kernel.util.Ids;
import org.zhiqim.orm.ORMServer;
import org.zhiqim.orm.datasource.ZDBClose;
import org.zhiqim.orm.test.ORMBoot;
public class TestBlob
{
public static void main(String[] args) throws Exception
{
ORMBoot.initMySQLServer();
long id = Ids.longId();
byte[] bytes = Files.read("./conf/zhiqim.xml");
ORMServer server = Global.get(ORMServer.class);
String sql = "insert into TEST_BLOB (T_ID, T_BLOB) values (?,?)";
Connection conn = server.getConnection();
PreparedStatement pstmt = conn.prepareStatement(sql);
pstmt.setLong(1, id);
pstmt.setBytes(2, bytes);
pstmt.executeUpdate();
pstmt.close();
conn.close();
sql = "select * from TEST_BLOB where T_ID = ?";
conn = server.getConnection();
pstmt = conn.prepareStatement(sql);
pstmt.setLong(1, id);
ResultSet rst = pstmt.executeQuery();
if (rst.next())
{
System.out.println(rst.getLong(1));
System.out.println(new String(rst.getBytes(2)));
}
ZDBClose.close(rst, pstmt, conn);
}
}
@@ -0,0 +1,78 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.mysql;
import java.sql.Connection;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Time;
import java.sql.Timestamp;
import org.zhiqim.kernel.Global;
import org.zhiqim.kernel.util.Ids;
import org.zhiqim.orm.ORMServer;
import org.zhiqim.orm.datasource.ZDBClose;
import org.zhiqim.orm.test.ORMBoot;
public class TestDate
{
public static void main(String[] args) throws Exception
{
ORMBoot.initMySQLServer();
long id = Ids.longId();
Date date = new Date(System.currentTimeMillis());
Time time = new Time(System.currentTimeMillis());
Timestamp timestamp = new Timestamp(System.currentTimeMillis());
ORMServer server = Global.get(ORMServer.class);
String sql = "insert into TEST_DATE (T_ID, T_DATE, T_TIME, T_DATETIME, T_TIMESTAMP) values (?,?,?,?,?)";
Connection conn = server.getConnection();
PreparedStatement pstmt = conn.prepareStatement(sql);
pstmt.setLong(1, id);
pstmt.setDate(2, date);
pstmt.setTime(3, time);
pstmt.setTimestamp(4, timestamp);
pstmt.setTimestamp(5, timestamp);
pstmt.executeUpdate();
ZDBClose.close(pstmt, conn);
sql = "select * from TEST_DATE where T_ID = ?";
conn = server.getConnection();
pstmt = conn.prepareStatement(sql);
pstmt.setLong(1, id);
ResultSet rst = pstmt.executeQuery();
if (rst.next())
{
System.out.println(rst.getLong(1));
System.out.println(rst.getDate(2));
System.out.println(rst.getTime(3));
System.out.println(rst.getTimestamp(4));
System.out.println(rst.getTimestamp(5));
}
ZDBClose.close(rst, pstmt, conn);
}
}
@@ -0,0 +1,45 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.mysql;
import java.util.List;
import org.zhiqim.kernel.Global;
import org.zhiqim.orm.ZTable;
import org.zhiqim.orm.dbo.Selector;
import org.zhiqim.orm.test.ORMBoot;
import org.zhiqim.orm.test.dbo.TDatetime;
public class TestExpression
{
public static void main(String[] args) throws Exception
{
ORMBoot.initMySQLServer();
Selector selector = new Selector();
selector.addExpressionThenL("tDatetime", "tDatetime2+1000");
List<TDatetime> list = Global.get(ZTable.class).list(TDatetime.class, selector);
System.out.println(list.size());
}
}
@@ -0,0 +1,46 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.mysql;
import org.zhiqim.kernel.Global;
import org.zhiqim.orm.ZTable;
import org.zhiqim.orm.test.dbo.Order;
import org.zhiqim.kernel.util.Ids;
import org.zhiqim.orm.test.ORMBoot;
public class TestOrder
{
public static void main(String[] args) throws Exception
{
ORMBoot.initMySQLServer();
Global.get(ZTable.class).truncate(Order.class);
long id = Ids.longId();
Order order = new Order();
order.setOrderId(id);
Global.get(ZTable.class).insert(order);
}
}
@@ -0,0 +1,58 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.mysql;
import java.sql.Connection;
import java.sql.PreparedStatement;
import org.zhiqim.kernel.Global;
import org.zhiqim.orm.ORMServer;
import org.zhiqim.orm.datasource.ZDBClose;
import org.zhiqim.orm.test.ORMBoot;
public class TestPrepareStatment
{
public static void main(String[] args) throws Exception
{
ORMBoot.initMySQLServer();
ORMServer server = Global.getService(ORMServer.class);
Connection conn = server.getConnection();
PreparedStatement pstmt = null;
try
{
pstmt = conn.prepareStatement("truncate table T_STRING");
}
catch (Exception e)
{
// TODO: handle exception
}
finally
{
ZDBClose.close(pstmt, conn);
}
}
}
@@ -0,0 +1,97 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.mysql;
import java.util.ArrayList;
import java.util.List;
import org.zhiqim.kernel.Global;
import org.zhiqim.orm.ZSQL;
import org.zhiqim.orm.dbo.CallParam;
import org.zhiqim.orm.dbo.CallResult;
import org.zhiqim.orm.test.ORMBoot;
import org.zhiqim.orm.test.dbo.ZmrDept;
import org.zhiqim.orm.test.dbo.ZmrOperator;
public class TestProcedure
{
public static void main(String[] args) throws Exception
{
ORMBoot.initMySQLServer();
testParam();
testParam2();
testParam2Rst2();
}
private static void testParam() throws Exception
{
String sql="{call sp_test_param1_int(?)}";
List<CallParam> paramList = new ArrayList<>();
paramList.add(CallParam.inout(100));
Global.get(ZSQL.class).call(sql, paramList);
int count = (int)paramList.get(0).value();
System.out.println(count);
}
private static void testParam2() throws Exception
{
String sql="{call sp_test_param2_int_varchar(?, ?)}";
List<CallParam> paramList = new ArrayList<>();
paramList.add(CallParam.inout(100));
paramList.add(CallParam.out(String.class));
Global.get(ZSQL.class).call(sql, paramList);
int count = (int)paramList.get(0).value();
String string = (String)paramList.get(1).value();
System.out.println(count + "," + string);
}
private static void testParam2Rst2() throws Exception
{
String sql="{call sp_test_param2_rst2(?, ?)}";
List<CallParam> paramList = new ArrayList<>();
paramList.add(CallParam.inout(100));
paramList.add(CallParam.out(String.class));
List<CallResult> resultList = new ArrayList<>();
resultList.add(CallResult.set(ZmrOperator.class));
resultList.add(CallResult.set(ZmrDept.class));
Global.get(ZSQL.class).call(sql, paramList, resultList);
int count = (int)paramList.get(0).value();
String string = (String)paramList.get(1).value();
System.out.println(count + "," + string);
for (CallResult result : resultList)
{
System.out.println(result.getResultList());
}
}
}
@@ -0,0 +1,53 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.mysql;
import org.zhiqim.kernel.Global;
import org.zhiqim.orm.ZTable;
import org.zhiqim.orm.test.dbo.TInteger;
import org.zhiqim.kernel.util.Ids;
import org.zhiqim.orm.test.ORMBoot;
public class TestTable
{
public static void main(String[] args) throws Exception
{
ORMBoot.initMySQLServer();
long id = Ids.longId();
TInteger obj = new TInteger();
obj.setTId(id);
obj.setTBoolean(true);
obj.setTByte(1);
obj.setTShort(2);
obj.setTInt(3);
obj.setTLong(4);
Global.get(ZTable.class).truncate(TInteger.class);
Global.get(ZTable.class).insert(obj);
TInteger item = Global.get(ZTable.class).item(TInteger.class, id);
System.out.println(item.getTByte());
}
}
@@ -0,0 +1,83 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.mysql;
import java.util.Map;
import org.zhiqim.kernel.Global;
import org.zhiqim.kernel.extend.LinkedMapSO;
import org.zhiqim.orm.ZTabler;
import org.zhiqim.orm.dbo.Selector;
import org.zhiqim.orm.dbo.defined._Table;
import org.zhiqim.orm.test.ORMBoot;
public class TestTableNew
{
public static void main(String[] args) throws Exception
{
ORMBoot.initMySQLServer();
_Table _table = new _Table("T_NEW_TABLE", "USER_NAME");
_table.addField("USER_NAME", "string,32", true);
_table.addField("USER_PASS", "string,32", true);
_table.addIndex("USER_NAME", true);
Global.get(ZTabler.class).truncate(_table);
LinkedMapSO map = new LinkedMapSO();
map.put("userName", "zhiqim");
map.put("userPass", "zhiqim");
Global.get(ZTabler.class).insert(_table, map);
Selector selector = new Selector();
selector.addMust("userName", "zhiqim");
LinkedMapSO item = Global.get(ZTabler.class).item(_table, "zhiqim");
for (Map.Entry<String, Object> entry : item.entrySet())
{
System.out.println(entry.getKey() + ":" + entry.getValue());
}
Object value = get(item, "userName", _table);
System.out.println(value);
}
/**
* 通过表定义对象获取字段名对应的值
*
* @param field 表字段
* @param _table 表定义对象
* @return 对应的值
*/
public static Object get(LinkedMapSO instance, String field, _Table _table)
{
Object value = instance.get(field);
if (value != null)
return value;
String column = _table.getColumn(field);
return instance.get(column);
}
}
@@ -0,0 +1,52 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.mysql;
import org.zhiqim.kernel.util.Ids;
import org.zhiqim.orm.ORM;
import org.zhiqim.orm.dbo.Selector;
import org.zhiqim.orm.test.ORMBoot;
import org.zhiqim.orm.test.qc.dbo.UserAccount;
public class TestUserAccount
{
static String id = null;
public static void main(String[] args) throws Exception
{
ORMBoot.initMySQLServer();
UserAccount account = new UserAccount();
account.setUserId(Ids.longId());
account.setUserNick("abc");
ORM.table().insert(account);
UserAccount acct = ORM.table().item(UserAccount.class, 1811301701380001L);
System.out.println(acct);
ORM.table().insert(account);
acct = ORM.table().item(UserAccount.class, new Selector("userId", 1811301702270001L).addReplace("ID", "123456"));
System.out.println(acct);
}
}
@@ -0,0 +1,43 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.mysql;
import java.util.List;
import org.zhiqim.kernel.Global;
import org.zhiqim.orm.ZView;
import org.zhiqim.orm.test.ORMBoot;
import org.zhiqim.orm.test.qc.ex.AnswerEx;
public class TestViewAlias
{
public static void main(String[] args) throws Exception
{
ORMBoot.initMySQLServer();
List<AnswerEx> aliasList = Global.get(ZView.class).list(AnswerEx.class);
for (AnswerEx alias : aliasList)
{
System.out.println(alias);
}
}
}
@@ -0,0 +1,88 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.mysql;
import org.zhiqim.kernel.Global;
import org.zhiqim.kernel.util.DateTimes;
import org.zhiqim.kernel.util.Ids;
import org.zhiqim.kernel.util.Sqls;
import org.zhiqim.orm.ZTable;
import org.zhiqim.orm.test.ORMBoot;
import org.zhiqim.orm.test.dbo.TDatetime;
public class Test_Datetime
{
public static void main(String[] args) throws Exception
{
ORMBoot.initMySQLServer();
Global.get(ZTable.class).truncate(TDatetime.class);
//1.
long id = Ids.longId();
TDatetime time1 = new TDatetime();
time1.setTId(id);
time1.setTDatetime(Sqls.toTimestamp(DateTimes.getDateTimeString()));
System.out.println(time1);
Global.get(ZTable.class).insert(time1);
TDatetime time11 = Global.get(ZTable.class).item(TDatetime.class, id);
System.out.println(time11);
//2.
long id2 = Ids.longId();
TDatetime time2 = new TDatetime();
time2.setTId(id2);
time2.setTDatetime(Sqls.toTimestamp(DateTimes.getDateTimeString()+".123"));
System.out.println(time2);
Global.get(ZTable.class).insert(time2);
TDatetime time22 = Global.get(ZTable.class).item(TDatetime.class, id2);
System.out.println(time22);
//3.
long id3 = Ids.longId();
TDatetime time3 = new TDatetime();
time3.setTId(id3);
time3.setTDatetime(Sqls.toTimestamp(DateTimes.getDateTimeString()+".123456"));
System.out.println(time3);
Global.get(ZTable.class).insert(time3);
TDatetime time33 = Global.get(ZTable.class).item(TDatetime.class, id3);
System.out.println(time33);
//4.
long id4 = Ids.longId();
TDatetime time4 = new TDatetime();
time4.setTId(id4);
time4.setTDatetime(Sqls.toTimestamp(DateTimes.getDateTimeString()+".123456789"));
System.out.println(time4);
Global.get(ZTable.class).insert(time4);
TDatetime time44 = Global.get(ZTable.class).item(TDatetime.class, id4);
System.out.println(time44);
}
}
@@ -0,0 +1,56 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.mysql;
import org.zhiqim.kernel.Global;
import org.zhiqim.kernel.util.Sqls;
import org.zhiqim.orm.ZSQL;
import org.zhiqim.orm.test.ORMBoot;
public class Test_InsertIntoOnDuplicateKeyUpdate
{
public static void main(String[] args) throws Exception
{
ORMBoot.initMySQLServer();
// Global.get(ZTable.class).truncate(TDatetime.class);
//1.
// long id = Ids.longId();
// TDatetime time1 = new TDatetime();
// time1.setTId(id);
// time1.setTDatetime(Sqls.toTimestamp("2011-11-11 11:11:11"));
// time1.setTDatetime2(Sqls.toTimestamp("2011-11-11 11:11:11"));
//
// System.out.println(time1);
// int ret = Global.get(ZTable.class).insert(time1);
//
// System.out.println(ret);
//2.插入更新
long id2=1609281739500001L;
String sql = "insert into T_DATETIME values(?,?,?) on duplicate key update T_DATETIME = ?";
Object[] objs = new Object[]{id2, Sqls.toTimestamp("2011-11-11 11:11:11"), Sqls.toTimestamp("2011-11-11 11:11:11"), Sqls.toTimestamp("2012-12-12 12:12:12")};
int ret2 = Global.get(ZSQL.class).executeUpdate(sql, objs);
System.out.println(ret2);
}
}
@@ -0,0 +1,65 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.mysql;
import org.zhiqim.kernel.Global;
import org.zhiqim.kernel.util.Ids;
import org.zhiqim.kernel.util.Sqls;
import org.zhiqim.orm.ZTable;
import org.zhiqim.orm.dbo.Updater;
import org.zhiqim.orm.test.ORMBoot;
import org.zhiqim.orm.test.dbo.TDatetime;
public class Test_InsertOrUpdate
{
public static void main(String[] args) throws Exception
{
ORMBoot.initMySQLServer();
Global.get(ZTable.class).truncate(TDatetime.class);
//1.
long id = Ids.longId();
TDatetime time1 = new TDatetime();
time1.setTId(id);
time1.setTDatetime(Sqls.toTimestamp("2011-11-11 11:11:11"));
time1.setTDatetime2(Sqls.toTimestamp("2011-11-11 11:11:11"));
System.out.println(time1);
int ret = Global.get(ZTable.class).insert(time1);
System.out.println(ret);
//2.插入更新
long id2=id;
TDatetime time2 = new TDatetime();
time2.setTId(id2);
time2.setTDatetime(Sqls.toTimestamp("2011-11-11 11:11:11"));
time2.setTDatetime2(Sqls.toTimestamp("2011-11-11 11:11:11"));
Updater updater = new Updater();
updater.addField("tDatetime", Sqls.toTimestamp("2012-12-12 12:12:12"));
int ret2 = Global.get(ZTable.class).insertOrUpdate(time2, updater);
System.out.println(ret2);
}
}
@@ -0,0 +1,65 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.mysql;
import org.zhiqim.kernel.Global;
import org.zhiqim.orm.ZSQL;
import org.zhiqim.orm.ZTable;
import org.zhiqim.orm.test.dbo.TAuto;
import org.zhiqim.kernel.transaction.Transaction;
import org.zhiqim.kernel.transaction.TransactionManager;
import org.zhiqim.orm.test.ORMBoot;
public class Test_InsertReturnIdentity
{
public static void main(String[] args) throws Exception
{
ORMBoot.initMySQLServer();
// String sql = "insert T_AUTO (t_id,t_varchar) values(0,'abc');select @@IDENTITY;";
// Global.get(FSQL.class).executeUpdate(sql);
Transaction tx = TransactionManager.beginTransaction();
try
{
TAuto auto = new TAuto();
auto.setTId(0);
auto.setTVarchar("abc");
Global.get(ZTable.class).insert(auto);
int id = Global.get(ZSQL.class).identityInt();
System.out.println(id);
tx.commit();
}
catch (Exception e)
{
tx.rollback();
}
finally
{
tx.close();
}
}
}
@@ -0,0 +1,71 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.mysql;
import org.zhiqim.kernel.Global;
import org.zhiqim.kernel.json.Jsons;
import org.zhiqim.orm.ZTable;
import org.zhiqim.orm.test.dbo.TInteger;
import org.zhiqim.kernel.paging.PageResult;
import org.zhiqim.kernel.util.Ids;
import org.zhiqim.orm.test.ORMBoot;
public class Test_Page
{
public static void main(String[] args) throws Exception
{
ORMBoot.initMySQLServer();
Global.get(ZTable.class).truncate(TInteger.class);
for (int i=0;i<10;i++)
{
TInteger data = new TInteger();
data.setTId(Ids.longId());
data.setTBoolean(i%2==0);
data.setTByte((byte)i);
data.setTShort((short)i);
data.setTInt(i);
data.setTLong(i);
Global.get(ZTable.class).insert(data);
System.out.println("插入数据["+i+"]条");
}
System.out.println("第1页");
PageResult<TInteger> result = Global.get(ZTable.class).page(TInteger.class, 1, 2);
for (TInteger data : result.list())
{
System.out.println(Jsons.toString(data));
}
System.out.println("第2页");
result = Global.get(ZTable.class).page(TInteger.class, 2, 2);
for (TInteger data : result.list())
{
System.out.println(Jsons.toString(data));
}
}
}
@@ -0,0 +1,100 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.mysql;
import java.sql.SQLException;
import org.zhiqim.kernel.Global;
import org.zhiqim.kernel.logging.Log;
import org.zhiqim.kernel.logging.LogFactory;
import org.zhiqim.kernel.schedule.Interval;
import org.zhiqim.kernel.schedule.Task;
import org.zhiqim.kernel.transaction.Transaction;
import org.zhiqim.kernel.transaction.TransactionManager;
import org.zhiqim.kernel.util.Ids;
import org.zhiqim.kernel.util.Sqls;
import org.zhiqim.orm.ORMException;
import org.zhiqim.orm.ZTable;
import org.zhiqim.orm.test.ORMBoot;
import org.zhiqim.orm.test.dbo.TDatetime;
public class Test_Transaction implements Task
{
private static final Log log = LogFactory.getLog(Test_Transaction.class);
public static void main(String[] args) throws Exception
{
ORMBoot.initMySQLServer();
Interval.shedule(new Test_Transaction(), 1000);
Transaction tx = TransactionManager.beginTransaction();
try
{
Thread.sleep(2000);
Global.get(ZTable.class).truncate(TDatetime.class);
log.info("已清除");
Thread.sleep(2000);
long id = Ids.longId();
TDatetime time1 = new TDatetime();
time1.setTId(id);
time1.setTDatetime(Sqls.toTimestamp("2011-11-11 11:11:11"));
time1.setTDatetime2(Sqls.toTimestamp("2011-11-11 11:11:11"));
Global.get(ZTable.class).insert(time1);
log.info("已插入");
Thread.sleep(5000);
tx.commit();
log.info("提交成功");
}
catch(Exception e)
{
tx.rollback();
}
finally
{
tx.close();
}
}
@Override
public void execute()
{
try
{
int count = Global.get(ZTable.class).count(TDatetime.class);
log.info("Timer["+count+"]");
}
catch (ORMException | SQLException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
@@ -0,0 +1,56 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.oracle;
import org.zhiqim.kernel.Global;
import org.zhiqim.orm.ZDDL;
import org.zhiqim.orm.ZTabler;
import org.zhiqim.orm.dbo.defined._Table;
import org.zhiqim.orm.test.ORMBoot;
public class TestAlterColumn
{
public static void main(String[] args) throws Exception
{
ORMBoot.initOracleServer();
_Table _table = new _Table("T_ALERT_COLUMN", "USER_NAME");
_table.addField("USER_NAME", "string,32", true);
_table.addField("USER_PASS", "string,32", true);
_table.addIndex("USER_NAME", false);
Global.get(ZTabler.class).truncate(_table);
Global.get(ZDDL.class).alterColumnAdd("T_ALERT_COLUMN", "USER_STATUS", "int", true);
System.out.println("添加字段USER_STATUS");
// Global.get(FSQL.class).alterColumnModify("T_ALERT_COLUMN", "USER_STATUS", "USER_STATUS", "bigint", true);
// System.out.println("修改字段USER_STATUS");
Global.get(ZDDL.class).alterColumnInfo("T_ALERT_COLUMN", "USER_STATUS", "USER_STATUS_2", "bigint", true);
System.out.println("修改字段名称USER_STATUS_2");
// Global.get(FSQL.class).alterColumnDrop("T_ALERT_COLUMN", "USER_STATUS_2");
// System.out.println("删除字段USER_STATUS");
}
}
@@ -0,0 +1,55 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.oracle;
import org.zhiqim.kernel.Global;
import org.zhiqim.orm.ZTable;
import org.zhiqim.orm.test.dbo.TInteger;
import org.zhiqim.kernel.util.Ids;
import org.zhiqim.orm.test.ORMBoot;
public class Test_Insert
{
public static void main(String[] args) throws Exception
{
ORMBoot.initOracleServer();
//1.数字
for (int i=0;i<10;i++)
{
TInteger data = new TInteger();
data.setTId(Ids.longId());
data.setTBoolean(i%2==0);
data.setTByte((byte)i);
data.setTShort((short)i);
data.setTInt(i);
data.setTLong(i);
Global.get(ZTable.class).insert(data);
System.out.println("插入数据["+i+"]条");
}
//2.文本
}
}
@@ -0,0 +1,73 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.oracle;
import org.zhiqim.kernel.Global;
import org.zhiqim.kernel.json.Jsons;
import org.zhiqim.orm.ZTable;
import org.zhiqim.orm.test.dbo.TInteger;
import org.zhiqim.kernel.paging.PageResult;
import org.zhiqim.kernel.util.Ids;
import org.zhiqim.orm.test.ORMBoot;
public class Test_Page
{
public static void main(String[] args) throws Exception
{
ORMBoot.initOracleServer();
Global.get(ZTable.class).truncate(TInteger.class);
for (int i=0;i<20;i++)
{
TInteger data = new TInteger();
data.setTId(Ids.longId());
data.setTBoolean(i%2==0);
data.setTByte((byte)i);
data.setTShort((short)i);
data.setTInt(i);
data.setTLong(i);
Global.get(ZTable.class).insert(data);
System.out.println("插入数据["+i+"]条");
}
System.out.println("第1页");
System.out.println(System.currentTimeMillis());
PageResult<TInteger> result = Global.get(ZTable.class).page(TInteger.class, 1, 2);
System.out.println(System.currentTimeMillis());
for (TInteger data : result.list())
{
System.out.println(Jsons.toString(data));
}
System.out.println("第8页");
System.out.println(System.currentTimeMillis());
result = Global.get(ZTable.class).page(TInteger.class, 8, 2);
System.out.println(System.currentTimeMillis());
for (TInteger data : result.list())
{
System.out.println(Jsons.toString(data));
}
}
}
@@ -0,0 +1,44 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.oracle;
import org.zhiqim.kernel.Global;
import org.zhiqim.orm.ZTable;
import org.zhiqim.orm.test.ORMBoot;
import org.zhiqim.orm.test.dbo.TDatetime;
import org.zhiqim.orm.test.dbo.TDecimal;
import org.zhiqim.orm.test.dbo.TInteger;
import org.zhiqim.orm.test.dbo.TString;
public class Test_TableCreate
{
public static void main(String[] args) throws Exception
{
ORMBoot.initOracleServer();
Global.get(ZTable.class).create(TInteger.class);
Global.get(ZTable.class).create(TString.class);
Global.get(ZTable.class).create(TDatetime.class);
Global.get(ZTable.class).create(TDecimal.class);
}
}
@@ -0,0 +1,61 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.postgresql;
import org.zhiqim.kernel.Global;
import org.zhiqim.orm.ORMServer;
import org.zhiqim.orm.ZDDL;
import org.zhiqim.orm.ZTabler;
import org.zhiqim.orm.dbo.defined._Table;
import org.zhiqim.orm.test.ORMBoot;
public class TestAlterColumn
{
public static void main(String[] args) throws Exception
{
ORMBoot.initPSQLServer();
ORMServer server = Global.getService(ORMServer.class);
_Table _table = new _Table("T_ALERT_COLUMN", "USER_NAME");
_table.addField("USER_NAME", "string,32", true);
_table.addField("USER_PASS", "string,32", true);
_table.addIndex("USER_NAME", true);
Global.get(ZTabler.class).truncate(_table);
String intColumnType = server.getPolicy().toColumnType("int");
String longColumnType = server.getPolicy().toColumnType("long");
Global.get(ZDDL.class).alterColumnAdd("T_ALERT_COLUMN", "USER_STATUS", intColumnType, true);
System.out.println("添加字段USER_STATUS");
Global.get(ZDDL.class).alterColumnName("T_ALERT_COLUMN", "USER_STATUS", "USER_STATUS_2");
System.out.println("修改字段名称USER_STATUS_2");
Global.get(ZDDL.class).alterColumnType("T_ALERT_COLUMN", "USER_STATUS_2", longColumnType, true);
System.out.println("修改字段USER_STATUS_2");
Global.get(ZDDL.class).alterColumnDrop("T_ALERT_COLUMN", "USER_STATUS_2");
System.out.println("删除字段USER_STATUS_2");
}
}
@@ -0,0 +1,55 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.postgresql;
import org.zhiqim.kernel.Global;
import org.zhiqim.orm.ZTable;
import org.zhiqim.orm.test.dbo.TInteger;
import org.zhiqim.kernel.util.Ids;
import org.zhiqim.orm.test.ORMBoot;
public class Test_Insert
{
public static void main(String[] args) throws Exception
{
ORMBoot.initPSQLServer();
//1.数字
for (int i=0;i<10;i++)
{
TInteger data = new TInteger();
data.setTId(Ids.longId());
data.setTBoolean(i%2==0);
data.setTByte((byte)i);
data.setTShort((short)i);
data.setTInt(i);
data.setTLong(i);
Global.get(ZTable.class).insert(data);
System.out.println("插入数据["+i+"]条");
}
//2.文本
}
}
@@ -0,0 +1,73 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.postgresql;
import org.zhiqim.kernel.Global;
import org.zhiqim.kernel.json.Jsons;
import org.zhiqim.orm.ZTable;
import org.zhiqim.orm.test.dbo.TInteger;
import org.zhiqim.kernel.paging.PageResult;
import org.zhiqim.kernel.util.Ids;
import org.zhiqim.orm.test.ORMBoot;
public class Test_Page
{
public static void main(String[] args) throws Exception
{
ORMBoot.initPSQLServer();
Global.get(ZTable.class).truncate(TInteger.class);
for (int i=0;i<20;i++)
{
TInteger data = new TInteger();
data.setTId(Ids.longId());
data.setTBoolean(i%2==0);
data.setTByte((byte)i);
data.setTShort((short)i);
data.setTInt(i);
data.setTLong(i);
Global.get(ZTable.class).insert(data);
System.out.println("插入数据["+i+"]条");
}
System.out.println("第1页");
System.out.println(System.currentTimeMillis());
PageResult<TInteger> result = Global.get(ZTable.class).page(TInteger.class, 1, 2);
System.out.println(System.currentTimeMillis());
for (TInteger data : result.list())
{
System.out.println(Jsons.toString(data));
}
System.out.println("第8页");
System.out.println(System.currentTimeMillis());
result = Global.get(ZTable.class).page(TInteger.class, 8, 2);
System.out.println(System.currentTimeMillis());
for (TInteger data : result.list())
{
System.out.println(Jsons.toString(data));
}
}
}
@@ -0,0 +1,44 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.postgresql;
import org.zhiqim.kernel.Global;
import org.zhiqim.orm.ZTable;
import org.zhiqim.orm.test.ORMBoot;
import org.zhiqim.orm.test.dbo.TDatetime;
import org.zhiqim.orm.test.dbo.TDecimal;
import org.zhiqim.orm.test.dbo.TInteger;
import org.zhiqim.orm.test.dbo.TString;
public class Test_TableCreate
{
public static void main(String[] args) throws Exception
{
ORMBoot.initPSQLServer();
Global.get(ZTable.class).create(TInteger.class);
Global.get(ZTable.class).create(TString.class);
Global.get(ZTable.class).create(TDatetime.class);
Global.get(ZTable.class).create(TDecimal.class);
}
}
@@ -0,0 +1,78 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.qc;
import java.util.List;
import org.zhiqim.kernel.extend.HashMapSS;
import org.zhiqim.kernel.util.DateTimes;
import org.zhiqim.kernel.util.Ids;
import org.zhiqim.orm.ORM;
import org.zhiqim.orm.ZTable;
import org.zhiqim.orm.dbo.Selector;
import org.zhiqim.orm.test.ORMBoot;
import org.zhiqim.orm.test.qc.dbo.QcQuestion;
public class TestReplace
{
public static void main(String[] args) throws Exception
{
ORMBoot.initMySQLServer();
ORM.get(ZTable.class).create(QcQuestion.class, new HashMapSS("id", "18"));
ORM.get(ZTable.class).create(QcQuestion.class);
QcQuestion q = new QcQuestion();
q.setIdInt(18);
q.setQuestionCreateTime(DateTimes.getDateTimeString());
q.setQuestionDesc("ddd");
q.setQuestionId(Ids.longId());
q.setQuestionReadNum(0);
q.setQuestionTitle("标题");
ORM.table().insert(q);
q = new QcQuestion();
q.setQuestionCreateTime(DateTimes.getDateTimeString());
q.setQuestionDesc("ddd");
q.setQuestionId(Ids.longId());
q.setQuestionReadNum(0);
q.setQuestionTitle("标题");
ORM.table().insert(q);
List<QcQuestion> list = ORM.table().list(QcQuestion.class);
System.out.println(list.size());
q = list.get(0);
q.setQuestionStatus(3);
ORM.table().update(q);
list = ORM.table().list(QcQuestion.class, new Selector().addReplace("id", "18"));
System.out.println(list.size());
q = list.get(0);
q.setQuestionStatus(3);
ORM.table().update(q);
}
}
@@ -0,0 +1,124 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.qc.dbo;
import java.io.Serializable;
import org.zhiqim.kernel.annotation.AnAlias;
import org.zhiqim.kernel.annotation.AnNew;
import org.zhiqim.kernel.json.Jsons;
import org.zhiqim.orm.annotation.*;
/**
* 回复表 对应表《QC_ANSWER》
*/
@AnAlias("QcAnswer")
@AnNew
@AnTable(table="QC_ANSWER", key="COMMENT_ID,ANSWER_ID", type="InnoDB")
public class QcAnswer implements Serializable
{
private static final long serialVersionUID = 1L;
@AnTableField(column="QUESTION_ID", type="long", notNull=true) private long questionId; //1.问题编号
@AnTableField(column="COMMENT_ID", type="long", notNull=true) private long commentId; //2.评论编号
@AnTableField(column="ANSWER_ID", type="long", notNull=true) private long answerId; //3.回复编号
@AnTableField(column="COMMENT_USER_ID", type="long", notNull=true) private long commentUserId; //4.评论作者编号
@AnTableField(column="ANSWER_CONTENT", type="string,2000", notNull=true) private String answerContent; //5.回复内容
@AnTableField(column="ANSWER_USER_ID", type="long", notNull=true) private long answerUserId; //6.回复作者编号
@AnTableField(column="ANSWER_TIME", type="string,19,char", notNull=true) private String answerTime; //7.回复时间
public String toString()
{
return Jsons.toString(this);
}
public long getQuestionId()
{
return questionId;
}
public void setQuestionId(long questionId)
{
this.questionId = questionId;
}
public long getCommentId()
{
return commentId;
}
public void setCommentId(long commentId)
{
this.commentId = commentId;
}
public long getAnswerId()
{
return answerId;
}
public void setAnswerId(long answerId)
{
this.answerId = answerId;
}
public long getCommentUserId()
{
return commentUserId;
}
public void setCommentUserId(long commentUserId)
{
this.commentUserId = commentUserId;
}
public String getAnswerContent()
{
return answerContent;
}
public void setAnswerContent(String answerContent)
{
this.answerContent = answerContent;
}
public long getAnswerUserId()
{
return answerUserId;
}
public void setAnswerUserId(long answerUserId)
{
this.answerUserId = answerUserId;
}
public String getAnswerTime()
{
return answerTime;
}
public void setAnswerTime(String answerTime)
{
this.answerTime = answerTime;
}
}
@@ -0,0 +1,113 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.qc.dbo;
import java.io.Serializable;
import org.zhiqim.kernel.annotation.AnAlias;
import org.zhiqim.kernel.annotation.AnNew;
import org.zhiqim.kernel.json.Jsons;
import org.zhiqim.orm.annotation.*;
/**
* 问答评论表 对应表《QC_COMMENT》
*/
@AnAlias("QcComment")
@AnNew
@AnTable(table="QC_COMMENT", key="QUESTION_ID,COMMENT_ID", type="InnoDB")
public class QcComment implements Serializable
{
private static final long serialVersionUID = 1L;
@AnTableField(column="QUESTION_ID", type="long", notNull=true) private long questionId; //1.问题编号
@AnTableField(column="COMMENT_ID", type="long", notNull=true) private long commentId; //2.评论编号
@AnTableField(column="COMMENT_CONTENT", type="string,4000", notNull=true) private String commentContent; //3.评论内容
@AnTableField(column="COMMENT_USER_ID", type="long", notNull=true) private long commentUserId; //4.评论作者编号
@AnTableField(column="COMMENT_GOOD_NUM", type="int", notNull=true) private int commentGoodNum; //5.点赞数
@AnTableField(column="COMMENT_CREATE_TIME", type="string,19,char", notNull=true) private String commentCreateTime; //6.评论发表时间
public String toString()
{
return Jsons.toString(this);
}
public long getQuestionId()
{
return questionId;
}
public void setQuestionId(long questionId)
{
this.questionId = questionId;
}
public long getCommentId()
{
return commentId;
}
public void setCommentId(long commentId)
{
this.commentId = commentId;
}
public String getCommentContent()
{
return commentContent;
}
public void setCommentContent(String commentContent)
{
this.commentContent = commentContent;
}
public long getCommentUserId()
{
return commentUserId;
}
public void setCommentUserId(long commentUserId)
{
this.commentUserId = commentUserId;
}
public int getCommentGoodNum()
{
return commentGoodNum;
}
public void setCommentGoodNum(int commentGoodNum)
{
this.commentGoodNum = commentGoodNum;
}
public String getCommentCreateTime()
{
return commentCreateTime;
}
public void setCommentCreateTime(String commentCreateTime)
{
this.commentCreateTime = commentCreateTime;
}
}
@@ -0,0 +1,69 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.qc.dbo;
import java.io.Serializable;
import org.zhiqim.kernel.annotation.AnAlias;
import org.zhiqim.kernel.annotation.AnNew;
import org.zhiqim.kernel.json.Jsons;
import org.zhiqim.orm.annotation.*;
/**
* 点赞表 对应表《QC_GOOD》
*/
@AnAlias("QcGood")
@AnNew
@AnTable(table="QC_GOOD", key="COMMENT_ID,GOOD_USER_ID", type="InnoDB")
public class QcGood implements Serializable
{
private static final long serialVersionUID = 1L;
@AnTableField(column="COMMENT_ID", type="long", notNull=true) private long commentId; //1.评论编号
@AnTableField(column="GOOD_USER_ID", type="long", notNull=true) private long goodUserId; //2.点赞人编号
public String toString()
{
return Jsons.toString(this);
}
public long getCommentId()
{
return commentId;
}
public void setCommentId(long commentId)
{
this.commentId = commentId;
}
public long getGoodUserId()
{
return goodUserId;
}
public void setGoodUserId(long goodUserId)
{
this.goodUserId = goodUserId;
}
}
@@ -0,0 +1,177 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.qc.dbo;
import java.io.Serializable;
import org.zhiqim.kernel.annotation.AnAlias;
import org.zhiqim.kernel.annotation.AnNew;
import org.zhiqim.kernel.json.Jsons;
import org.zhiqim.orm.annotation.*;
/**
* 问答问题表 对应表《QC_QUESTION$ID$》
*/
@AnAlias("QcQuestion")
@AnNew
@AnTable(table="QC_QUESTION$ID$", key="QUESTION_ID", type="InnoDB")
public class QcQuestion implements Serializable
{
private static final long serialVersionUID = 1L;
@AnTableReplace("ID") private String id;
@AnTableField(column="QUESTION_ID", type="long", notNull=true) private long questionId; //1.问题编号
@AnTableField(column="QUESTION_TYPE", type="int", notNull=true) private int questionType; //2.问题类型: 0技术疑问 1职业疑惑 2生活杂谈 3资讯动态 4其他
@AnTableField(column="QUESTION_STATUS", type="int", notNull=true) private int questionStatus; //3.问题状态:0表示正常,1表示停用
@AnTableField(column="QUESTION_TITLE", type="string,100", notNull=true) private String questionTitle; //4.问题标题
@AnTableField(column="QUESTION_DESC", type="string,4000", notNull=true) private String questionDesc; //5.问题描述
@AnTableField(column="QUESTION_USER_ID", type="long", notNull=true) private long questionUserId; //6.问题作者编号
@AnTableField(column="QUESTION_CREATE_TIME", type="string,19,char", notNull=true) private String questionCreateTime; //7.问题发表时间
@AnTableField(column="QUESTION_REPLY_NUM", type="int", notNull=true) private int questionReplyNum; //8.问题评论数
@AnTableField(column="QUESTION_READ_NUM", type="int", notNull=true) private int questionReadNum; //9.问题阅读数
public String toString()
{
return Jsons.toString(this);
}
public long getQuestionId()
{
return questionId;
}
public void setQuestionId(long questionId)
{
this.questionId = questionId;
}
public int getQuestionType()
{
return questionType;
}
public void setQuestionType(int questionType)
{
this.questionType = questionType;
}
public int getQuestionStatus()
{
return questionStatus;
}
public void setQuestionStatus(int questionStatus)
{
this.questionStatus = questionStatus;
}
public String getQuestionTitle()
{
return questionTitle;
}
public void setQuestionTitle(String questionTitle)
{
this.questionTitle = questionTitle;
}
public String getQuestionDesc()
{
return questionDesc;
}
public void setQuestionDesc(String questionDesc)
{
this.questionDesc = questionDesc;
}
public long getQuestionUserId()
{
return questionUserId;
}
public void setQuestionUserId(long questionUserId)
{
this.questionUserId = questionUserId;
}
public String getQuestionCreateTime()
{
return questionCreateTime;
}
public void setQuestionCreateTime(String questionCreateTime)
{
this.questionCreateTime = questionCreateTime;
}
public int getQuestionReplyNum()
{
return questionReplyNum;
}
public void setQuestionReplyNum(int questionReplyNum)
{
this.questionReplyNum = questionReplyNum;
}
public int getQuestionReadNum()
{
return questionReadNum;
}
public void setQuestionReadNum(int questionReadNum)
{
this.questionReadNum = questionReadNum;
}
public String getId()
{
return id;
}
public int getIdInt()
{
return Integer.parseInt(id);
}
public long getIdLong()
{
return Long.parseLong(id);
}
public void setId(String id)
{
this.id = id;
}
public void setIdInt(int id)
{
this.id = String.valueOf(id);
}
public void setIdLong(long id)
{
this.id = String.valueOf(id);
}
}
@@ -0,0 +1,80 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.qc.dbo;
import java.io.Serializable;
import org.zhiqim.kernel.annotation.AnAlias;
import org.zhiqim.kernel.annotation.AnNew;
import org.zhiqim.kernel.json.Jsons;
import org.zhiqim.orm.annotation.*;
/**
* 用户表 对应表《USER_ACCOUNT》
*/
@AnAlias("UserAccount")
@AnNew
@AnTable(table="USER_ACCOUNT", key="USER_ID", type="InnoDB")
public class UserAccount implements Serializable
{
private static final long serialVersionUID = 1L;
@AnTableField(column="USER_ID", type="long", notNull=true) private long userId; //1.用户编号
@AnTableField(column="USER_NICK", type="string,32", notNull=false) private String userNick; //2.用户昵称
@AnTableField(column="USER_AVATAR_50", type="string,200", notNull=false) private String userAvatar50; //3.用户头像
public String toString()
{
return Jsons.toString(this);
}
public long getUserId()
{
return userId;
}
public void setUserId(long userId)
{
this.userId = userId;
}
public String getUserNick()
{
return userNick;
}
public void setUserNick(String userNick)
{
this.userNick = userNick;
}
public String getUserAvatar50()
{
return userAvatar50;
}
public void setUserAvatar50(String userAvatar50)
{
this.userAvatar50 = userAvatar50;
}
}
@@ -0,0 +1,93 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.qc.ex;
import org.zhiqim.orm.test.qc.dbo.QcAnswer;
import org.zhiqim.kernel.annotation.AnAlias;
import org.zhiqim.kernel.annotation.AnNew;
import org.zhiqim.kernel.json.Jsons;
import org.zhiqim.orm.annotation.*;
/**
* 回复扩展表 对应视图《ANSWER_EX》
*/
@AnAlias("AnswerEx")
@AnNew
@AnView("QC_ANSWER,USER_ACCOUNT a,USER_ACCOUNT b")
@AnViewJoin({@AnViewJoinValue(type="EQUAL", lTable="QC_ANSWER", lColumn="ANSWER_USER_ID", rTable="a", rColumn="USER_ID"),
@AnViewJoinValue(type="LEFT", lTable="QC_ANSWER", lColumn="COMMENT_USER_ID", rTable="b", rColumn="USER_ID")})
public class AnswerEx extends QcAnswer
{
private static final long serialVersionUID = 1L;
@AnViewField(table="a", column="USER_NICK") private String answerUserNick; //1.
@AnViewField(table="a", column="USER_AVATAR_50") private String answerUserAvatar50; //2.
@AnViewField(table="b", column="USER_NICK") private String commentUserNick; //3.
@AnViewField(table="b", column="USER_AVATAR_50") private String commentUserAvatar50; //4.
public String toString()
{
return Jsons.toString(this);
}
public String getAnswerUserNick()
{
return answerUserNick;
}
public void setAnswerUserNick(String answerUserNick)
{
this.answerUserNick = answerUserNick;
}
public String getAnswerUserAvatar50()
{
return answerUserAvatar50;
}
public void setAnswerUserAvatar50(String answerUserAvatar50)
{
this.answerUserAvatar50 = answerUserAvatar50;
}
public String getCommentUserNick()
{
return commentUserNick;
}
public void setCommentUserNick(String commentUserNick)
{
this.commentUserNick = commentUserNick;
}
public String getCommentUserAvatar50()
{
return commentUserAvatar50;
}
public void setCommentUserAvatar50(String commentUserAvatar50)
{
this.commentUserAvatar50 = commentUserAvatar50;
}
}
@@ -0,0 +1,70 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.qc.ex;
import org.zhiqim.orm.test.qc.dbo.QcComment;
import org.zhiqim.kernel.annotation.AnAlias;
import org.zhiqim.kernel.annotation.AnNew;
import org.zhiqim.kernel.json.Jsons;
import org.zhiqim.orm.annotation.*;
/**
* 评论扩展表 对应视图《COMMENT_EX》
*/
@AnAlias("CommentEx")
@AnNew
@AnView("QC_COMMENT,USER_ACCOUNT")
@AnViewJoin({@AnViewJoinValue(type="EQUAL", lTable="QC_COMMENT", lColumn="COMMENT_USER_ID", rTable="USER_ACCOUNT", rColumn="USER_ID")})
public class CommentEx extends QcComment
{
private static final long serialVersionUID = 1L;
@AnViewField(table="USER_ACCOUNT", column="USER_NICK") private String userNick; //1.用户昵称
@AnViewField(table="USER_ACCOUNT", column="USER_AVATAR_50") private String userAvatar50; //2.用户头像
public String toString()
{
return Jsons.toString(this);
}
public String getUserNick()
{
return userNick;
}
public void setUserNick(String userNick)
{
this.userNick = userNick;
}
public String getUserAvatar50()
{
return userAvatar50;
}
public void setUserAvatar50(String userAvatar50)
{
this.userAvatar50 = userAvatar50;
}
}
@@ -0,0 +1,70 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.qc.ex;
import org.zhiqim.orm.test.qc.dbo.QcQuestion;
import org.zhiqim.kernel.annotation.AnAlias;
import org.zhiqim.kernel.annotation.AnNew;
import org.zhiqim.kernel.json.Jsons;
import org.zhiqim.orm.annotation.*;
/**
* 问题扩展表 对应视图《QUESTION_EX》
*/
@AnAlias("QuestionEx")
@AnNew
@AnView("QC_QUESTION$ID$,USER_ACCOUNT")
@AnViewJoin({@AnViewJoinValue(type="EQUAL", lTable="QC_QUESTION$ID$", lColumn="QUESTION_USER_ID", rTable="USER_ACCOUNT", rColumn="USER_ID")})
public class QuestionEx extends QcQuestion
{
private static final long serialVersionUID = 1L;
@AnViewField(table="USER_ACCOUNT", column="USER_NICK") private String userNick; //1.用户昵称
@AnViewField(table="USER_ACCOUNT", column="USER_AVATAR_50") private String userAvatar50; //2.用户头像
public String toString()
{
return Jsons.toString(this);
}
public String getUserNick()
{
return userNick;
}
public void setUserNick(String userNick)
{
this.userNick = userNick;
}
public String getUserAvatar50()
{
return userAvatar50;
}
public void setUserAvatar50(String userAvatar50)
{
this.userAvatar50 = userAvatar50;
}
}
@@ -0,0 +1,36 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.sqlite;
public class FExecuteQueryTest
{
public static void main(String[] args)
{
// String id = "query_user_info";
// String param = "array";
// String result = "org.zhiqim.orm.test.dbo.user.UserInfo";
// String sql = "select * USER_INFO where USER_Name like '%?%' and USER_NICK like '%?%'";
//
}
}
@@ -0,0 +1,34 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.sqlite;
public class FExecuteUpdateTest
{
public static void main(String[] args)
{
// String id = "update_user_info";
// String param = "array";
// String sql = "update USER_INFO set USER_NAME=? where USER_ID=?";
//
}
}
@@ -0,0 +1,52 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.sqlite;
import java.sql.Connection;
import java.sql.ParameterMetaData;
import java.sql.PreparedStatement;
import org.zhiqim.kernel.Global;
import org.zhiqim.orm.ORMServer;
import org.zhiqim.orm.test.ORMBoot;
public class Statement
{
public static void main(String[] args) throws Exception
{
ORMBoot.initSQLiteServer();
String sql = "select * from ADMIN where ADMIN_NAME=? and status = ? and aaaa=? and bbbb=? and cccc=? and dddd=?";
Connection conn = Global.getService(ORMServer.class).getConnection();
PreparedStatement pstmt = conn.prepareStatement(sql);
ParameterMetaData meta = pstmt.getParameterMetaData();
int count = meta.getParameterCount();
System.out.println(count);
for (int i=0;i<count;i++)
{
System.out.println(meta.getParameterClassName(i));
}
}
}
@@ -0,0 +1,40 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.sqlite;
import org.zhiqim.kernel.Global;
import org.zhiqim.orm.ZTable;
import org.zhiqim.orm.test.ORMBoot;
import org.zhiqim.orm.test.dbo.Admin;
import org.zhiqim.orm.test.dbo.Message;
public class TableCreate
{
public static void main(String[] args) throws Exception
{
ORMBoot.initSQLiteServer();
Global.get(ZTable.class).create(Message.class);
Global.get(ZTable.class).create(Admin.class);
}
}
@@ -0,0 +1,61 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.sqlite;
import org.zhiqim.kernel.Global;
import org.zhiqim.orm.ORMServer;
import org.zhiqim.orm.ZDDL;
import org.zhiqim.orm.ZTabler;
import org.zhiqim.orm.dbo.defined._Table;
import org.zhiqim.orm.test.ORMBoot;
public class TestAlterColumn
{
public static void main(String[] args) throws Exception
{
ORMBoot.initSQLiteServer();
ORMServer server = Global.getService(ORMServer.class);
_Table _table = new _Table("T_ALERT_COLUMN", "USER_NAME");
_table.addField("USER_NAME", "string,32", true);
_table.addField("USER_PASS", "string,32", true);
_table.addIndex("USER_NAME", true);
Global.get(ZTabler.class).truncate(_table);
String intColumnType = server.getPolicy().toColumnType("string,10");
String longColumnType = server.getPolicy().toColumnType("string,20");
Global.get(ZDDL.class).alterColumnAdd("T_ALERT_COLUMN", "USER_STATUS", intColumnType, true);
System.out.println("添加字段USER_STATUS");
Global.get(ZDDL.class).alterColumnType("T_ALERT_COLUMN", "USER_STATUS", longColumnType, true);
System.out.println("修改字段USER_STATUS");
Global.get(ZDDL.class).alterColumnName("T_ALERT_COLUMN", "USER_STATUS", "USER_STATUS2");
System.out.println("修改字段名称USER_STATUS");
Global.get(ZDDL.class).alterColumnDrop("T_ALERT_COLUMN", "USER_STATUS2");
System.out.println("删除字段USER_STATUS");
}
}
@@ -0,0 +1,55 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.sqlite;
import org.zhiqim.kernel.Global;
import org.zhiqim.kernel.extend.LinkedMapSO;
import org.zhiqim.orm.ORMServer;
import org.zhiqim.orm.ZDDL;
import org.zhiqim.orm.ZTabler;
import org.zhiqim.orm.dbo.defined._Table;
import org.zhiqim.orm.test.ORMBoot;
public class TestAlterColumnRename
{
public static void main(String[] args) throws Exception
{
ORMBoot.initSQLiteServer();
Global.getService(ORMServer.class);
_Table _table = new _Table("T_ALERT_COLUMN", "USER_NAME");
_table.addField("USER_NAME", "string,32", true);
_table.addField("USER_PASS", "string,32", true);
_table.addIndex("USER_NAME", true);
Global.get(ZTabler.class).truncate(_table);
Global.get(ZTabler.class).insert(_table, new LinkedMapSO("USER_NAME", "111").put("USER_PASS", "111"));
Global.get(ZTabler.class).insert(_table, new LinkedMapSO("USER_NAME", "222").put("USER_PASS", "222"));
Global.get(ZDDL.class).alterColumnName("T_ALERT_COLUMN", "USER_NAME", "USER_NAME2");
System.out.println("修改字段名称USER_STATUS");
// Global.get(FSQLer.class).alterColumnDrop("T_ALERT_COLUMN", "USER_STATUS");
// System.out.println("删除字段USER_STATUS");
}
}
@@ -0,0 +1,70 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.sqlite;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import org.zhiqim.kernel.Global;
import org.zhiqim.kernel.util.Files;
import org.zhiqim.kernel.util.Ids;
import org.zhiqim.orm.ORMServer;
import org.zhiqim.orm.datasource.ZDBClose;
import org.zhiqim.orm.test.ORMBoot;
public class TestBlob
{
public static void main(String[] args) throws Exception
{
byte[] bytes = Files.read("./conf/zhiqim.xml");
long id = Ids.longId();
ORMBoot.initSQLiteServer();
ORMServer server = Global.getService(ORMServer.class);
String sql = "insert into TEST_BLOB (T_ID, T_BLOB) values (?,?)";
Connection conn = server.getConnection();
PreparedStatement pstmt = conn.prepareStatement(sql);
pstmt.setLong(1, id);
pstmt.setBytes(2, bytes);
pstmt.executeUpdate();
pstmt.close();
conn.close();
sql = "select * from TEST_BLOB where T_ID = ?";
conn = server.getConnection();
pstmt = conn.prepareStatement(sql);
pstmt.setLong(1, id);
ResultSet rst = pstmt.executeQuery();
if (rst.next())
{
System.out.println(rst.getLong(1));
System.out.println(new String(rst.getBytes(2)));
}
ZDBClose.close(rst, pstmt, conn);
}
}
@@ -0,0 +1,44 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.sqlite;
import org.zhiqim.kernel.Global;
import org.zhiqim.orm.ZTable;
import org.zhiqim.orm.test.dbo.Admin;
import org.zhiqim.kernel.util.DateTimes;
import org.zhiqim.orm.test.ORMBoot;
public class TestDaoString
{
public static void main(String[] args) throws Exception
{
ORMBoot.initSQLiteServer();
Admin admin = new Admin();
admin.setAdminName("123456");
admin.setAdminPass("123456");
admin.setAdminTime(DateTimes.getDateTimeString());
Global.get(ZTable.class).insert(admin);
}
}
@@ -0,0 +1,73 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.sqlite;
import java.sql.Connection;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Timestamp;
import org.zhiqim.kernel.Global;
import org.zhiqim.kernel.util.Ids;
import org.zhiqim.orm.ORMServer;
import org.zhiqim.orm.datasource.ZDBClose;
import org.zhiqim.orm.test.ORMBoot;
public class TestDate
{
public static void main(String[] args) throws Exception
{
ORMBoot.initSQLiteServer();
ORMServer server = Global.getService(ORMServer.class);
long id = Ids.longId();
Date date = new Date(System.currentTimeMillis());
Timestamp timestamp = new Timestamp(System.currentTimeMillis());
String sql = "insert into TEST_DATE (T_ID, T_DATE, T_DATETIME) values (?,?,?)";
Connection conn = server.getConnection();
PreparedStatement pstmt = conn.prepareStatement(sql);
pstmt.setLong(1, id);
pstmt.setDate(2, date);
pstmt.setTimestamp(3, timestamp);
pstmt.executeUpdate();
ZDBClose.close(pstmt, conn);
sql = "select * from TEST_DATE where T_ID = ?";
conn = server.getConnection();
pstmt = conn.prepareStatement(sql);
pstmt.setLong(1, id);
ResultSet rst = pstmt.executeQuery();
if (rst.next())
{
System.out.println(rst.getLong(1));
System.out.println(rst.getTimestamp(2));
System.out.println(rst.getTimestamp(3));
}
ZDBClose.close(rst, pstmt, conn);
}
}
@@ -0,0 +1,53 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.sqlite;
import org.zhiqim.kernel.Global;
import org.zhiqim.orm.ZTable;
import org.zhiqim.orm.test.dbo.TInteger;
import org.zhiqim.kernel.util.Ids;
import org.zhiqim.orm.test.ORMBoot;
public class TestInteger
{
public static void main(String[] args) throws Exception
{
ORMBoot.initSQLiteServer();
long id = Ids.longId();
TInteger obj = new TInteger();
obj.setTId(id);
obj.setTBoolean(true);
obj.setTByte(1);
obj.setTShort(2);
obj.setTInt(3);
obj.setTLong(4);
Global.get(ZTable.class).truncate(TInteger.class);
Global.get(ZTable.class).insert(obj);
TInteger item = Global.get(ZTable.class).item(TInteger.class, id);
System.out.println(item.getTByte());
}
}
@@ -0,0 +1,44 @@
/*
* 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
*
* 知启蒙数据库映射(zhiqim_orm)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_orm.htm
*
* This file is part of [zhiqim_orm].
*
* [zhiqim_orm] is free software: you can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* [zhiqim_orm] is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with [zhiqim_orm].
* If not, see <http://www.gnu.org/licenses/>.
*/
package org.zhiqim.orm.test.sqlite;
import java.util.List;
import org.zhiqim.kernel.Global;
import org.zhiqim.orm.ZView;
import org.zhiqim.orm.test.ORMBoot;
import org.zhiqim.orm.test.dboext.TIntegerStringLeft;
public class TestLeft
{
public static void main(String[] args) throws Exception
{
ORMBoot.initSQLiteServer();
List<TIntegerStringLeft> leftList = Global.get(ZView.class).list(TIntegerStringLeft.class);
for (TIntegerStringLeft left : leftList)
{
System.out.println(left.getTId());
}
}
}