atitit.atiOrmStoreService 框架的原理与设计 part1 概述与新特性
atitit.atiOrmStoreService 框架的原理与设计 part1 概述与新特性
1. 新特性如下
支持生成sql在无数据库连接的情况下
2. Orm设计
主要的俩个以来service如下
@Inject
Dsl2sqlService dsl2sqlSvr;
@Inject
DBX dbSvr;
作者:: 绰号:老哇的爪子 ( 全名::Attilax Akbar Al Rapanui 阿提拉克斯 阿克巴 阿尔 拉帕努伊 ) 汉字名:艾龙, EMAIL:1466519819@qq.com
转载请注明来源: http://www.cnblogs.com/attilax/
3. code
/atiPlatf_bet/src/com/attilax/store/OrmStoreService.java
package com.attilax.store;
import java.util.List;
import java.util.Map;
import com.attilax.db.DBX;
import com.attilax.io.filex;
import com.attilax.ioc.IocXq214;
import com.attilax.json.AtiJson;
import com.attilax.lang.MapX;
import com.attilax.orm.AOrm;
import com.attilax.orm.Aorm4view;
import com.attilax.orm.View;
import com.attilax.sql.Dsl2sqlService;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.inject.Inject;
public class OrmStoreService extends StoreService {
public static void main(String[] args) {
System.setProperty("apptype", "bet");
OrmStoreService ormSvr = IocXq214.getBean(OrmStoreService.class);
Map m = Maps.newLinkedHashMap();
m.put("$table", "orderView");
m.put("$tabletype", "view");
m.put("$view_store_path","com/attilax/order");
m.put("$op", "insert");
m.put("good_id","2005");
m.put("order_id",filex.getUUidName());
List<String> insertSql = ormSvr.insertSql(m);
System.out.println( AtiJson.toJson( insertSql));
System.out.println("--f1");
}
@Inject
Dsl2sqlService dsl2sqlSvr;
@Inject
DBX dbSvr;
public List<String> insertSql(Map m) {
List<String> li = Lists.newArrayList();
if (m.get("$tabletype") != null && m.get("$tabletype").equals("view")) {
String[] tabs = new View(m.get("$table"), m.get("$view_store_path"))
.getTables();
for (String tab : tabs) {
Map m2 = MapX.clone(m);
m2.put("$table", tab);
String s = get_insert_singleTable_sql(m2);
li.add(s);
}
return li;
}
return li;
}
public void insert(Map m) {
List<String> li = insertSql(m);
for (String sql : li) {
dbSvr.execSql(sql);
}
}
public String get_insert_singleTable_sql(Map m) {
String sql = dsl2sqlSvr.dsl2sql(m);
return sql;
}
}
最新文章
- ios上的 button和input-button为什么不水平居中的
- Eclipse解决Ctrl+c很卡的方法
- git各种命令介绍以及碰到的各种坑
- win10添加打印机--无法访问指定设备,路径或文件。。
- Log4j XML 配置
- java基础之 集合
- Unable to execute dex: method ID not in [0, 0xffff]: 65536
- 我的AndroidStudio设置
- 动态规划——E (LIS())最长上升子序列
- 栈溢出之rop到syscall
- SQL Server截取字符串和处理中文技巧
- node.js零基础详细教程(4):node.js事件机制、node异步IO操作
- 安装wampserve之前需要安装vc++2012.
- 【京东详情页】——原生js爬坑之二级菜单
- mysql 两个时间段的差,可以是秒,天,星期,月份,年...
- MacOS的菜单状态栏App添加饼型进度
- MySQL单行函数
- Python3学习之路~9.1 paramiko模块:实现ssh执行命令以及传输文件
- tab选项卡实例
- MDX Cookbook 03 - MDX 查询中负数,零和空值 NULL 的格式化处理
热门文章
- 【Ajax】PHP中ajax的基本知识点
- Web目录全能扫描工具DirBuster
- CodeForces - 981E Addition on Segments
- 【强连通分量缩点】【记忆化搜索】bzoj1589 [Usaco2008 Dec]Trick or Treat on the Farm 采集糖果
- python基础--常用模块与面向对象基础
- VMware三种网络模式组网(转)
- linux下分区相关知识
- Inno Setup入门(十五)——Inno Setup类参考(1)
- 【java】字符串的反转
- ylbtech-LanguageSamples-Events(事件)