📄 insurancewill.java
字号:
package com.NCL;
import com.sinosoft.common.*;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import com.sinosoft.common.DBAccess;
import com.sinosoft.common.Data;
public class InsuranceWill {
protected IndexMap propList;
protected HashSet Property;
private List strList = new ArrayList();
private boolean EOF = false;
private int COUNT;
protected String fMakeDate;
protected String tMakeDate;
protected String fDealDate;
protected String tDealDate;
public InsuranceWill(){
propList = new IndexMap();
Property = new HashSet();
Property.add("ID");
Property.add("UserName");
Property.add("Address");
Property.add("PostalCode");
Property.add("FixedPhone");
Property.add("MobilePhone");
Property.add("ServiceOrg");
Property.add("ProductChannel");
Property.add("ProductType");
Property.add("ProductID");
Property.add("AgentID");
Property.add("ProperContactTime");
Property.add("WillDescription");
Property.add("MakeDate");
Property.add("DealFlag");
Property.add("DealDate");
Property.add("DealResult");
Property.add("SendCount");
//Property.add("AreaCode");
Property.add("Sex");
}
public void init(String insuranceWillID){
DBAccess d = new DBAccess();
String sql = "SELECT * from InsuranceWill where ID=?";
this.propList = d.init(sql,insuranceWillID,this.Property);
}
public boolean createInsuranceWill(){
String sql = "INSERT into InsuranceWill(ID,UserName,Address,PostalCode,FixedPhone,MobilePhone,ServiceOrg,"
+ "ProductChannel,ProductType,ProductID,AgentID,ProperContactTime,WillDescription,MakeDate,Sex) "
+ "values (INSURANCEWILLID_SQE.nextval,?,?,?,?,?,?,?,?,?,?,?,?,sysdate,?)";
DBAccess d = new DBAccess();
return d.execute(sql,this.propList);
}
public boolean deleteInsuranceWill(String messageID){
DBAccess DBA= new DBAccess();
String SQL = "DELETE from InsuranceWill WHERE ID=?";
return DBA.executeDelete(SQL,messageID);
}
public String findInsuranceWill(InsuranceWill iw,int pageSize,int pageIndex){
String id = iw.get("ID");
String userName = iw.get("UserName");
String serviceOrg = iw.get("ServiceOrg");
String productChannel = iw.get("ProductChannel");
String productType = iw.get("ProductType");
String productID = iw.get("ProductID");
String agentID = iw.get("AgentID");
String acceptFlag = iw.get("AcceptFlag");
String dealFlag = iw.get("DealFlag");
StringBuffer SQL = new StringBuffer("SELECT ID from InsuranceWill where 1=1");
if(Data.hasValue(id))
SQL.append(" and ID=" + Data.formatValue(id));
if(Data.hasValue(userName))
SQL.append(" and UserName like ?");
if(Data.hasValue(serviceOrg))
SQL.append(" and ServiceOrg=?");
if(Data.hasValue(productChannel))
SQL.append(" and ProductChannel=?");
if(Data.hasValue(productType))
SQL.append(" and ProductType=?");
if(Data.hasValue(productID))
SQL.append(" and ProductID=?");
if(Data.hasValue(agentID))
SQL.append(" and AgentID=?");
if(Data.hasValue(this.getFMakeDate())){
if(this.getFMakeDate().length() != 10)
return "";
else
SQL.append(" and MakeDate>=to_date('" + fMakeDate + "','yyyy-MM-dd')");
}
if(Data.hasValue(this.getTMakeDate())){
if(this.getTMakeDate().length() != 10)
return "";
else
SQL.append(" and MakeDate<=to_date('" + tMakeDate + " 23:59:59','yyyy-MM-dd hh24:mi:ss')");
}
if(Data.hasValue(acceptFlag))
SQL.append(" and AcceptFlag=?");
if(Data.hasValue(dealFlag))
SQL.append(" and DealFlag=?");
if(Data.hasValue(this.getFDealDate())){
if(this.getFDealDate().length() != 10)
return "";
else
SQL.append(" and DealDate>=to_date('" + fDealDate + "','yyyy-MM-dd')");
}
if(Data.hasValue(this.getTDealDate())){
if(this.getTDealDate().length() != 10)
return "";
else
SQL.append(" and DealDate<=to_date('" + tDealDate + " 23:59:59','yyyy-MM-dd hh24:mi:ss')");
}
SQL.append(" order by MakeDate desc");
DBAccess DBA = new DBAccess();
String result = DBA.executeQuery(SQL.toString(),propList,pageSize,pageIndex);
this.setCOUNT(DBA.COUNT);
this.setEOF(DBA.EOF);
return result;
}
public boolean updateInsuranceWill(){
try{
StringBuffer sql = new StringBuffer("update InsuranceWill set ");
List l = new ArrayList();
for(int i=0;i<strList.size();i++){
Object[] strArray =(Object[]) strList.get(i);
sql.append(strArray[0]);
sql.append("=?,");
l.add(strArray[1]);
}
sql.deleteCharAt(sql.lastIndexOf(","));
sql.append(" where ID=?");
l.add(this.get("ID"));
strList.clear();
DBAccess q = new DBAccess();
return q.executeUpdate(sql.toString(),l);
}catch(Exception e){
e.printStackTrace();
System.out.println("InsuranceWill.updateInsuranceWill():" + e.getMessage());
return false;
}
}
public void setUpdateValue(String name,Object value){
if(this.set(name,value)){
Object[] uValue = new Object[2];
uValue[0] = name;
uValue[1] = value;
strList.add(uValue);
}
}
public boolean set(String name, Object value){
if(Property.contains(name)){
propList.put(name,value);
return true;
}else
return false;
}
public String get(String name){
if (Property.contains(name)){
String value = (String)propList.get(name);
if(value != null && !value.equals(""))
return value;
else
return "";
}else
return "";
}
public String getFMakeDate() {
return fMakeDate;
}
public void setFMakeDate(String makeDate) {
fMakeDate = makeDate;
}
public String getTMakeDate() {
return tMakeDate;
}
public void setTMakeDate(String makeDate) {
tMakeDate = makeDate;
}
public String getFDealDate() {
return fDealDate;
}
public void setFDealDate(String dealDate) {
fDealDate = dealDate;
}
public String getTDealDate() {
return tDealDate;
}
public void setTDealDate(String dealDate) {
tDealDate = dealDate;
}
/**
* @return
*/
/**
* @return
*/
public int getCOUNT() {
return COUNT;
}
public void setCOUNT(int count) {
COUNT = count;
}
public boolean isEOF() {
return EOF;
}
public void setEOF(boolean eof) {
EOF = eof;
}
public void clear(){
propList.clear();
}
public static void main(String []ages){
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -