Atitit.atiDataStoreService   v2 新特性

1.1. V1  基础实现1

1.2. V2  增加了对  $uuid  $cur_uid参数的支持1

1.3. 增加了fld fun的支持1

2. fld fun1

2.1. Invoke   简化版全局函数txt2html1

2.2. ---------atiDataStoreService   .js1

2.3. dslUtil2

2.4. jAva3

3. code4

1.1. V1  基础实现

1.2. V2  增加了对  $uuid  $cur_uid参数的支持

1.3. 增加了fld fun的支持

2. fld fun

2.1. Invoke   简化版全局函数txt2html

cmsPhone4jobusImp/edit.html

<textarea id="copy_content" name="copy_content" style="width:100%; height: 300px;" fun="txt2html">工作日期

作者:: 绰号:老哇的爪子 ( 全名::Attilax Akbar Al Rapanui 阿提拉克斯 阿克巴 阿尔 拉帕努伊 ) 汉字名:艾龙,  EMAIL:1466519819@qq.com

转载请注明来源: http://www.cnblogs.com/attilax/

2.2. ---------atiDataStoreService   .js

function merge(metaData,merge_callback_fun)

{

var mp=$("form").serialize();

var fldAppFun=dslUtil.getFldAppFun(  mp);

mp=mp+"&$method=com.attilax.urldsl.UrlDsl2SqlStoreService.exe&$callback=page_load_callback&$mod=userMod&$view_store_path=com/attilax/order&$op=insert&"+metaData+"&$fldAppFun="+encodeURIComponent(fldAppFun);

//alert("get post mp:"+mp);

HRE.method="post";

try{

if( arguments.length==1)

HRE.exe(mp,merge_callback);

else

HRE.exe(mp,merge_callback_fun);

}catch(e)

{

showErr(e);

}

}

2.3. dslUtil

var dslUtil={};

dslUtil.getFldAppFun=function(url)

{

var json={};

var keys=urlUtil.getKeys(url);

for(e in keys )

{

var key=keys[e];

key=decodeURIComponent(key);

varkey_for_jq=escapeJquery(key);

//alert(key_for_jq);

var fun=$("#"+key_for_jq).attr("fun");

if(fun)

json[key]=fun;

}

return  JSON.stringify(json);

};

2.4. jAva

*/

public class UrlDsl2SqlStoreService extends Dsl2sqlService {

public static Map<String, Function> scriptMapper = Maps.newLinkedHashMap();

{

scriptMapper.put("txt2html", (txt) -> {

return htmlx.txt2html(txt.toString());

});

}

DslUtil.appFldFun(m);

public class DslUtil {

public static void appFldFun(Map m) {

if(m.get("$fldAppFun" )==null || m.get("$fldAppFun" ).toString().trim().length()==0)

return;

String json_str=(String) m.get("$fldAppFun");

Map fldFunMap=AtiJson.fromJson(json_str);

Set<String> st = fldFunMap.keySet();

for (String k : st) {

String script_tag=(String) fldFunMap.get(k);

Function fun=UrlDsl2SqlStoreService.scriptMapper.get(script_tag);

Object v=fun.apply(m.get(k));

m.put(k, v);

}

}

}

3.  code

package com.attilax.urldsl;

import java.util.HashMap;

import java.util.Map;

import java.util.Set;

import java.util.function.Function;

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.lang3.StringUtils;

import com.attilax.anno.Inj;

import com.attilax.html.htmlx;

import com.attilax.io.filex;

import com.attilax.ioc.IocXq214;

import com.attilax.lang.Global;

import com.attilax.lang.MapX;

import com.attilax.net.requestImp;

import com.attilax.sql.Dsl2sqlService;

import com.attilax.sql.SqlService;

import com.attilax.store.OrmStoreService;

import com.attilax.token.TokenService;

import com.attilax.user.NotLoginEx;

import com.attilax.web.ReqX;

import com.google.common.collect.Maps;

import com.google.inject.Inject;

/**

* q317 com.attilax.urldsl.UrlDsl2SqlStoreService

*

* @author Administrator

*

*/

public class UrlDsl2SqlStoreService extends Dsl2sqlService {

public static Map<String, Function> scriptMapper = Maps.newLinkedHashMap();

{

scriptMapper.put("txt2html", (txt) -> {

return htmlx.txt2html(txt.toString());

});

}

@Inject

SqlService sqlSrv;

@Inject

Dsl2sqlService d2sSrv;

@Inject

TokenService tkSrv;

public static void main(String[] args) {

requestImp m = new requestImp();

m.put("$tb", "wxb_good_copy");

// m.put("$tabletype", "view");

// m.put("$view_store_path","com/attilax/order");

m.put("$op", "i");

m.put("copy_title", "copy_title_2005");

Global.req.set(m);

System.setProperty("apptype", "jobus");

// OrmStoreService ormSvr = IocXq214.getBean(OrmStoreService.class);

UrlDsl2SqlStoreService srv = IocXq214

.getBean(UrlDsl2SqlStoreService.class);

// Map m=new HashMap();

System.out.println(srv.exe());

System.out.println("--f");

}

public Object exe() {

HttpServletRequest req = Global.req.get();

tkSrv.setModule(req.getParameter("$utype") + "Mod");

Map m = ReqX.toMap(req);

if (m.get("$table") == null)

m.put("$table", m.get("$tb"));

if (m.get("$op").equals("i"))

m.put("$op", "insert");

Set<String> st = m.keySet();

for (String k : st) {

if (m.get(k).equals("$cur_uid")) {

String getuid = tkSrv.getuid(req);

if (StringUtils.isEmpty(getuid))

throw new NotLoginEx("NotLoginEx");

m.put(k, getuid);

}

if(m.get(k).toString().equals("$uuid"))

{

m.put(k,filex.getUUidName());

}

}

DslUtil.appFldFun(m);

String sql = d2sSrv.dsl2sql(m);

if (StringUtils.isEmpty(sql))

throw new RuntimeException(

" cant convert sql str rzt is null or empty");

return sqlSrv.exe(sql);

}

}

Atitit.atiDataStoreService   v2 新特性的更多相关文章

  1. atitit.atiLinq v2新特性attilax大总结 q326

    atitit.atiLinq v2新特性attilax大总结 q326 1. V3规划 (分开sql2obj sql2sql sql2xml)1 2. V2新特性 Url linq的定义1 3. V1 ...

  2. Atitit. Toast alert loading js控件   atiToast v2新特性

    Atitit. Toast alert loading js控件   atiToast v2新特性 1. 连续多个txt追加的原理 var txt = document.createElement(& ...

  3. Atitit  atiMail atiDns新特性 v2  q39

    Atitit  atiMail atiDns新特性 v2  q39 V1  实现了基础的功能 V2  重构..使用自然语言的方式 c.According_to_the_domain_name(&quo ...

  4. Atitit opencv版本新特性attilax总结

    Atitit opencv版本新特性attilax总结 1.1. :OpenCV 3.0 发布,史上功能最全,速度最快的版1 1.2. 应用领域2 1.3. OPENCV2.4.3改进 2.4.2就有 ...

  5. Atitit s2018 s3 doc list alldvc.docx .docx s2018 s3f doc compc s2018 s3f doc homepc sum doc dvcCompc dtS312 s2018 s3f doc compc\Atitit PathUtil 工具新特性新版本 v8 s312.docx s2018 s3f doc compc\Atitit 操作日

    Atitit s2018 s3 doc list alldvc.docx .docx s2018 s3f doc compc s2018 s3f doc homepc sum doc dvcCompc ...

  6. Atitit.cateService分类管理新特性与设计文档说明v1

    Atitit.cateService分类管理新特性与设计文档说明v1 1. V2 新特性规划1 2. 分类管理1 3. 分类增加与修改维护2 4. Js控件分类数据绑定2 1. V2 新特性规划 增加 ...

  7. Atitit.aticmd v4  新特性q39 添加定时器释放功能

    Atitit.aticmd v4  新特性q39 添加定时器释放功能 V1  实现兰cmd V2 标准输入,标准输出,标准错误与重新定向 V3  stdout stderr统一重新定向 V4  添加定 ...

  8. Atitit.linux 内核 新特性 新功能

    Atitit.linux 内核 新特性 新功能 1.  Linux 3.2内核新特性 2012-02-12 22:41:471 1.1. EXT4:支持更大的块2 1.2. BTRFS:更快的数据清理 ...

  9. Atitit.jquery 版本号新特性attilax总结

    Atitit.jquery 版本号新特性attilax总结 1. Jq1.4 1 2. 1.5 1 3. 1.6 3 4. Jq1.7 3 ⒉提升了事件委派时的性能有了大幅度的提升.尤其是在ie7下: ...

随机推荐

  1. 【贪心】Gym - 100507H - Pair: normal and paranormal

    每次取相邻的两个可以射击的从序列中删除,重复n次. 可以看作括号序列的匹配. #include<cstdio> #include<vector> using namespace ...

  2. 使用.Net中的WeakDictionary — ConditionalWeakTable

    有的时候,我们需要给某些数据添加一些附加信息,一种常用的做法是使用一个Dictionary在填充这些附加信息如: var data = new Data();    var tag = new Tag ...

  3. Qemu 有用的链接

    Qemu下载和编译 Download https://en.wikibooks.org/wiki/QEMU/Linux https://en.wikibooks.org/wiki/QEMU/Insta ...

  4. 【POI】修改已存在的xls,新添一列后,再保存本文件+获取最大有效行号+获取单元格内容

    使用POI版本: ① ② ③ ④ package com.poi.dealXlsx; import java.io.File; import java.io.FileInputStream; impo ...

  5. ORACLE 数据库名、实例名、ORACLE_SID的区别

    数据库名(DB_NAME).实例名(Instance_name).以及操作系统环境变量(ORACLE_SID) 在ORACLE7.8数据库中只有数据库名(db_name)和数据库实例名(instanc ...

  6. 使用Spring进行远程访问与Web服务

    1.1. 简介   Spring为各种远程访问技术的集成提供了整合类.Spring使得开发具有远程访问功能的服务变得相当容易,而这些远程访问服务由普通Spring POJO实现.目前,Spring支持 ...

  7. VScode格式化vue文件

    使用vscode编写vue文件的时候, 发现不能格式化,手动格式化代码,太费劲, 还有可能会出错, 不格式化,有的时候代码编写的时候, 没有很好的管理格式,不美观. 但是我们是可以修改让VScode可 ...

  8. python 判断字符串中是否只有中文字符

    python 判断字符串中是否只有中文字符 学习了:https://segmentfault.com/q/1010000007898150 def is_all_zh(s): for c in s: ...

  9. JSON,字符串,MAP转换

    package com.tree.autotest.testcase.IAuditBillDetailService; import com.alibaba.fastjson.JSON;import ...

  10. Windows COM Surrogate 已停止工作怎么办

    已解决 如何解决"COM Surrogate 已停止工作"问题 悬赏分:15 - 解决时间:2008-7-6 16:55 Vista系统,经常出现这个提示框,烦人. 我试了网上有关 ...