generate_return_condition.jsp

来自「非常完整的Java开发的网络办公系统」· JSP 代码 · 共 102 行

JSP
102
字号

<%@ page import="java.util.*" %>
<%@ page import="com.vnex.intranet.util.*" %>
<%@ page import="com.vnex.intranet.archives.value.ConditionBean" %>

<%
    String displayId = request.getParameter("displayId");
    String archiveTitle = request.getParameter("archiveTitle");
    String borrower = request.getParameter("borrower");
    String returnDate = request.getParameter("returnDate");
    
    ConditionBean bean = new ConditionBean();
    bean.setDisplayId(displayId);
    bean.setArchiveTitle(archiveTitle);
    bean.setBorrower(borrower);
    bean.setReturnDate(returnDate);
    
    String condition = "";
    
    CommonDBOperation cdb = new CommonDBOperation();
    String DBProductName = cdb.getDBProduct();
    if(DBProductName.startsWith("Oracle")) 
    {
      if(returnDate !=  null && !returnDate.equals(""))
      {
         String wherePrefix = " where ";
         if(condition.indexOf(wherePrefix.trim()) != -1)
           wherePrefix = " and ";
         condition += wherePrefix+" to_char(return_date, 'yyyy-mm-dd') = '"+returnDate+"'";
      }   
      if(displayId != null && !displayId.equals(""))
      {
         String wherePrefix = " where ";
         if(condition.indexOf(wherePrefix.trim()) != -1)
           wherePrefix = " and ";
         condition += wherePrefix+" archive_id in (select archive_id from t_archive where archive_display_id like '%"+displayId+"%') ";
      }   
      if(archiveTitle != null && !archiveTitle.equals(""))
      {
         String wherePrefix = " where ";
         if(condition.indexOf(wherePrefix.trim()) != -1)
           wherePrefix = " and ";
         condition += wherePrefix+" archive_id in (select archive_id from t_archive where archive_title like '%"+archiveTitle+"%') ";
      }   
      if(borrower != null && !borrower.equals(""))
      {
         String wherePrefix = " where ";
         if(condition.indexOf(wherePrefix.trim()) != -1)
           wherePrefix = " and ";
         condition += wherePrefix+ " borrower_id in (select emp_id from t_emp where name like '%"+borrower+"%') ";
      }
    }
    else if(DBProductName.startsWith("Microsoft SQL Server"))
    {
      if(returnDate !=  null && !returnDate.equals(""))
      {
         String wherePrefix = " where ";
         if(condition.indexOf(wherePrefix.trim()) != -1)
           wherePrefix = " and ";
         condition += wherePrefix+" CONVERT(char(10),return_date,20) = '"+returnDate+"'";
      }   
      if(displayId != null && !displayId.equals(""))
      {
         String wherePrefix = " where ";
         if(condition.indexOf(wherePrefix.trim()) != -1)
           wherePrefix = " and ";
         condition += wherePrefix+" archive_id in (select archive_id from t_archive where archive_display_id like '%"+cdb.changeCode(displayId)+"%') ";
      }   
      if(archiveTitle != null && !archiveTitle.equals(""))
      {
         String wherePrefix = " where ";
         if(condition.indexOf(wherePrefix.trim()) != -1)
           wherePrefix = " and ";
         condition += wherePrefix+" archive_id in (select archive_id from t_archive where archive_title like '%"+cdb.changeCode(archiveTitle)+"%') ";
      }   
      if(borrower != null && !borrower.equals(""))
      {
         String wherePrefix = " where ";
         if(condition.indexOf(wherePrefix.trim()) != -1)
           wherePrefix = " and ";
         condition += wherePrefix+ " borrower_id in (select emp_id from t_emp where name like '%"+cdb.changeCode(borrower)+"%') ";
      }
    }
    
    session.setAttribute("condition", condition);
    session.setAttribute("conditionBean", bean);
%> 

<html>
<head>
<script language=javascript>
function forward()
{
	document.location = "/mainctrl/archive/returnArchiveList?search";
}
</script>
</head>
<body onload="javascript:forward()">
</body>
<html>

⌨️ 快捷键说明

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