📄 financialaccountdao.java
字号:
/*
* Created on 2007-6-21
* 资金模块
*/
package com.funddeal.model.dao.financial_account;
import java.util.ArrayList;
import java.util.Collection;
import javax.servlet.RequestDispatcher;
import net.sf.hibernate.HibernateException;
import net.sf.hibernate.Query;
import com.funddeal.app_exception.BaseException;
import com.funddeal.base.PublicFunction;
import com.funddeal.base.SessionCommit;
import com.funddeal.model.pojo.client.Client;
import com.funddeal.model.pojo.custom_entity.SearchParamEntity;
import com.funddeal.model.pojo.financial_account.FinancialAccount;
/**
* @author <b>zhangxianxin</b>
* 资金模块的数据交互类,提供对数据库中资金模块的管理
*/
public class FinancialAccountDAO extends BaseException{
/**
*
*/
private static final long serialVersionUID = 1L;
private SessionCommit session;
public static String errorMsg="";
RequestDispatcher reqDispatcher = null; //请求转发对象
public FinancialAccountDAO()
{
try {
session=new SessionCommit();
}catch (HibernateException e) {
e.printStackTrace();
errorMsg=e.getMessage();
}
}
/**
* <b>给正常客户开户资金帐号</b>
* @param fA:资金实体
* @return 用户资金帐号的主键
* @throws HibernateException
*/
public String openFinancialAccount(FinancialAccount fA) throws HibernateException
{
return session.getSessionAdd(fA);
}
/**
* <b>删除资金帐号</b>
* @param fA:资金实体
* @return 返回成功与否
*/
public boolean delteFinancialAccount(FinancialAccount fA)
{
errorMsg="";
boolean bl= session.getSessionDelete(fA);
if(!bl)errorMsg=SessionCommit.errorMsg;
return bl;
}
/**
* <b>修改客户的资金帐号信息</b>
* @param fA:资金实体
* @return 返回成功与否
*/
public boolean updatFinancialAccount(FinancialAccount fA)
{
errorMsg="";
boolean bl=session.getSessionUpdate(fA);
if(!bl)errorMsg=SessionCommit.errorMsg;
return bl;
}
public Collection searchClient(SearchParamEntity spe)
{
errorMsg="";
Query query=null;
Collection<Client> col=new ArrayList<Client>();
PublicFunction pf=new PublicFunction();
query=pf.search(spe);
try {
int cut=query.list().size();
if(cut!=0)
{
for(int i=0;i<cut;i++)
{
Client client=(Client)query.list().get(i);
col.add(client);
}
}
} catch (HibernateException e) {
e.printStackTrace();
errorMsg=e.getMessage();
}
return col;
}
/**
* <b>查询方法</b><br>
* 传入实体参数spe中封装了三个值。
* @param SearchParamEntity spe
* @return Collection 对象
*/
public Collection searchFinancialAccount(SearchParamEntity spe)
{
errorMsg="";
Query query=null;
Collection<FinancialAccount> col=new ArrayList<FinancialAccount>();
PublicFunction pf=new PublicFunction();
query=pf.search(spe);
try {
int cut=query.list().size();
if(cut!=0)
{
for(int i=0;i<cut;i++)
{
FinancialAccount fa=new FinancialAccount();
fa=(FinancialAccount)query.list().get(i);
col.add(fa);
}
}
} catch (HibernateException e) {
e.printStackTrace();
errorMsg=e.getMessage();
}
return col;
}
public Collection searchFinancialAccount(String hql)
{
errorMsg="";
Query query=null;
Collection<FinancialAccount> col=new ArrayList<FinancialAccount>();
PublicFunction pf=new PublicFunction();
query=pf.search(hql);
try {
int cut=query.list().size();
if(cut!=0)
{
for(int i=0;i<cut;i++)
{
FinancialAccount fa=(FinancialAccount)query.list().get(i);
col.add(fa);
}
}else{
if(!PublicFunction.errorMsg.equals(""))
errorMsg=PublicFunction.errorMsg;
else
errorMsg="该资金帐号不存在!";
}
} catch (HibernateException e) {
errorMsg=e.getMessage();
e.printStackTrace();
}
return col;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -