⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 querysqltransition.java

📁 一套完整的工商12315的源程序jsp部分在12315里,后台JAVA部分在gs12315src里,没有打包数据库.
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
                        //01数字并且 ,02数字或 ,03字符并且,04字符或
                        if("03".equals(xname.substring(7,9))){
                            result += " and ";
                            tempStr = xname.substring(9,xname.length());
                            Debug.println("[querySqlTransition]-getQuerySql--->compare:" + tempStr);
                            //01 字符大于,02 字符小于,03 字符大于等于,04 字符小于等于,05 等于,06 在....之间
                            //取变量组合  and field049 > 'field049a'  and (field049>='field049a' and )
                            StringTokenizer subTokenizer = new StringTokenizer(tempStr,"_");
                            String tempStr1 = "";
                            String tempStr2 = "";
                            if(subTokenizer.hasMoreTokens()){
                                tempStr = (String) (subTokenizer.nextToken());
                            }
                            if(subTokenizer.hasMoreTokens()){
                                //取得数值
                                tempStr1 = (String) (subTokenizer.nextToken());
                                tempStr1 = getMapValue(pageParMap,tempStr1);
                            }
                            if(subTokenizer.hasMoreTokens()){
                                tempStr2 = (String) (subTokenizer.nextToken());
                                tempStr2 = getMapValue(pageParMap,tempStr2);
                            }
                            //获得sql
                            if(!"".equals(tempStr) || !"".equals(tempStr1) || !"".equals(tempStr2)){
                                if("01".equals(xValue)){
                                    result += " " + tempStr + " >'" + tempStr1 + "' ";
                                } else
                                if("02".equals(xValue)){
                                    result += " " + tempStr + " < '" + tempStr1 + "' ";
                                } else
                                if("03".equals(xValue)){
                                    result += " " + tempStr + " >= '" + tempStr1 + "' ";
                                } else
                                if("04".equals(xValue)){
                                    result += " " + tempStr + " <= '" + tempStr1 + "' ";
                                } else
                                if("05".equals(xValue)){
                                    result += " " + tempStr + " = '" + tempStr1 + "' ";
                                } else
                                if("06".equals(xValue)){
                                    result += " " + tempStr + " >= '" + tempStr1 + "' and " + tempStr + " <= '" + tempStr2 + "' ";
                                }
                            }

                        } else
                        //字符或
                        //01数字并且 ,02数字或 ,03字符并且,04字符或
                        if("04".equals(xname.substring(7,9))){
                            result += " or ";
                            tempStr = xname.substring(9,xname.length());

                            //01 字符大于,02 字符小于,03 字符大于等于,04 字符小于等于,05 等于,06 在....之间
                            //取变量组合  and field049 > 'field049a'  and (field049>='field049a' and )
                            StringTokenizer subTokenizer = new StringTokenizer(tempStr,"_");
                            String tempStr1 = "";
                            String tempStr2 = "";
                            if(subTokenizer.hasMoreTokens()){
                                tempStr = (String) (subTokenizer.nextToken());
                            }
                            if(subTokenizer.hasMoreTokens()){
                                //取得数值
                                tempStr1 = (String) (subTokenizer.nextToken());
                                tempStr1 = getMapValue(pageParMap,tempStr1);
                            }
                            if(subTokenizer.hasMoreTokens()){
                                tempStr2 = (String) (subTokenizer.nextToken());
                                tempStr2 = getMapValue(pageParMap,tempStr2);
                            }
                            //获得sql
                            if(!"".equals(tempStr) || !"".equals(tempStr1) || !"".equals(tempStr2)){
                                if("01".equals(xValue)){
                                    result += " " + tempStr + " > '" + tempStr1 + "' ";
                                } else
                                if("02".equals(xValue)){
                                    result += " " + tempStr + " < '" + tempStr1 + "' ";
                                } else
                                if("03".equals(xValue)){
                                    result += " " + tempStr + ">= '" + tempStr1 + "' ";
                                } else
                                if("04".equals(xValue)){
                                    result += " " + tempStr + " <= '" + tempStr1 + "' ";
                                } else
                                if("05".equals(xValue)){
                                    result += " " + tempStr + " = '" + tempStr1 + "' ";
                                } else
                                if("06".equals(xValue)){
                                    result += " " + tempStr + " >= '" + tempStr1 + "' and " + tempStr + " <= '" + tempStr1 + "' ";
                                }
                            }
                        }
                    }else
                    //3.排序 orderby???
                    if("orderby".equals(xname.substring(0,7))){
                        if(xname.substring(7,9)=="01")//desc
                            orderbyState="1";
                        else
                            orderbyState="0";

                        tempStr=xname.substring(9,xname.length());
                        if("".equals(orderbyStr))
                            orderbyStr+=tempStr;
                        else
                            orderbyStr+=","+tempStr;
                    }
                    Debug.println("[querySqlTransition]-getQuerySql--->result:" + result + " xname:" + xname + " xValue:" + xValue);
                }
            }
            if(!"".equals(orderbyStr)){
                if("1".equals(orderbyState))
                   result += " order by " + orderbyStr+" desc";
                else
                   result += " order by " + orderbyStr;
            }
        } catch(Exception ex){
            Debug.println("[querySqlTransition]--->exception:" + ex.getMessage());
        }
        Debug.println("[querySqlTransition]-getQuerySql--->result end :" + result);
        return result;
    }
    //处理吊销的业务时修改了接口
    public static String getQuerySql(HashMap pageParMap,String searchStr){

        //接收页面参数
        HashMap pageParMapTemp = new HashMap();
        ArrayList sub = null;
        String xname;
        String xValue;
        String xValue1;
        String xValue2;
        String tempStr;
        String result = "";
        String orderbyStr = "";
        String orderbyState = "0";
        try{
            if(pageParMap == null){
                return result;
            }

            Debug.println("[querySqlTransition]---->getQuerySql pageParMap 'size():" + pageParMap.size());

            for(int i = 0;i < pageParMap.size();i++){
//                sub = (ArrayList) pageParMap.get((Object)new Integer(i));
                sub = (ArrayList) (pageParMap.get((Object)new Integer(i)));
                xname = (String) sub.get(0);
                xValue = (String) sub.get(1);

                Debug.println("i=" + i + " usercbg xname:" + xname);
                Debug.println("usercbg xValue:" + xValue);

                //异常处理少于9个的变量不做串处理
                if(xname.length() > 9){
                    //1.一般查询条件 如 字段表示 eg: query0101field004	and field004>?
                    if("query".equals(xname.substring(0,5))){
                        tempStr = xname.substring(9,xname.length());
                        //01并且 02或
                        if("01".equals(xname.substring(5,7))){
                            result += " and ";
                            //01数字大于 ,02	数字小于 ,03数字	大于等于 ,04数字	小于等于, 05字符等于, *06	在之间 ,07不等于 ,08	全包含,09,左包含,10,右包含,11字符大于,12字符小于,13字符大于等于,14字符小于等于
                            if("01".equals(xname.subSequence(7,9))){
                                result += " " + tempStr + " > " + xValue + " ";
                            } else
                            if("02".equals(xname.subSequence(7,9))){
                                result += " " + tempStr + " < " + xValue + " ";
                            } else
                            if("03".equals(xname.subSequence(7,9))){
                                result += " " + tempStr + " >= " + xValue + " ";
                            } else
                            if("04".equals(xname.subSequence(7,9))){
                                result += " " + tempStr + " <= " + xValue + " ";
                            } else
                            if("05".equals(xname.subSequence(7,9))){
                                result += " " + tempStr + " = '" + xValue + "' ";
                            } else
                            if("06".equals(xname.subSequence(7,9))){
                                //result+=" "+tempStr+" > '"+xValue+"' ";
                            } else
                            if("07".equals(xname.subSequence(7,9))){
                                result += " " + tempStr + " <> '" + xValue + "' ";
                            } else
                            if("08".equals(xname.subSequence(7,9))){
                                result += " " + "field001" + " in  (" + searchStr + ")";
                            }
                            if("09".equals(xname.subSequence(7,9))){
                                result += " " + tempStr + " like '" + xValue + "%' ";
                            } else
                            if("10".equals(xname.subSequence(7,9))){
                                result += " " + tempStr + " like '%" + xValue + "' ";
                            } else
                            if("11".equals(xname.subSequence(7,9))){
                                result += " " + tempStr + " > '" + xValue + "' ";
                            } else
                            if("12".equals(xname.subSequence(7,9))){
                                result += " " + tempStr + " < '" + xValue + "' ";
                            } else
                            if("13".equals(xname.subSequence(7,9))){
                                result += " " + tempStr + " >= '" + xValue + "' ";
                            } else
                            if("14".equals(xname.subSequence(7,9))){
                                result += " " + tempStr + " <= '" + xValue + "' ";
                            }

                        } else
                        if("02".equals(xname.substring(5,7))){

                            if(xValue.length() < 3 || xValue.indexOf("/") == -1){
                                continue;
                            }
                            StringTokenizer subTokenizer = new StringTokenizer(xValue,"/");
                            result += " and ( 2=1 ";
                            while(subTokenizer.hasMoreTokens()){
                                xValue = (String) (subTokenizer.nextToken());
                                result += " or ";
                                //01数字大于 ,02	数字小于 ,03数字	大于等于 ,04数字	小于等于, 05字符等于, *06	在之间 ,07不等于 ,08	全包含,09,左包含,10,右包含,11字符大于,12字符小于,13字符大于等于,14字符小于等于
                                if("01".equals(xname.subSequence(7,9))){
                                    result += " " + tempStr + " > " + xValue + " ";
                                } else
                                if("02".equals(xname.subSequence(7,9))){
                                    result += " " + tempStr + " < " + xValue + " ";
                                } else
                                if("03".equals(xname.subSequence(7,9))){
                                    result += " " + tempStr + " >= " + xValue + " ";
                                } else
                                if("04".equals(xname.subSequence(7,9))){
                                    result += " " + tempStr + " <= " + xValue + " ";
                                } else
                                if("05".equals(xname.subSequence(7,9))){
                                    result += " " + tempStr + " = '" + xValue + "' ";
                                } else
                                if("06".equals(xname.subSequence(7,9))){
                                    //result+=" "+tempStr+" > '"+xValue+"' ";
                                } else
                                if("07".equals(xname.subSequence(7,9))){
                                    result += " " + tempStr + " <> '" + xValue + "' ";
                                } else
                                if("08".equals(xname.subSequence(7,9))){
                                    result += " " + tempStr + " like '%" + xValue + "%' ";
                                } else
                                if("09".equals(xname.subSequence(7,9))){
                                    result += " " + tempStr + " like '" + xValue + "%' ";
                                } else
                                if("10".equals(xname.subSequence(7,9))){
                                    result += " " + tempStr + " like '%" + xValue + "' ";
                                } else
                                if("11".equals(xname.subSequence(7,9))){
                                    result += " " + tempStr + " > '" + xValue + "' ";
                                } else
                                if("12".equals(xname.subSequence(7,9))){
                                    result += " " + tempStr + " < '" + xValue + "' ";
                                } else
                                if("13".equals(xname.subSequence(7,9))){

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -