.
This commit is contained in:
@@ -61,6 +61,7 @@ public class BaseServlet extends HttpServlet {
|
||||
response.finish(JBean.by(-2, "未登陆"));
|
||||
} else {
|
||||
//response.setStatus(302);
|
||||
response.setHeader("Content-Type", "text/html;charset=UTF-8");
|
||||
response.setHeader("location", "/user/login.html");
|
||||
response.finish304();
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package net.tccn.base.arango;
|
||||
import com.arangodb.ArangoCollection;
|
||||
import com.arangodb.ArangoDB;
|
||||
import com.arangodb.ArangoDatabase;
|
||||
import com.arangodb.Function;
|
||||
import com.arangodb.entity.DocumentCreateEntity;
|
||||
import com.arangodb.entity.DocumentDeleteEntity;
|
||||
import com.arangodb.entity.MultiDocumentEntity;
|
||||
@@ -15,6 +14,7 @@ import javax.persistence.Table;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
|
||||
@@ -164,7 +164,7 @@ public abstract class Doc<T extends Doc> {
|
||||
this.db = arangoSource.db(table.catalog());
|
||||
this.collection = arangoSource.collection(this);
|
||||
} catch (Exception e) {
|
||||
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
protected final static <T extends Doc> T dao(Class<T> type) {
|
||||
|
||||
@@ -3,8 +3,7 @@ package net.tccn.plat;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import net.tccn.base.arango.Doc;
|
||||
import org.redkale.persistence.Entity;
|
||||
import org.redkale.persistence.Table;
|
||||
import javax.persistence.Table;
|
||||
|
||||
/**
|
||||
* @author: liangxianyou at 2018/11/26 17:46.
|
||||
|
||||
@@ -15,6 +15,7 @@ import org.junit.Test;
|
||||
import org.redkale.convert.json.JsonConvert;
|
||||
import org.redkale.source.CacheMemorySource;
|
||||
import org.redkale.util.TypeToken;
|
||||
import org.redkale.util.Utility;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
@@ -33,8 +34,9 @@ import static java.util.Arrays.asList;
|
||||
*/
|
||||
public class RunTest<T> {
|
||||
static {
|
||||
MetaKit.init();
|
||||
//MetaKit.init();
|
||||
}
|
||||
|
||||
JsonConvert convert = JsonConvert.root();
|
||||
|
||||
/*public static Task A = new Task("mysql", "select * from user where userid=#(userid)", "查询用户列表", Kv.of("userid", 1));
|
||||
@@ -74,24 +76,33 @@ public class RunTest<T> {
|
||||
System.out.println("list:" + parse[1]);
|
||||
}
|
||||
|
||||
//@Test
|
||||
@Test
|
||||
public void jdbcTest() {
|
||||
//DbAccount jdbcAccount = new DbAccount("jdbc:mysql://192.168.202.11:3306/gxbii_dev", "root", "eversec123098");
|
||||
DbAccount dbAccount = new DbAccount();
|
||||
dbAccount.setCate("mysql");
|
||||
dbAccount.setUrl("jdbc:mysql://192.168.202.11:3306/gxbii_dev");
|
||||
dbAccount.setUrl("jdbc:mysql://47.111.150.118:6060/venue_core");
|
||||
dbAccount.setUser("root");
|
||||
dbAccount.setPwd("eversec123098");
|
||||
dbAccount.setPwd("*Zhong@1012!");
|
||||
|
||||
DbKit dbKit = new DbKit(dbAccount, "");
|
||||
|
||||
//String sql = "select * from basic_concat limit 1";
|
||||
String sql = "show databases;";
|
||||
//String sql = "show databases;";
|
||||
String sql = "SELECT u.`userid`,u.`mobile`, u.`wxunionid`, u.`wxopenid` FROM `useraccount` u;";
|
||||
|
||||
// find list
|
||||
List<Map> list = dbKit.findList(sql, Map.class);
|
||||
List<Map> list = dbKit.queryList(sql, Map.class);
|
||||
System.out.println(list.get(0));
|
||||
|
||||
StringBuffer buf = new StringBuffer();
|
||||
buf.append("INSERT INTO xx (userid, appid, cate, wxappid, mobile, unionid, openid) VALUES ");
|
||||
list.forEach(x -> {
|
||||
buf.append(String.format("\n('%s', 'pro_venue', 'wxapp', 'wx6cbc9f8ba0a7d1c6', %s, %s, '%s', '%s'),", Utility.uuid(),x.get("userid"), x.get("mobile"), x.getOrDefault("wxunionid", ""), x.getOrDefault("wxopenid", "")));
|
||||
});
|
||||
|
||||
System.out.println(buf);
|
||||
|
||||
|
||||
//find count
|
||||
/*long total = dbKit.queryColumn("select count(1) from basic_device", long.class);
|
||||
@@ -197,7 +208,7 @@ public class RunTest<T> {
|
||||
Integer.class, Long.class, Short.class, Byte.class, float.class, Float.class,
|
||||
String.class,
|
||||
};
|
||||
Object[] ks = new Object[]{"1", (int)1, (Integer)1, 1l, 1.0, 1f, 1.0d};
|
||||
Object[] ks = new Object[]{"1", (int) 1, (Integer) 1, 1l, 1.0, 1f, 1.0d};
|
||||
|
||||
for (Object k : ks) {
|
||||
System.out.println("--------------------------------------------");
|
||||
@@ -234,7 +245,7 @@ public class RunTest<T> {
|
||||
|
||||
}
|
||||
|
||||
//@Test
|
||||
@Test
|
||||
public void tplTest() {
|
||||
TplKit use = TplKit.use(true);
|
||||
use.addTpl(new File(FileKit.rootPath(), "tpl")); //ok
|
||||
@@ -243,7 +254,7 @@ public class RunTest<T> {
|
||||
|
||||
}
|
||||
|
||||
//@Test
|
||||
@Test
|
||||
public void T() {
|
||||
List<MetaTable> metaTables = MetaKit.getMetaTables();
|
||||
|
||||
@@ -371,7 +382,7 @@ public class RunTest<T> {
|
||||
String countSql = "select count(*) from basic_domain";
|
||||
|
||||
// find list
|
||||
List<Map> list = dbKit.findList(sql, Map.class);
|
||||
List<Map> list = dbKit.queryList(sql, Map.class);
|
||||
int total = dbKit.findColumn(countSql, int.class);
|
||||
|
||||
System.out.println("总记录数:" + total);
|
||||
|
||||
Reference in New Issue
Block a user