📄 daofollow.java.svn-base
字号:
package GDPE.follow;
import GDPE.follow.plan.DAOCustomer;
import GDPE.follow.plan.EnEnt_Plan_Following;
import levin.base.*;
import levin.util.DbAccess;
import levin.util.DataSet;
/**
* 合同管理 数据库访问类
* <p>Title: 企业合同</p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2006</p>
* <p>Company: </p>
* @author
* @version 1.0
*/
public class DAOFollow extends DAOBase {
public DAOFollow() {
}
public static EnEnt_Record_Following [] searcheEnContract(DbAccess db,
EnEnt_Record_Following SearchEnContract,String startTime,String endTime)
throws Exception
{
String eEnEnt_Record_Following="";
if ((SearchEnContract.getChCustomerName() != null && SearchEnContract.getChCustomerName().length() != 0)
||(SearchEnContract.getChEnterpriseName() != null && SearchEnContract.getChEnterpriseName().length() != 0)
||(SearchEnContract.getChCommitCode() != null && SearchEnContract.getChCommitCode().toString().length() != 0)
||(SearchEnContract.getChSeatCode() != null && SearchEnContract.getChSeatCode().length() != 0)
||(SearchEnContract.getChFollowResult() != null && SearchEnContract.getChFollowResult().length() != 0)
||(SearchEnContract.getChStation() != null && SearchEnContract.getChStation().length() != 0)
||(startTime != null && startTime.length()!=0)
||(endTime != null && endTime.length()!=0)
||(SearchEnContract.getChCommitName() != null && SearchEnContract.getChCommitName().toString().length() != 0) )
{
eEnEnt_Record_Following = "(select * from Ent_Record_Following where "+ GDPE.follow.DAOFollow.searchSql(SearchEnContract,startTime,endTime)+") Ent_Record_Following ";
// System.out.println("0000000000000000000"+SearchEnContract.getChStation());
}else{
eEnEnt_Record_Following="Ent_Record_Following";
}
//System.out.println(Auditor);
String sql="";
//String sql = "select * from Ent_Record_Contract where chContractNo='"+SearchEnContract.getChContractNo()+"'";
sql = sql + " select Ent_Record_Following.*";
sql = sql + " from "+eEnEnt_Record_Following;
sql = sql + setDefaultSort();
//System.out.println("sq-------------------------"+sql);
EnEnt_Record_Following [] aEnEnt_Record_Following = null;
aEnEnt_Record_Following =DAOFollow.SetEnCustomert(db, sql);
return (aEnEnt_Record_Following);
}
//用 StringBuffer 性能好很多!
public static String searchSql(EnEnt_Record_Following eEnEnt_Record_Following,String startTime,String endTime)
{
String sql = "";
int i=0;
if (eEnEnt_Record_Following.getChCustomerName() != null &&
! (eEnEnt_Record_Following.getChCustomerName() + "A").equals("A"))
{
sql = sql + "Ent_Record_Following.chCustomerName like '%" + eEnEnt_Record_Following.getChCustomerName().trim()+"%'";
i++;
}
if (eEnEnt_Record_Following.getChFollowResult() != null &&
! (eEnEnt_Record_Following.getChFollowResult() + "A").equals("A"))
{
if(i==0){
if(eEnEnt_Record_Following.getChFollowResult().equals("2")) {
sql = sql + " (Ent_Record_Following.chFollowResult like '%0%' or Ent_Record_Following.chFollowResult like '1' or Ent_Record_Following.chFollowResult like '2' or Ent_Record_Following.chFollowResult like '3') ";
}else {
sql = sql + " (Ent_Record_Following.chFollowResult like '%4%' or Ent_Record_Following.chFollowResult like '5' or Ent_Record_Following.chFollowResult like '6') ";
}
i++;
}else{
if(eEnEnt_Record_Following.getChFollowResult().equals("2")) {
sql = sql + "and (Ent_Record_Following.chFollowResult like '%0%' or Ent_Record_Following.chFollowResult like '1' or Ent_Record_Following.chFollowResult like '2' or Ent_Record_Following.chFollowResult like '3') ";
}else {
sql = sql + "and (Ent_Record_Following.chFollowResult like '%4%' or Ent_Record_Following.chFollowResult like '5' or Ent_Record_Following.chFollowResult like '6') ";
}
}
}
if (eEnEnt_Record_Following.getChEnterpriseName() != null &&
! (eEnEnt_Record_Following.getChEnterpriseName() + "A").equals("A"))
{
if(i==0){
sql = sql + " Ent_Record_Following.chEnterpriseName like '%" + eEnEnt_Record_Following.getChEnterpriseName().trim() + "%'";
i++;
}else{
sql = sql + " and Ent_Record_Following.chEnterpriseName like '%" + eEnEnt_Record_Following.getChEnterpriseName().trim() + "%'";
}
}
if (eEnEnt_Record_Following.getChCommitName() != null &&
! (eEnEnt_Record_Following.getChCommitName() + "A").equals("A"))
{
if(i==0){
sql = sql + " Ent_Record_Following.chCommitName like '%" + eEnEnt_Record_Following.getChCommitName().trim() + "%'";
i++;
}else{
sql = sql + " and Ent_Record_Following.chCommitName like '%" + eEnEnt_Record_Following.getChCommitName().trim() + "%'";
}
}
if (eEnEnt_Record_Following.getChCommitCode() != null &&
! (eEnEnt_Record_Following.getChCommitCode() + "A").equals("A"))
{
if(i==0){
sql = sql + " Ent_Record_Following.chCommitCode like '%" + eEnEnt_Record_Following.getChCommitCode().trim() + "%'";
i++;
}else{
sql = sql + " and Ent_Record_Following.chCommitCode like '%" + eEnEnt_Record_Following.getChCommitCode().trim() + "%'";
}
}
if (eEnEnt_Record_Following.getChSeatCode() != null &&
! (eEnEnt_Record_Following.getChSeatCode() + "A").equals("A"))
{
if(i==0){
sql = sql + " Ent_Record_Following.chSeatCode like '%" + eEnEnt_Record_Following.getChSeatCode().trim() + "%'";
i++;
}else{
sql = sql + " and Ent_Record_Following.chSeatCode like '%" + eEnEnt_Record_Following.getChSeatCode().trim() + "%'";
}
}
if (eEnEnt_Record_Following.getChStation() != null &&
! (eEnEnt_Record_Following.getChStation() + "A").equals("A"))
{
if(i==0){
sql = sql + " Ent_Record_Following.chStation like '%" + eEnEnt_Record_Following.getChStation().trim() + "%'";
i++;
}else{
sql = sql + " and Ent_Record_Following.chStation like '%" + eEnEnt_Record_Following.getChStation().trim() + "%'";
}
}
if (startTime != null && ! (startTime + "A").equals("A"))
{
if(i==0){ //TO_DATE('01-01-2000','dd-mm-yyyy');
sql = sql + " Ent_Record_Following.dtTrackingDate >= TO_DATE('" + startTime.trim() + "','yyyy-MM-dd')";
i++;
}else{
sql = sql + " and Ent_Record_Following.dtTrackingDate >= TO_DATE('" + startTime.trim() + "','yyyy-MM-dd')";
}
}
if (endTime != null &&
! (endTime + "A").equals("A"))
{
if(i==0){
sql = sql + " Ent_Record_Following.dtTrackingDate <= TO_DATE('" + endTime.trim() + "','yyyy-MM-dd')";
i++;
}else{
sql = sql + " and Ent_Record_Following.dtTrackingDate <= TO_DATE('" + endTime.trim() + "','yyyy-MM-dd')";
}
}
return sql;
}
public static String setDefaultSort()
{
String sql = "";
sql = " order by Ent_Record_Following.dtTrackingDate desc";
return sql ;
}
public static EnEnt_Record_Following[] SetEnCustomert(DbAccess db, String sql)
throws Exception
{
DataSet ds = db.executeQuery(sql);
EnEnt_Record_Following[] eEnEnt_Record_Following = (EnEnt_Record_Following[]) DAOBase.resumeFromDataSet(ds, EnEnt_Record_Following.class.getName());
return eEnEnt_Record_Following;
}
public static EnEnt_Record_Following [] searcheEnContract2(DbAccess db,
EnEnt_Record_Following SearchEnContract,String startTime,String endTime,String chStationCode,String idstr)
throws Exception
{
String eEnEnt_Customer_Enterprise="";
if ((SearchEnContract.getChFollowResult() != null && SearchEnContract.getChFollowResult().length() != 0)
||(SearchEnContract.getChStationCode() != null && SearchEnContract.getChStationCode().length() != 0)
||(SearchEnContract.getChStation() != null && SearchEnContract.getChStation().length() != 0)
||(SearchEnContract.getChSeatCode() != null && SearchEnContract.getChSeatCode().length() != 0)
||(SearchEnContract.getChFollowResult() != null && SearchEnContract.getChFollowResult().length() != 0)
||(startTime != null && startTime.length()!=0)
||(endTime != null && endTime.length()!=0)
||(SearchEnContract.getChCommitName() != null && SearchEnContract.getChCommitName().toString().length() != 0) )
{
//eEnEnt_Customer_Enterprise = "(select * from Ent_Customer_Enterprise where chIsAudited like '1' and "+ GDPE.customer.enterprise.DAOCustomer.searchSql(SearchEnContract,startTime,endTime)+") Ent_Customer_Enterprise ";
eEnEnt_Customer_Enterprise ="(select * from (select * from Ent_Record_Following where chStationCode ='"+chStationCode+"' or chCommitCode ='"+idstr+"') Ent_Record_Following where "+ DAOFollow.searchSql(SearchEnContract,startTime,endTime)+") Ent_Record_Following ";
//System.out.println("0000000000000000000"+SearchEnContract.getChEnterpriseName());
}else{
eEnEnt_Customer_Enterprise="Ent_Record_Following";
}
//System.out.println(Auditor);
String sql="";
//String sql = "select * from Ent_Record_Contract where chContractNo='"+SearchEnContract.getChContractNo()+"'";
sql = sql + " select Ent_Record_Following.*";
sql = sql + " from "+eEnEnt_Customer_Enterprise;
sql = sql + setDefaultSort();
//System.out.println("sq-------------------------"+sql);
EnEnt_Record_Following [] aEnEnt_Record_Following = null;
aEnEnt_Record_Following =DAOFollow.SetEnCustomert(db, sql);
return (aEnEnt_Record_Following);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -