crm_project_progressbean.java

来自「java开发的办公系统 1.系统管理 (地区管理,部门管理,菜单管理,用户管理」· Java 代码 · 共 148 行

JAVA
148
字号
package com.vere.crm.project.bean;	import java.sql.*;	import java.util.*;	import com.vere.db.*;	import com.vere.crm.customer.item.*;	import com.vere.crm.project.item.*;	public class Crm_project_progressBean	{		private ResultSet rs=null;		private int keyId;		private int totalRecord;		private Access access = null;		public Crm_project_progressBean()		{			try {				access=new Access();			}			catch(Exception e) {				System.out.println(e.toString());			}		}				/**		 * @author	Administrator		 * @param	id: 当前要修改记录的id号		 * @return	Crm_project_progressItem		 * @see		取出 crm_project_progress 表中的指定id号的一条记录存储在一个 Crm_project_progressItem 对象中		 */		public Crm_project_progressItem find(String crm_project_info_id){			try {				String sql="select  "+T.CRM_PROJECT_PROGRESS+".*,"+T.CRM_PROJECT_INFO+".project_name ,"+T.CRM_CUSTOMER_INFO+".customer_name as  "+T.CRM_CUSTOMER_INFO+"_customer_name,"+T.CRM_CUSTOMER_INFO+".id as  "+T.CRM_CUSTOMER_INFO+"_customer_id ,"+T.CRM_CUSTOMER_CONTACT+".contact_name as  "+T.CRM_CUSTOMER_CONTACT+"_contact_name ,"+T.CRM_CUSTOMER_CONTACT+".id as  "+T.CRM_CUSTOMER_CONTACT+"_contact_id  from   "+T.CRM_PROJECT_INFO+"  ,"+T.CRM_CUSTOMER_INFO+" ,"+T.CRM_CUSTOMER_CONTACT+" ,"+T.CRM_PROJECT_PROGRESS+"  where "+T.CRM_PROJECT_INFO+".customer_id = "+T.CRM_CUSTOMER_INFO+".id  and "+T.CRM_PROJECT_INFO+".customer_contact_id = "+T.CRM_CUSTOMER_CONTACT+".id  and    "+T.CRM_PROJECT_PROGRESS+".crm_project_info_id="+T.CRM_PROJECT_INFO+".id and "+T.CRM_PROJECT_PROGRESS+".crm_project_info_id="+crm_project_info_id;				rs = executeQuery(sql);				Crm_project_progressItem item=new Crm_project_progressItem();				if(rs.next()){					item.setId(rs.getString("id"));					item.setCrm_project_info_id(rs.getString("crm_project_info_id"));					item.setCrm_customer_id(rs.getString("crm_customer_id"));					item.setCrm_customer_contact_id(rs.getString("crm_customer_contact_id"));					item.setProgress_content(rs.getString("progress_content"));					item.setWrite_people(rs.getString("write_people"));					item.setWrite_date(rs.getString("write_date"));					Crm_project_infoItem crm_project_infoItem=new Crm_project_infoItem();					crm_project_infoItem.setProject_name(rs.getString("project_name"));					item.setCrm_project_infoItem(crm_project_infoItem);					Crm_customer_infoItem crm_customer_infoItem=new Crm_customer_infoItem();					crm_customer_infoItem.setCustomer_name(rs.getString(T.CRM_CUSTOMER_INFO+"_customer_name"));					crm_customer_infoItem.setId(rs.getString(T.CRM_CUSTOMER_INFO+"_customer_id"));					item.setCrm_customer_infoItem(crm_customer_infoItem);					Crm_customer_contactItem crm_customer_contactItem=new Crm_customer_contactItem();					crm_customer_contactItem.setContact_name(rs.getString(T.CRM_CUSTOMER_CONTACT+"_contact_name"));					crm_customer_contactItem.setId(rs.getString(T.CRM_CUSTOMER_CONTACT+"_contact_id"));					item.setCrm_customer_contactItem(crm_customer_contactItem);				}				return item;			}catch(SQLException e){				System.out.print(e.toString());				return null;			}			finally{				DBclose();			}		}				/**		 * @author	Administrator		 * @param	item:要修改的数据对象Crm_project_progressItem		 * @return	boolean:如果修改成功返回true,否则返回false		 * @see		修改一条记录		 */		public boolean updateItem(Crm_project_progressItem item){			try{				String sql="update "+T.CRM_PROJECT_PROGRESS+" set "+							"crm_project_info_id="+item.getCrm_project_info_id()+","+							"crm_customer_id="+item.getCrm_customer_id()+","+							"crm_customer_contact_id="+item.getCrm_customer_contact_id()+","+							"progress_content='"+item.getProgress_content()+"',"+							"write_people='"+item.getWrite_people()+"',"+		   	 			   	"write_date='"+item.getWrite_date()+"' where crm_project_info_id="+item.getCrm_project_info_id();				return executeUpdate(sql);			}catch(Exception e){				System.out.println(e.toString());				return false;			}			finally{				DBclose();			}		}				/**		 * @author	Administrator		 * @param	sql:要更新的sql 语句		 * @return	boolean:如果执行成功返回true,否则返回false		 * @see		执行更新一条sql 语句		 */		public boolean executeUpdate(String sql){			try{				access.getConnection();				return access.executeUpdate(sql);			}			catch(Exception e){				System.out.println(e.toString());				return false;			}		}		/**		 * @author	Administrator		 * @param	sql:要查询的sql 语句		 * @return	boolean:如果执行成功返回true,否则返回false		 * @see		执行查询一条sql 语句		 */		public ResultSet executeQuery(String sql){			try			{				access.getConnection();				rs=access.executeQuery(sql);				return rs;			}			catch(Exception e){				System.out.println(e.toString());				return null;			}		}		/**		 * @author	Administrator		 * @param	无		 * @return	无		 * @see		关闭数据库操作对象		 */		public void DBclose(){			try {				access.DBclose(rs);			}			catch(Exception e) {				System.out.println(e.toString());			}		}}

⌨️ 快捷键说明

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