📄 orgemail.java
字号:
/**
* 机构邮箱
*/
package com.NCL;
import java.util.*;
import com.sinosoft.common.*;
public class OrgEmail {
protected IndexMap propList;
protected HashSet Property;
private List strList = new ArrayList();
private boolean EOF = false;
private int COUNT;
/**
* 构造函数
*
*/
public OrgEmail() {
propList = new IndexMap();
Property = new HashSet();
Property.add("ComCode");
Property.add("ComplaintEmail");
Property.add("WillEmail");
}
/**
* 初始化
* @param ComCode 公司代码
*/
public void init(String ComCode){
DBAccess d = new DBAccess();
String sql = "SELECT * from OrgEmail where ComCode=?";
this.propList = d.init(sql,ComCode,this.Property);
}
/**
* 创建
* @return boolean
*/
public boolean createOrgEmail(){
String sql = "INSERT into OrgEmail(ComCode,ComplaintEmail,WillEmail) values (?,?,?)";
DBAccess d = new DBAccess();
return d.execute(sql,this.propList);
}
/**
* 更新
* @return boolean
*/
public boolean updateOrgEmail(){
try{
StringBuffer sql = new StringBuffer("update OrgEmail 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 Comcode=?");
l.add(this.get("ComCode"));
strList.clear();
DBAccess q = new DBAccess();
return q.executeUpdate(sql.toString(),l);
}catch(Exception e){
e.printStackTrace();
System.out.println("OrgEmail.updateOrgEmail():" + e.getMessage());
return false;
}
}
/**
* 根据条件查询
* @param oe 对象
* @param pageSize 分页大小
* @param pageIndex 分页页码
* @return String
*/
public String findOrgEmail(OrgEmail oe,int pageSize,int pageIndex){
String result = "";
StringBuffer SQL = new StringBuffer("SELECT ComCode from OrgEmail where 1=1");
String comCode = oe.get("ComCode");
String complaintEmail = oe.get("ComplaintEmail");
String willEmail = oe.get("WillEmail");
if(Data.hasValue(comCode))
SQL.append(" and ComCode=?");
if(Data.hasValue(complaintEmail))
SQL.append(" and complaintEmail=?");
if(Data.hasValue(willEmail))
SQL.append(" and willEmail=?");
DBAccess d = new DBAccess();
result = d.executeQuery(SQL.toString(),oe.propList,pageSize,pageIndex);
setCOUNT(d.COUNT);
setEOF(d.EOF);
return result;
}
/**
* 创建或更新邮箱
* @param str 公司代码
* @return boolean
*/
public boolean saveEmail(String str) {
boolean flag = false;
OrgEmail oe = new OrgEmail();
oe.init(str);
String temp = oe.get("ComCode");
if("".equals(temp) || temp == null) {
flag = this.createOrgEmail();
}
else {
flag = this.updateOrgEmail();
}
return flag;
}
/**
* 获取分公司机构邮箱的html代码
* @param orgNameEmail 邮箱类型
* @return String
*/
public String getEmailOption(String orgNameEmail) {
StringBuffer option = new StringBuffer("");
LDCom ldc = new LDCom();
List result = ldc.getComCodeResult("1","2");
IndexMap im = new IndexMap();
String ComCode = "";
for(int i = 0; i < result.size(); i++) {
im = (IndexMap)result.get(i);
ComCode = im.get("COMCODE").toString();
this.init(ComCode);
ldc.init(ComCode);
option.append("<OPTION value='" + this.get(orgNameEmail) + "' " + "comCode='" + ldc.get("ComCode") + "' >" + ldc.get("Name") + "</OPTION>\n");
this.clear();
ldc.clear();
}
return option.toString();
}
/**
* 在此映射中关联指定值与指定键
* @param name 指定键
* @param value 指定值
*/
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);
}
}
/**
* 在此映射中关联指定值与指定键
* @param name 指定键
* @param value 指定值
*/
public boolean set(String name, Object value){
if(Property.contains(name)){
propList.put(name,value);
return true;
}else
return false;
}
/**
* 返回指定键在此映射中所映射的值
* @param name 指定键
* @return
*/
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 "";
}
/**
* 返回COUNT
* @return int
*/
public int getCOUNT() {
return COUNT;
}
/**
* 设置COUNT
* @param count
*/
public void setCOUNT(int count) {
COUNT = count;
}
/**
* 返回EOF
* @return boolean
*/
public boolean isEOF() {
return EOF;
}
/**
* 设置EOF
* @param eof
*/
public void setEOF(boolean eof) {
EOF = eof;
}
/**
* 清空propList
*
*/
public void clear(){
propList.clear();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -