📄 careerstory.java
字号:
/**
* 代理人职业生涯
*/
package com.NCL;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import com.sinosoft.common.*;
public class CareerStory {
protected IndexMap propList;
protected HashSet Property;
private List strList = new ArrayList();
private boolean EOF = false;
private int COUNT;
/**
* 构造函数
*
*/
public CareerStory(){
propList = new IndexMap();
Property = new HashSet();
Property.add("ID"); //ID
Property.add("AgentID"); //代理人号
Property.add("StartDate"); //起始日期
Property.add("EndDate"); //结束日期
Property.add("StoryTitle"); //标题
Property.add("StoryDetail"); //详细内容
Property.add("LastModified"); //最后修改时间
}
/**
* 初始化
* @param id
*/
public void init(String id){
DBAccess d = new DBAccess();
String sql = "SELECT * from CareerStory where ID=?";
this.propList = d.init(sql,id,this.Property);
}
/**
* 创建
* @return boolean
*/
public boolean createCareerStory(){
String sql = "INSERT into CareerStory(ID,AgentID,StartDate,EndDate,StoryTitle,StoryDetail,LastModified) "
+ "values (CareerStoryID_SQE.nextval,?,?,?,?,?,sysdate)";
DBAccess d = new DBAccess();
return d.execute(sql,this.propList);
}
/**
* 更新
* @return boolean
*/
public boolean updateCareerStory(){
try{
StringBuffer sql = new StringBuffer("update CareerStory 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("CareerStory.updateCareerStory():" + e.getMessage());
return false;
}
}
/**
* 删除
* @param id
* @return
*/
public boolean deleteCareerStory(String id){
DBAccess DBA= new DBAccess();
String SQL = "DELETE from CareerStory WHERE ID=?";
return DBA.executeDelete(SQL,id);
}
/**
* 查询
* @param agentID 代理人ID
* @return String
*/
public String findCSByAgentID(String agentID){
String SQL = "SELECT ID from CareerStory where AgentID=?";
this.set("AgentID", agentID);
DBAccess DBA = new DBAccess();
String result = DBA.executeQuery(SQL,propList,0,1);
return result;
}
/**
* 根据操作类型判断进行的操作
* @param we 对象
* @param operate 操作类型
* @return boolean
*/
public boolean doEdit(CareerStory we,String operate){
boolean bl = false;
if("create".equals(operate)){
bl = this.createCareerStory();
}else if("update".equals(operate)){
bl = this.updateCareerStory();
}else if("delete".equals(operate)){
bl = this.deleteCareerStory(we.get("ID"));
}
return bl;
}
/**
* 在此映射中关联指定值与指定键
* @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();
}
public static void main(String []ages){
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -