zoukankan      html  css  js  c++  java
  • n年龄 和 出生日期 比较的转换

    <%
    DBService dbservice = new DBService();
    DateTime datetime = new DateTime();
    String strAgentID=(String)session.getAttribute("AgentID");
    String strDeptID = (String)session.getAttribute("DeptID");
    String strSQL="";
    int iPage=1;
    int iPageSize=20;
    DBSet dbset = null;
    String strTH="";
    String strTD="";
    String strDoType="";
    int iTR=0;
    try
    {
    iPage = Integer.parseInt(request.getParameter("page"));
    strSQL = (String)session.getAttribute("sjcx_cxdx_list.sql");
    strTH = (String)session.getAttribute("sjcx_cxdx_list.th");
    strTD = (String)session.getAttribute("sjcx_cxdx_list.td");
    iPageSize=dbservice.stringToInt((String)session.getAttribute("sjcx_cxdx_list.pagesize"));
    }catch(Exception err)
    {
    strSQL = "select * from j_cadreinfo where 1=1 ";
    //对象名称
    String strA0101=request.getParameter("A0101").trim();
    strA0101=dbservice.postGBK(strA0101);
    if(strA0101.compareTo("")!=0)
    {
    strSQL = strSQL+" and A0101 ='"+strA0101+"' ";
    }
    //证件号码
    String strA0184=request.getParameter("A0184").trim();
    if(strA0184.compareTo("")!=0)
    {
    strSQL = strSQL+" and A0184 ='"+strA0184+"' ";
    }
    //性别
    String strA0104A=request.getParameter("A0104A").trim();
    strA0104A=dbservice.postGBK(strA0104A);
    if(strA0104A.compareTo("")!=0)
    {
    strSQL = strSQL+" and A0104A ='"+strA0104A+"' ";
    }
    //籍贯
    String strA0111A=request.getParameter("A0111A").trim();
    strA0111A=dbservice.postGBK(strA0111A);
    if(strA0111A.compareTo("")!=0)
    {
    strSQL = strSQL+" and A0111A ='"+strA0111A+"' ";
    }

    //出生日期范围
    String strBeginDate=request.getParameter("BeginDate").trim();
    String strEndDate=request.getParameter("EndDate").trim();
    if(strBeginDate.compareTo("")!=0)
    {
    // strSQL = strSQL+" and A0107 >='"+strBeginDate+"' ";
    }
    if(strEndDate.compareTo("")!=0)
    {
    // strSQL = strSQL+" and A0107 <='"+strEndDate+"' ";
    }
    //年龄
    String strAgeStart=request.getParameter("AgeStart").trim();
    String strAgeEnd=request.getParameter("AgeEnd").trim();
    int ageStart=Integer.parseInt(strAgeStart);
    int ageEnd=Integer.parseInt(strAgeEnd);
    String strDate=datetime.getDate();
    if(strAgeStart.compareTo("")!=0)
    {
    String strBeginDate1=datetime.getDateChange(strDate,-365*ageStart);
    strSQL = strSQL+" and A0107 <='"+strBeginDate1+"' ";
    }
    if(strAgeEnd.compareTo("")!=0)
    {
    String strBeginDate1=datetime.getDateChange(strDate,-365*ageEnd);
    strSQL = strSQL+" and A0107 >='"+strBeginDate1+"' ";
    }
    String strPageSize=request.getParameter("PageSize");
    if(strPageSize.compareTo("")==0)
    {
    strPageSize="20";
    }
    else
    {
    iPageSize=dbservice.stringToInt(strPageSize);
    }
    String strOrderBy=request.getParameter("resultvalue");
    if(strOrderBy.length()>1)
    {
    strOrderBy=strOrderBy.substring(0,strOrderBy.length()-1);
    }
    String strSortType=request.getParameter("SortType");
    if(strOrderBy.length()>1)
    {
    strSQL=strSQL+" order by "+strOrderBy+" "+strSortType;
    }
    String[] strFieldName = request.getParameterValues("FieldName");
    StringTokenizer tokens;

    int iFieldCount=strFieldName.length;
    iTR = iFieldCount+1;
    for(int i=0;i<iFieldCount;i++)
    {
    String strFieldAndLable=strFieldName[i];
    tokens = new StringTokenizer(strFieldAndLable,"-");
    String strField=tokens.nextToken();
    String strLable=tokens.nextToken();
    strTH=strTH+"<td height='24' align='center' class='right_line_th' >"+strLable+"</td> ";
    strTD=strTD+strField+",";
    }
    if(strTD.length()>2)
    {
    strTD=strTD.substring(0,strTD.length()-1);
    }
    strTH= dbservice.postGBK(strTH);
    session.setAttribute("sjcx_cxdx_list.sql",strSQL);
    session.setAttribute("sjcx_cxdx_list.th",strTH);
    session.setAttribute("sjcx_cxdx_list.td",strTD);
    session.setAttribute("sjcx_cxdx_list.pagesize",strPageSize);
    }
    if(strSQL != null && strSQL.length()>0)
    {
    dbset = dbservice.getPageData(strSQL,iPage,iPageSize);
    }

    String strExpSQL=java.net.URLEncoder.encode(strSQL);

    int iWindowHeight=608;
    int iWindowWidth=1002;
    %>

  • 相关阅读:
    解剖Nginx·自动脚本篇(7)类型相关脚本系列
    解剖Nginx·自动脚本篇(6)编译器名称变量脚本 auto/cc/name
    解剖Nginx·自动脚本篇(5)编译器相关主脚本
    解剖Nginx·自动脚本篇(4)工具型脚本系列
    解剖Nginx·自动脚本篇(3)源码相关变量脚本 auto/sources
    解剖Nginx·自动脚本篇(2)设置初始变量脚本 auto/init
    解剖Nginx·自动脚本篇(1)解析配置选项脚本 auto/options
    解剖Nginx·模块开发篇(5)解读内置非默认模块 ngx_http_stub_status_module
    jupyter nb + scite 混合搭建成我的最爱IDE
    md语法之行内代码和代码片续集
  • 原文地址:https://www.cnblogs.com/tfy1332/p/3652271.html
Copyright © 2011-2022 走看看