finacial_daily_accountbean.java

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

JAVA
952
字号
package com.vere.finacial.bean;	import java.sql.*;	import java.util.*;	import com.vere.db.*;	import com.vere.dictionary.item.*;	import com.vere.finacial.item.*;	import com.vere.util.*;	public class Finacial_daily_accountBean	{		private ResultSet rs=null;		private int keyId;		private int totalRecord;		private Access access = null;		public Finacial_daily_accountBean()		{			try {				access=new Access();			}			catch(Exception e) {				System.out.println(e.toString());			}		}		/**		 * @author	Administrator		 * @param	无		 * @return	ArrayList:Finacial_daily_accountItem 对象的 ArrayList 数组		 * @see		取出 finacial_daily_account 表中的所有记录,每一条记录存储在一个 Finacial_daily_accountItem 对象中		 */		public List find(){			ArrayList list=new ArrayList();			try {				String sql="select * from "+T.FINACIAL_DAILY_ACCOUNT;				rs = executeQuery(sql);				while(rs.next()){					Finacial_daily_accountItem item=new Finacial_daily_accountItem();					item.setId(rs.getString("id"));					item.setIn_date(rs.getString("in_date"));					item.setCaurse(rs.getString("caurse"));					item.setDictionary_finacial_id1(rs.getString("dictionary_finacial_id1"));					item.setDictionary_finacial_id2(rs.getString("dictionary_finacial_id2"));					item.setDictionary_finacial_id3(rs.getString("dictionary_finacial_id3"));					item.setInstruction(rs.getString("instruction"));					item.setIn_price(rs.getString("in_price"));					item.setOut_price(rs.getString("out_price"));					item.setBack_price(rs.getString("back_price"));					item.setRemain_price(rs.getString("remain_price"));					item.setDeal_people(rs.getString("deal_people"));					item.setMemo(rs.getString("memo"));					item.setRegister_date(rs.getString("register_date"));					item.setRegister_username(rs.getString("register_username"));					item.setRegister_name(rs.getString("register_name"));					item.setRegister_department_id(rs.getString("register_department_id"));					item.setRegister_department_nodepath(rs.getString("register_department_nodepath"));					item.setRegister_department(rs.getString("register_department"));					item.setRegister_area_id(rs.getString("register_area_id"));					item.setRegister_area_nodepath(rs.getString("register_area_nodepath"));					item.setRegister_area(rs.getString("register_area"));					item.setIn_company(rs.getString("in_company"));					list.add(item);				}			}catch(SQLException e){				System.out.print(e.toString());			}			finally{				DBclose();			}			return list;		}		/**		 * @author	Administrator		 * @param	无		 * @return	ArrayList:Finacial_daily_accountItem 对象的 ArrayList 数组		 * @see		取出 finacial_daily_account 表中的所有记录,每一条记录存储在一个 Finacial_daily_accountItem 对象中		 */		public List findByIds(String ids){			ArrayList list=new ArrayList();			try {				String sql="select * from "+T.FINACIAL_DAILY_ACCOUNT+" where id in ("+ids+")";				rs = executeQuery(sql);				while(rs.next()){					Finacial_daily_accountItem item=new Finacial_daily_accountItem();					item.setId(rs.getString("id"));					item.setIn_date(rs.getString("in_date"));					item.setCaurse(rs.getString("caurse"));					item.setDictionary_finacial_id1(rs.getString("dictionary_finacial_id1"));					item.setDictionary_finacial_id2(rs.getString("dictionary_finacial_id2"));					item.setDictionary_finacial_id3(rs.getString("dictionary_finacial_id3"));					item.setInstruction(rs.getString("instruction"));					item.setIn_price(rs.getString("in_price"));					item.setOut_price(rs.getString("out_price"));					item.setBack_price(rs.getString("back_price"));					item.setRemain_price(rs.getString("remain_price"));					item.setDeal_people(rs.getString("deal_people"));					item.setMemo(rs.getString("memo"));					item.setRegister_date(rs.getString("register_date"));					item.setRegister_username(rs.getString("register_username"));					item.setRegister_name(rs.getString("register_name"));					item.setRegister_department_id(rs.getString("register_department_id"));					item.setRegister_department_nodepath(rs.getString("register_department_nodepath"));					item.setRegister_department(rs.getString("register_department"));					item.setRegister_area_id(rs.getString("register_area_id"));					item.setRegister_area_nodepath(rs.getString("register_area_nodepath"));					item.setRegister_area(rs.getString("register_area"));					item.setIn_company(rs.getString("in_company"));					list.add(item);				}			}catch(SQLException e){				System.out.print(e.toString());			}			finally{				DBclose();			}			return list;		}		/**		 * @author	Administrator		 * @param	id: 当前要修改记录的id号		 * @return	Finacial_daily_accountItem		 * @see		取出 finacial_daily_account 表中的指定id号的一条记录存储在一个 Finacial_daily_accountItem 对象中		 */		public Finacial_daily_accountItem find(String id){			try {				String sql="select  "+T.FINACIAL_DAILY_ACCOUNT+".* ,a1.name as  a1_name ,a2.name as  a2_name ,a3.name as  a3_name  from   "+T.FINACIAL_DAILY_ACCOUNT+" ,"+T.DICTIONARY_FINACIAL+" as a1 ,"+T.DICTIONARY_FINACIAL+" as a2 ,"+T.DICTIONARY_FINACIAL+" as a3  where "+T.FINACIAL_DAILY_ACCOUNT+".dictionary_finacial_id1 = a1.id  and "+T.FINACIAL_DAILY_ACCOUNT+".dictionary_finacial_id2 = a2.id  and "+T.FINACIAL_DAILY_ACCOUNT+".dictionary_finacial_id3 = a3.id  and   "+T.FINACIAL_DAILY_ACCOUNT+".id="+id;				rs = executeQuery(sql);				Finacial_daily_accountItem item=new Finacial_daily_accountItem();				if(rs.next()){					item.setId(rs.getString("id"));					item.setIn_date(rs.getString("in_date"));					item.setCaurse(rs.getString("caurse"));					item.setDictionary_finacial_id1(rs.getString("dictionary_finacial_id1"));					item.setDictionary_finacial_id2(rs.getString("dictionary_finacial_id2"));					item.setDictionary_finacial_id3(rs.getString("dictionary_finacial_id3"));					item.setInstruction(rs.getString("instruction"));					item.setIn_price(rs.getString("in_price"));					item.setOut_price(rs.getString("out_price"));					item.setBack_price(rs.getString("back_price"));					item.setRemain_price(rs.getString("remain_price"));					item.setDeal_people(rs.getString("deal_people"));					item.setMemo(rs.getString("memo"));					item.setRegister_date(rs.getString("register_date"));					item.setRegister_username(rs.getString("register_username"));					item.setRegister_name(rs.getString("register_name"));					item.setRegister_department_id(rs.getString("register_department_id"));					item.setRegister_department_nodepath(rs.getString("register_department_nodepath"));					item.setRegister_department(rs.getString("register_department"));					item.setRegister_area_id(rs.getString("register_area_id"));					item.setRegister_area_nodepath(rs.getString("register_area_nodepath"));					item.setRegister_area(rs.getString("register_area"));					Dictionary_finacialItem dictionary_finacialItem1=new Dictionary_finacialItem();					dictionary_finacialItem1.setName(rs.getString("a1_name"));					item.setDictionary_finacialItem1(dictionary_finacialItem1);					Dictionary_finacialItem dictionary_finacialItem2=new Dictionary_finacialItem();					dictionary_finacialItem2.setName(rs.getString("a2_name"));					item.setDictionary_finacialItem2(dictionary_finacialItem2);					Dictionary_finacialItem dictionary_finacialItem3=new Dictionary_finacialItem();					dictionary_finacialItem3.setName(rs.getString("a3_name"));					item.setDictionary_finacialItem3(dictionary_finacialItem3);					item.setIn_company(rs.getString("in_company"));				}				return item;			}catch(SQLException e){				System.out.print(e.toString());				return null;			}			finally{				DBclose();			}		}		/**		 * @author	Administrator		 * @param	aItem: 查询的数据对象,page: 翻页时的当前页,pageSize: 翻页的每页显示的记录条数		 * @return	ArrayList:Finacial_daily_accountItem 对象的 ArrayList 数组		 * @see		查出 finacial_daily_account 表中的指定数据,页号,页大小的每一条记录存储在一个 Finacial_daily_accountItem 对象中		 */		public List find(Finacial_daily_accountItem aItem,int page,int pageSize){			int nextPageSize=pageSize*(page-1);			ArrayList list=new ArrayList();			try {				boolean b=false;				StringBuffer filter=new StringBuffer();				String fvalue=null;				fvalue=aItem.getIn_date();				if(fvalue!=null &&   fvalue.length()>0)				{					if(b) filter.append(" and");					filter.append(" DATEDIFF(day,"+T.FINACIAL_DAILY_ACCOUNT+".in_date,'"+fvalue+"')=0 ");					b=true;				}				fvalue=aItem.getCaurse();				if(fvalue!=null &&   fvalue.length()>0)				{					if(b) filter.append(" and");					filter.append(" "+T.FINACIAL_DAILY_ACCOUNT+".caurse like '%"+fvalue+"%' ");					b=true;				}				fvalue=aItem.getDictionary_finacial_id1();				if(fvalue!=null &&   fvalue.length()>0)				{					if(b) filter.append(" and");					filter.append(" "+T.FINACIAL_DAILY_ACCOUNT+".dictionary_finacial_id1 ="+fvalue+" ");					b=true;				}				fvalue=aItem.getDictionary_finacial_id2();				if(fvalue!=null &&   fvalue.length()>0)				{					if(b) filter.append(" and");					filter.append(" "+T.FINACIAL_DAILY_ACCOUNT+".dictionary_finacial_id2 ="+fvalue+" ");					b=true;				}				fvalue=aItem.getDictionary_finacial_id3();				if(fvalue!=null &&   fvalue.length()>0)				{					if(b) filter.append(" and");					filter.append(" "+T.FINACIAL_DAILY_ACCOUNT+".dictionary_finacial_id3 ="+fvalue+" ");					b=true;				}				fvalue=aItem.getInstruction();				if(fvalue!=null &&   fvalue.length()>0)				{					if(b) filter.append(" and");					filter.append(" "+T.FINACIAL_DAILY_ACCOUNT+".instruction like '%"+fvalue+"%' ");					b=true;				}				fvalue=aItem.getIn_price();				if(fvalue!=null &&   fvalue.length()>0)				{					if(b) filter.append(" and");					filter.append(" "+T.FINACIAL_DAILY_ACCOUNT+".in_price ="+fvalue+" ");					b=true;				}				fvalue=aItem.getOut_price();				if(fvalue!=null &&   fvalue.length()>0)				{					if(b) filter.append(" and");					filter.append(" "+T.FINACIAL_DAILY_ACCOUNT+".out_price ="+fvalue+" ");					b=true;				}				fvalue=aItem.getBack_price();				if(fvalue!=null &&   fvalue.length()>0)				{					if(b) filter.append(" and");					filter.append(" "+T.FINACIAL_DAILY_ACCOUNT+".back_price ="+fvalue+" ");					b=true;				}				fvalue=aItem.getRemain_price();				if(fvalue!=null &&   fvalue.length()>0)				{					if(b) filter.append(" and");					filter.append(" "+T.FINACIAL_DAILY_ACCOUNT+".remain_price ="+fvalue+" ");					b=true;				}				fvalue=aItem.getDeal_people();				if(fvalue!=null &&   fvalue.length()>0)				{					if(b) filter.append(" and");					filter.append(" "+T.FINACIAL_DAILY_ACCOUNT+".deal_people like '%"+fvalue+"%' ");					b=true;				}				fvalue=aItem.getMemo();				if(fvalue!=null &&   fvalue.length()>0)				{					if(b) filter.append(" and");					filter.append(" "+T.FINACIAL_DAILY_ACCOUNT+".memo like '%"+fvalue+"%' ");					b=true;				}				fvalue=aItem.getRegister_date();				if(fvalue!=null &&   fvalue.length()>0)				{					if(b) filter.append(" and");					filter.append(" DATEDIFF(day,"+T.FINACIAL_DAILY_ACCOUNT+".register_date,'"+fvalue+"')=0 ");					b=true;				}				fvalue=aItem.getRegister_username();				if(fvalue!=null &&   fvalue.length()>0)				{					if(b) filter.append(" and");					filter.append(" "+T.FINACIAL_DAILY_ACCOUNT+".register_username like '%"+fvalue+"%' ");					b=true;				}				fvalue=aItem.getRegister_name();				if(fvalue!=null &&   fvalue.length()>0)				{					if(b) filter.append(" and");					filter.append(" "+T.FINACIAL_DAILY_ACCOUNT+".register_name like '%"+fvalue+"%' ");					b=true;				}				fvalue=aItem.getRegister_department_id();				if(fvalue!=null &&   fvalue.length()>0)				{					if(b) filter.append(" and");					filter.append(" "+T.FINACIAL_DAILY_ACCOUNT+".register_department_id ="+fvalue+" ");					b=true;				}				fvalue=aItem.getRegister_department_nodepath();				if(fvalue!=null &&   fvalue.length()>0)				{					if(b) filter.append(" and");					filter.append("  ','+"+T.FINACIAL_DAILY_ACCOUNT+".register_department_nodepath+',' like ',%"+fvalue+"%,'   ");					b=true;				}				fvalue=aItem.getRegister_department();				if(fvalue!=null &&   fvalue.length()>0)				{					if(b) filter.append(" and");					filter.append(" "+T.FINACIAL_DAILY_ACCOUNT+".register_department like '%"+fvalue+"%' ");					b=true;				}				fvalue=aItem.getRegister_area_id();				if(fvalue!=null &&   fvalue.length()>0)				{					if(b) filter.append(" and");

⌨️ 快捷键说明

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