- 浏览: 269164 次
- 性别:
- 来自: 苏州
文章分类
最新评论
-
夏保森:
太简单了,而且不是太好用,我现在项目就是要实现这样一个功能,比 ...
前台拼接SQL语句 -
人参萝卜:
楼主你好,想要一下这个样例工程的源码,能否分享一下,多谢多谢! ...
MxGraph web流程设计器破解 -
814292160:
为什么解压不了
extjs多文件上传 -
dongqing82585061:
楼主你好,能给份这个demo给我吗?现在我刚好需要实现类似的效 ...
MxGraph web流程设计器破解 -
ddccjjwwjj:
在JBPM中你的连线坐标根本无法做到JBPM的效果 全部会变形 ...
MxGraph web流程设计器破解
<?xml version="1.0" encoding="gb2312"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>查询条件表单</title>
<style>
*{
font-size:12px;
padding:0;
margin:0;
}
body{
padding:40px;
}
#MainBox{
border:#666 1px solid;
background-color:#eee;
width:700px;
}
#MainBox td{
padding:4px;
}
#ConditionBox{
height:150px;
width:100%;
overflow-y:auto;
border:#bbb 1px solid;
padding:2px;
background-color:#fff;
}
.tmFrame{
border:#eee 1px solid;
padding:2px;
width:100%;
}
.tmFrame_highlight{
border:#666 1px solid;
padding:2px;
width:100%;
background-color:#f7f7f7;
}
.fname{
float:left;
width:200px;
}
.conn{
float:left;
width:100px;
}
.fvalue{
float:left;
width:100px;
}
.handlebox{
float:right;
width:180px;
display:none;
}
.handlebox_view{
float:right;
width:180px;
display:block;
}
.rbox{
float:right;
margin:1px;
background-color:#999;
color:#fff;
padding:1px;
width:15px;
cursor:hand;
}
legend{
border:#bbb 1px solid;
padding:4px;
}
fieldset{
border:#bbb 1px solid;
padding:4px;
}
.sqlwords{
margin:2px;
border:#bbb 1px solid;
width:100%;
}
</style>
<script>
////构造函数
function ce(e){return document.createElement(e)}
/* Example:
* var a = cex("DIV", {onmouseover:foo, name:'div1', id:'main'});
*/
function cex(e, x){
var a = ce(e);
for (prop in x){
a[prop] = x[prop];
}
return a;
}
/*
* function ge
* Shorthand function for document.getElementById(i)
*/
function ge(i){return document.getElementById(i)}
/*
* function ac
* Example: ac( house, ac(roof, shingles), ac(floor, ac(tiles, grout)))
*/
function ac(){
if (ac.arguments.length > 1){
var a = ac.arguments[0];
for (i=1; i<ac.arguments.length; i++){
if (arguments[i])
a.appendChild(ac.arguments[i]);
}
return a;
} else {
return null;
}
}
/////ID增量
function guid(){
if (!window.__id) window.__id = 0;
return ++window.__id;
}
//======建立条件类
function term(tname,fname,conn,fvalue,ttype){
this.tname=tname;
this.fname=fname;
this.conn=conn;
this.fvalue=fvalue;
this.id= guid();
this.ttype=ttype;
}
term.prototype.getHTML = function(){
var termFrame = cex("DIV", {
id:this.id,
className:'tmframe',
onmouseover:this.fc_term_onmouseover(),
onmouseout:this.fc_term_onmouseout()
});
//var module = cex("DIV", {
//id:'module'+this.id,
//className:'module'
//});
var tttt=this.tname+"."+this.fname;
if(this.ttype!='fset')
tttt=this.tname;
var mtt = cex("input", {
id:'tp'+this.id,
name:'fname'+this.id,
type:"hidden",
value:this.ttype
});
var fname = cex("DIV", {
id:'fname'+this.id,
className:'fname',
innerHTML:tttt
});
var conn = cex("DIV", {
id:'conn'+this.id,
className:'conn',
innerHTML:this.conn
});
var fvalue = cex("DIV", {
id:'fvalue'+this.id,
className:'fvalue',
innerHTML:this.fvalue
});
var handlebox = cex("div", {
id:'handlebox'+this.id,
className:"handlebox"
});
var mdel = cex("div", {
id:'tmdel'+this.id,
onclick:this.fc_mdel_onclick(),
className:"rbox",
title:"删除此条件",
innerHTML: 'X'
});
var mup = cex("div", {
id:'tmup'+this.id,
onclick:this.fc_mup_onclick(),
className:"rbox",
title:"向上移动",
innerHTML: '↑'
});
var mdown = cex("div", {
id:'tmdown'+this.id,
onclick:this.fc_mdown_onclick(),
className:"rbox",
title:"向下移动",
innerHTML: '↓'
});
var mzkh = cex("div", {
id:'tzkh'+this.id,
onclick:this.fc_mzkh_onclick(),
className:"rbox",
title:"添加左括号",
innerHTML: '('
});
var mykh = cex("div", {
id:'tykh'+this.id,
onclick:this.fc_mykh_onclick(),
className:"rbox",
title:"添加右括号",
innerHTML: ')'
});
var mand = cex("div", {
id:'tand'+this.id,
onclick:this.fc_mand_onclick(),
className:"rbox",
title:"添加并条件",
innerHTML: 'and'
});
var mor = cex("div", {
id:'tor'+this.id,
onclick:this.fc_mor_onclick(),
className:"rbox",
title:"添加或条件",
innerHTML: 'or'
});
// Build DIV
ac (termFrame,
mtt,
ac (handlebox,
mdel,
mup,
mdown,
mykh,
mzkh,
mand,
mor
),
fname,
conn,
fvalue
);
return termFrame;
}
term.prototype.highlight = function(){
ge("handlebox"+this.id).className = 'handlebox_view';
ge(this.id).className = 'tmFrame_highlight';
}
term.prototype.lowlight = function(){
ge("handlebox"+this.id).className = 'handlebox';
ge(this.id).className = 'tmFrame';
}
term.prototype.remove = function(){
var _this = ge(this.id);
_this.parentNode.removeChild(_this);
}
term.prototype.moveup = function(){
var _this = ge(this.id);
var pre_this = _this.previousSibling;
if(pre_this!=null){
_this.parentNode.insertBefore(_this,pre_this);
this.lowlight();
}
}
term.prototype.movedown = function(){
var _this = ge(this.id);
var next_this = _this.nextSibling;
if(next_this!=null){
_this.parentNode.insertBefore(next_this,_this);
this.lowlight();
}
}
term.prototype.addzkh = function(){
var _this = ge(this.id);
var tzkh = new term('╭----------------','','','','zkh');
var node_zkh = tzkh.getHTML();
_this.parentNode.insertBefore(node_zkh,_this);
}
term.prototype.addykh = function(){
var _this = ge(this.id);
var tykh = new term('╰----------------','','','','ykh');
var node_ykh = tykh.getHTML();
if(_this.nextSibling!=null)
_this.parentNode.insertBefore(node_ykh,_this.nextSibling);
else
_this.parentNode.appendChild(node_ykh);
}
term.prototype.addand = function(){
var _this = ge(this.id);
var tand = new term(' 并且','','','','tand');
var node_and = tand.getHTML();
if(_this.nextSibling!=null)
_this.parentNode.insertBefore(node_and,_this.nextSibling);
else
_this.parentNode.appendChild(node_and);
}
term.prototype.addor = function(){
var _this = ge(this.id);
var tor = new term(' 或者','','','','tor');
var node_or = tor.getHTML();
if(_this.nextSibling!=null)
_this.parentNode.insertBefore(node_or,_this.nextSibling);
else
_this.parentNode.appendChild(node_or);
}
///对象控制函数
term.prototype.fc_term_onmouseover = function(){
var _this = this;
return function(){
//if (!_this.isDragging)
_this.highlight();
}
}
term.prototype.fc_term_onmouseout = function(){
var _this = this;
return function(){
//if (!_this.isDragging)
_this.lowlight();
}
}
term.prototype.fc_mdel_onclick = function(){
var _this = this;
return function(){
_this.remove();
}
}
term.prototype.fc_mup_onclick = function(){
var _this = this;
return function(){
_this.moveup();
}
}
term.prototype.fc_mdown_onclick = function(){
var _this = this;
return function(){
_this.movedown();
}
}
term.prototype.fc_mzkh_onclick = function(){
var _this = this;
return function(){
_this.addzkh();
}
}
term.prototype.fc_mykh_onclick = function(){
var _this = this;
return function(){
_this.addykh();
}
}
term.prototype.fc_mand_onclick = function(){
var _this = this;
return function(){
_this.addand();
}
}
term.prototype.fc_mor_onclick = function(){
var _this = this;
return function(){
_this.addor();
}
}
/////插入页面
function insertterm(){
var tname = document.all.tname.value;
var fname = document.all.fname.value;
var conn = document.all.conn.value;
var fvalue = document.all.fvalue.value;
//xl(tname+"|"+fname+"|"+conn+"|"+fvalue);
var tm = new term(tname,fname,conn,fvalue,"fset");
var tmHTML = tm.getHTML();
ac(ge("ConditionBox"),tmHTML);
//ZA.addterm(tm);
addtofrom(tname);
}
var tt = new Array();
function addtofrom(tname){
var ttexit="no";
for(var i=0;i<tt.length;i++){
if(tt[i]==tname)
ttexit="yes";
}
if(ttexit=="no"){
tt[i]=tname;
//alert(tt[i]);
}
}
//====条件控制窗口函数
function CBadd(){
var h = document.all.ConditionBox.offsetHeight;
document.all.ConditionBox.style.height = h + 20 + "px";
}
function CBcut(){
var h = document.all.ConditionBox.offsetHeight;
if(h>=150)
document.all.ConditionBox.style.height = h - 20 + "px";
else
return false;
}
////////SQL语句处理函数
function getSQL(){
var sql="";
var ma = ge("ConditionBox").childNodes;
//alert(ma.length);
for(i=0;i<ma.length;i++){
var id = ma[i].getAttribute("id");
var tp = ge("tp"+id).value;
if(tp=="fset"){
//sql+=" "+ge("fname"+id).innerHTML;
//sql+=" "+ge("conn"+id).innerHTML;
//sql+=" \""+ge("fvalue"+id).innerHTML+"\"";
var fname=ge("fname"+id).innerHTML;
var conn=ge("conn"+id).innerHTML;
var fvalue=ge("fvalue"+id).innerHTML;
sql+=" "+fname;
if(conn=="等于")
sql+=" = "+"\'"+fvalue+"\'";
if(conn=="大于")
sql+=" > "+"\'"+fvalue+"\'";
if(conn=="小于")
sql+=" < "+"\'"+fvalue+"\'";
if(conn=="不等于")
sql+=" <> "+"\'"+fvalue+"\'";
if(conn=="为空")
sql+=" is null ";
if(conn=="不为空")
sql+=" is not null ";
if(conn=="包含")
sql+=" like \'%"+fvalue+"%\'";
}
else{
//sql+=" "+ge("fname"+id).innerHTML;
if(tp=="zkh")
sql+=" (";
if(tp=="ykh")
sql+=" )";
if(tp=="tand")
sql+=" and";
if(tp=="tor")
sql+=" or";
}
//var mn = ma.childNodes;
}
var ffrom = "FROM "+getFrom();
ge("sqlwords").value ="SELECT * "+ ffrom+" WHERE "+sql;
}
function getFrom(){
var ff=tt.toString();
return ff;
}
//////////////term数组处理
//var ZA = {};
//ZA.terms = new Array();
//ZA.addterm = function(term){
// var ZAl = ZA.terms.length;
// ZA.terms[ZAl] = term;
//alert(ZA.terms[ZAl].ttype);
// ZAl++;
//}
//ZA.insert_bef_term = function(term,tm){
//}
</script>
</head>
<body>
<table border="0" cellspacing="0" cellpadding="0" id="MainBox">
<tr>
<td colspan="2" style="background-color:#999;color:#000;font-weight:bolder;font-size:14px">复杂查询表单</td>
</tr>
<tr>
<td><div id="ConditionBox"></div>
<div style="width:100%"><SPAN title='放大显示框' style='float:right;FONT-SIZE: 14px; CURSOR: hand;FONT-FAMILY: webdings' onclick='CBadd()'>6</SPAN><SPAN title='缩小显示' style='float:right;FONT-SIZE: 14px; CURSOR: hand;FONT-FAMILY: webdings' onclick='CBcut()'>5</SPAN></div></td>
</tr>
<tr>
<td>
<fieldset>
<legend>SQL表达式</legend>
<input type="text" id="sqlwords" class="sqlwords" /><input type="submit" name="Submit" value="GET SQL" onclick="getSQL()" style="float:right"/>
</fieldset>
</td>
</tr>
<tr>
<td>
<fieldset>
<legend>定义条件</legend>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>表</td>
<td><select name="tname" id="tname">
<option value="table1" selected="selected">表1</option>
<option value="table2">表2</option>
<option value="table3">表3</option>
<option value="table4">表4</option>
<option value="table5">表5</option>
</select></td>
<td>字段</td>
<td><select name="fname" id="fname">
<option value="f1">字段1</option>
<option value="f2">字段2</option>
<option value="f3">字段3</option>
<option value="f4">字段4</option>
<option value="f5">字段5</option>
<option value="f6">字段6</option>
<option value="f7">字段7</option>
</select></td>
<td>关系</td>
<td><select name="conn" id="conn">
<option value="大于">大于</option>
<option value="等于">等于</option>
<option value="小于">小于</option>
<option value="不等于">不等于</option>
<option value="为空">为空</option>
<option value="不为空">不为空</option>
<option value="包含">包含</option>
</select></td>
<td>值</td>
<td><input name="fvalue" type="text" id="fvalue" value="111111" /></td>
<td><input type="submit" name="Submit" value="增加新条件" onclick="insertterm()"/></td>
</tr>
</table>
</fieldset>
</td>
</tr>
</table>
</body>
</html>
- 拼接SQL1.rar (3.9 KB)
- 下载次数: 8
发表评论
-
dhtmlx 2.5破解版
2012-03-09 15:30 2933dhtmlx 2.5破解版 -
FusionCharts 破解
2012-01-15 22:47 1048FusionCharts_Widgets_PowerChart ... -
JQuery zTree 很不错的一个TREE
2012-01-10 20:34 860http://www.baby666.cn/hunter/in ... -
sql 分页语句
2011-09-09 15:21 824CREATE proc pageSelect (@pageSi ... -
JSP版的完善KindEditor在线编辑器开源代码
2011-07-09 13:18 1471package com.elkan.kindeditor.up ... -
js浮动toolbar
2011-07-09 12:41 1843这几天做程序一直在找浮动的toolbar 找到个比较好的 ... -
MxGraph web流程设计器破解
2011-03-15 23:04 4554与JBPM结合可以做最好的web流程设计器,这里找了2个破解 ... -
TBCompressor_v2.4 非常好的js 和 css 压缩工具
2011-01-21 15:28 1519淘宝前端的开发环境以Windows居多。为了方便使用,对YUI ... -
JS屏幕尺寸
2010-11-14 01:16 1066<!DOCTYPE HTML PUBLIC " ... -
随IE滚动的按钮
2010-11-14 01:13 859随IE滚动的按钮 -
Delphi简单ActiveX网页调用示例
2010-11-07 15:40 1826将来要调用用户本机相关信息Active必定是个不错的应用 D ... -
EditPlus技巧
2009-05-13 13:33 2008除了windows操作系统,Edi ... -
一个EditPlus 格式化js小工具
2009-03-27 11:27 4058打开 EditPlus,工具栏-->工具-->配置 ... -
JavaScript 计算当天是本年本月的第几周
2009-03-19 16:51 2181var getMonthWeek = function (a, ... -
Js获取当前日期时间及其它操作
2009-03-19 16:27 3807myDate.getYear(); //获取当 ... -
Companion.JS IE javascript 调试工具
2009-03-19 13:53 2431做web开发的朋友都清楚,js程序的调试是相当郁闷的,因为首先 ... -
IE Developer Toolbar
2009-03-19 13:47 2115IE Developer Toolbar是微软专门 ... -
multibox 全选
2008-10-15 01:14 1094function allselect() { try{ var ... -
SQL 连接 左连接,右连接,全连接,内连接,交叉连接,自连接
2008-09-18 11:56 2142现在在这写写关于它们的作用假设有如下表:一个为投票主表,一个为 ... -
梅花日历控件V3.0
2008-09-06 17:36 1589JS常用日历控件
相关推荐
动态拼接sql语句工具类,拼接where后面语句 配合原生jdbc仿动态sql注入 if (ObjectUtil.isNotEmpty(maxLat)&&ObjectUtil.isNotEmpty(minLat)){ sqlParamList.add(new SqlParam("lat",minLat, SqlOpEnum.GE)); ...
易语言动态拼接sql语句源码,动态拼接sql语句
动态拼接sql语句.rar 动态拼接sql语句.rar 动态拼接sql语句.rar 动态拼接sql语句.rar 动态拼接sql语句.rar 动态拼接sql语句.rar
使用Java自定义注解来拼接SQL查询语句,方便使用。
通过EXCEL公式,拼接Oracle数据库插入语句。开发过程造数测试或导入初始化数据的时候很方便。
SQL语句拼接
SQL语句格式化工具,可语法加亮显示,可将大段SQL拼成程序代码,免去手工拼接之苦。也可将代码还原成SQL,便于在数据库IDE中查询调试。操作简单,省去不少拼接的时间,推荐使用。
sql语句拼接+游标技术sql语句拼接+游标技术sql语句拼接+游标技术sql语句拼接+游标技术sql语句拼接+游标技术sql语句拼接+游标技术sql语句拼接+游标技术sql语句拼接+游标技术
利用反射动态拼接sql。 daohelper属于DAL层,objectdata类属于BLL层,BLL层引用DAL层。映射数据的表继承objectdata类。例如,数据表book,根据字段与属性一一对应的方式创建book类,插入数据库时,直接book.save()
MyBatis动态拼接SQL
Delphi中sql语句的使用总结 Delphi中sql语句的使用总结 Delphi中sql语句的使用总结
sql拼接:不要拼接Sql,而要使用参数的好处 在实际开发中,经常会需要对数据库进行访问,最常见的开发方法就类似
易语言源码易语言动态拼接sql语句源码.rar
针对不确定的查询参数,简化SQL语句的拼写代码。目前支持Oracl及MySql数据库
反射获取传入对象的属性拼接sql语句实现增、删、改
SQL拼接替换程序能够替换Java开发中SQL语句中参数,以便于在数据库中执行Java开发中SQL语句。直接将参数替换SQL中的问号。填写要替换的SQL语句及参数,能够生成SQL代码。需要Java中写好的SQL填写上,直接将参数逗号...
SQL查询结果拼接