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

📄 contractstatisticdal.java

📁 sso呵呵
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
					  .append(firstTable).append(".document_id = ")
					  .append(firstTable).append(i).append(".document_id ");
			//连接个数
			i++;
		}
		//根据 承办人 连接个数
		if(cond.chbren != null ){
			if(i>0)
				bufsql.append("INNER JOIN ( ");

			bufsql.append("SELECT document_id FROM mocha_document_content ")
				  .append("WHERE item_name = 'chengbanren' AND item_value like '%"+ cond.chbren +"%' ) ");

			//添加连接列
			if(i==0)
				bufsql.append(firstTable+" ");
			else
				bufsql.append(firstTable).append(i).append(" ")
					  .append("ON ")
					  .append(firstTable).append(".document_id = ")
					  .append(firstTable).append(i).append(".document_id ");
			//连接个数
			i++;
		}
		//根据 合同名称 连接个数
		if(cond.contName != null ){
			if(i>0)
				bufsql.append("INNER JOIN ( ");

			bufsql.append("SELECT document_id FROM mocha_document_content ")
				  .append("WHERE item_name = 'hetongmingcheng' AND item_value like '%"+ cond.contName +"%' ) ");
			//添加连接列
			if(i==0)
				bufsql.append(firstTable+" ");
			else
				bufsql.append(firstTable).append(i).append(" ")
					  .append("ON ")
					  .append(firstTable).append(".document_id = ")
					  .append(firstTable).append(i).append(".document_id ");
			//添加结果集个数据
			i++;
		}
		//根据 合同编号 连接个数
		if(cond.contNum != null ){
			if(i>0)
				bufsql.append("INNER JOIN ( ");

			bufsql.append("SELECT document_id FROM mocha_document_content ")
				  .append("WHERE item_name = 'hetongbianhao' AND item_value like '%"+ cond.contNum +"%' ) ");
			//添加连接列
			if(i==0)
				bufsql.append(firstTable+" ");
			else
				bufsql.append(firstTable).append(i).append(" ")
					  .append("ON ")
					  .append(firstTable).append(".document_id = ")
					  .append(firstTable).append(i).append(".document_id ");
			//添加结果集个数据
			i++;
		}
		//根据 合同状态 连接个数
		if(cond.contState != null ){
			if(i>0)
				bufsql.append("INNER JOIN ( ");

			bufsql.append("SELECT document_id FROM mocha_document_content ")
				  .append("WHERE item_name = 'state' AND item_value = '"+ cond.contState +"' ) ");
			//添加连接列
			if(i==0)
				bufsql.append(firstTable+" ");
			else
				bufsql.append(firstTable).append(i).append(" ")
					  .append("ON ")
					  .append(firstTable).append(".document_id = ")
					  .append(firstTable).append(i).append(".document_id ");
			//添加结果集个数据
			i++;
		}
		//根据 对方当事人 连接个数
		if(cond.dshren != null ){
			if(i>0)
				bufsql.append("INNER JOIN ( ");

			bufsql.append("SELECT document_id FROM mocha_document_content ")
				  .append("WHERE item_name = 'duifangdangshiren' AND item_value like '%"+ cond.dshren +"%' ) ");
			//添加连接列
			if(i==0)
				bufsql.append(firstTable+" ");
			else
				bufsql.append(firstTable).append(i).append(" ")
					  .append("ON ")
					  .append(firstTable).append(".document_id = ")
					  .append(firstTable).append(i).append(".document_id ");
			//连接个数个数据
			i++;
		}
		//根据 贷币类型 连接个数
		if(cond.coinType != null ){
			if(i>0)
				bufsql.append("INNER JOIN ( ");

			bufsql.append("SELECT document_id FROM mocha_document_content ")
				  .append("WHERE item_name = 'huobileixing' AND item_value = '"+ cond.coinType +"' ) ");
			//添加连接列
			if(i==0)
				bufsql.append(firstTable+" ");
			else
				bufsql.append(firstTable).append(i).append(" ")
					  .append("ON ")
					  .append(firstTable).append(".document_id = ")
					  .append(firstTable).append(i).append(".document_id ");
			//连接个数个数据
			i++;
		}
		//根据 合同金额 连接个数
		if(cond.minMoney != null && cond.maxMoney != null){
			if(i>0)
				bufsql.append("INNER JOIN ( ");

			bufsql.append("SELECT document_id FROM mocha_document_content ")
				  .append("WHERE item_name = 'hetongjine' AND item_value BETWEEN '" + cond.minMoney + "' AND '" + cond.maxMoney + "' ) ");
			//添加连接列
			if(i==0)
				bufsql.append(firstTable+" ");
			else
				bufsql.append(firstTable).append(i).append(" ")
					  .append("ON ")
					  .append(firstTable).append(".document_id = ")
					  .append(firstTable).append(i).append(".document_id ");
			//连接个数个数据
			i++;
		}
		//根据 合同大类 连接个数
		if(cond.bigType != null ){
			if(i>0)
				bufsql.append("INNER JOIN ( ");

			bufsql.append("SELECT document_id FROM mocha_document_content ")
				  .append("WHERE item_name = 'hetongdalei' AND item_value = '"+ cond.bigType +"' ) ");
			//添加连接列
			if(i==0)
				bufsql.append(firstTable+" ");
			else
				bufsql.append(firstTable).append(i).append(" ")
					  .append("ON ")
					  .append(firstTable).append(".document_id = ")
					  .append(firstTable).append(i).append(".document_id ");
			//连接个数个数据
			i++;
		}
		//根据 合同小类 连接个数
		if(cond.smallType != null ){
			if(i>0)
				bufsql.append("INNER JOIN ( ");

			bufsql.append("SELECT document_id FROM mocha_document_content ")
				  .append("WHERE item_name = 'hetongxiaolei' AND item_value = '"+ cond.smallType +"' ) ");
			//添加连接列
			if(i==0)
				bufsql.append(firstTable+" ");
			else
				bufsql.append(firstTable).append(i).append(" ")
					  .append("ON ")
					  .append(firstTable).append(".document_id = ")
					  .append(firstTable).append(i).append(".document_id ");
			//连接个数个数据
			i++;
		}
		//根据 施印时间 连接个数
		if(cond.startDate != null && cond.endDate != null){
			if(i>0)
				bufsql.append("INNER JOIN ( ");

			bufsql.append("SELECT document_id FROM mocha_document_content ")
				  .append("WHERE item_name = 'shiyinshijian' AND to_date(nvl(item_value,'1000-01-01 00:00:00'),'yyyy-MM-dd HH24:mi:ss') ")
				  .append("BETWEEN " + "to_date('" + cond.startDate + "','yyyy-MM-dd HH24:mi:ss')" + " AND " + "to_date('" + cond.endDate + "','yyyy-MM-dd HH24:mi:ss') ) ");
			//添加连接列
			if(i==0)
				bufsql.append(firstTable+" ");
			else
				bufsql.append(firstTable).append(i).append(" ")
					  .append("ON ")
					  .append(firstTable).append(".document_id = ")
					  .append(firstTable).append(i).append(".document_id ");
			//连接个数个数据
			i++;
		}
		//根据 印花税类别 连接个数
		if(cond.stampType != null ){
			if(i>0)
				bufsql.append("INNER JOIN ( ");

			bufsql.append("SELECT document_id FROM mocha_document_content ")
				  .append("WHERE item_name = 'yinhuashuileixing' AND item_value = '"+ cond.stampType +"' ) ");
			//添加连接列
			if(i==0)
				bufsql.append(firstTable+" ");
			else
				bufsql.append(firstTable).append(i).append(" ")
					  .append("ON ")
					  .append(firstTable).append(".document_id = ")
					  .append(firstTable).append(i).append(".document_id ");
			//连接个数个数据
			i++;
		}
		//根据 事实合同 连接个数
		if(cond.factCont != null ){
			if(i>0)
				bufsql.append("INNER JOIN ( ");

			bufsql.append("SELECT document_id FROM mocha_document_content ")
				  .append("WHERE item_name = 'shishihetong' AND item_value = '"+ cond.factCont +"' ) ");
			//添加连接列
			if(i==0)
				bufsql.append(firstTable+" ");
			else
				bufsql.append(firstTable).append(i).append(" ")
					  .append("ON ")
					  .append(firstTable).append(".document_id = ")
					  .append(firstTable).append(i).append(".document_id ");
			//连接个数个数据
			i++;
		}
		//根据 项目名称 连接个数
		if(cond.itemName != null ){
			if(i>0)
				bufsql.append("INNER JOIN ( ");

			bufsql.append("SELECT document_id FROM mocha_document_content ")
				  .append("WHERE item_name = 'xiangmumingcheng' AND item_value like '%"+ cond.itemName +"%' ) ");
			//添加连接列
			if(i==0)
				bufsql.append(firstTable+" ");
			else
				bufsql.append(firstTable).append(i).append(" ")
					  .append("ON ")
					  .append(firstTable).append(".document_id = ")
					  .append(firstTable).append(i).append(".document_id ");
			//连接个数个数据
			i++;
		}
		//根据 项目编号 连接个数
		if(cond.itemNum != null ){
			if(i>0)
				bufsql.append("INNER JOIN ( ");

			bufsql.append("SELECT document_id FROM mocha_document_content ")
				  .append("WHERE item_name = 'xiangmubianhao' AND item_value like '%"+ cond.itemNum +"%' ) ");
			//添加连接列
			if(i==0)
				bufsql.append(firstTable+" ");
			else
				bufsql.append(firstTable).append(i).append(" ")
					  .append("ON ")
					  .append(firstTable).append(".document_id = ")
					  .append(firstTable).append(i).append(".document_id ");
			//连接个数个数据
			i++;
		}
		//根据 采购类型 连接个数
		if(cond.stockType != null ){
			if(i>0)
				bufsql.append("INNER JOIN ( ");

			bufsql.append("SELECT document_id FROM mocha_document_content ")
				  .append("WHERE item_name = 'caigouleixing' AND item_value = '"+ cond.stockType +"' ) ");
			//添加连接列
			if(i==0)
				bufsql.append(firstTable+" ");
			else
				bufsql.append(firstTable).append(i).append(" ")
					  .append("ON ")
					  .append(firstTable).append(".document_id = ")
					  .append(firstTable).append(i).append(".document_id ");
			//连接个数个数据
			i++;
		}

		bufsql.append(" )");
		// 根据用户添加搜索条件
		return "WHERE log.user_id='" + cond.currentUser +"' and " + bufsql.toString();
	}

	/**
	 *
	 * 方法描述 得到一个连接对象
	 * @return Connection
	 */
	private Connection getConnection(){
//		System.out.println(">>>> getConnection()");
		Connection con = (Connection)DBConnectionManager
									.getInstance()
									.getConnection(conName);
//		System.out.println("<<<< getConnection()");
		return con;
	}

	/**
	 *
	 * 方法描述 释放连接
	 * @return
	 */
	private void freeConnection(Connection con){
//		System.out.println(">>>> freeConnection()");
		DBConnectionManager.getInstance().freeConnection(conName, con);
//		System.out.println("<<<< freeConnection()");
	}


}

⌨️ 快捷键说明

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