📄 operconfigaccount.java
字号:
package com.doone.fj1w.fjmgr.useroperinfo;
import com.doone.data.DacClient;
import com.doone.data.DataTable;
import com.doone.util.FileLogger;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2005</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class Operconfigaccount {
private String saccountcode=null;
private String saccountname=null;
private DacClient _dbClient=null;
private int pageSize=20;//每页记录数
private int rowCount=0;//查询数据库中的记录数
private int pageCount=0;//页数
public Operconfigaccount() {
try {
_dbClient = new DacClient();
}
catch (Exception ex) {
FileLogger.getLogger().error(ex);
}
}
public void setaccountcode(String saccountcode)
{this.saccountcode=saccountcode;}
public void setaccountname(String saccountname)
{this.saccountname =saccountname;}
public int insertconfigaccount(){
int doExp = 0;
try {
// XXX 进行sao中字段的有效性检查。
String Sql_Ins_Showinfo = "INSERT INTO Ts_ConfigAccount(ACCOUNTCODE, ACCOUNTNAME) VALUES(?,?)";
Object[] value = new Object[2];
value[0] = saccountcode; //地市编码
value[1] = saccountname; //信息名称
_dbClient.beginTransaction(10000);
doExp = _dbClient.executeUpdate(Sql_Ins_Showinfo,1000,value);
_dbClient.endTransaction(true);
}catch (Exception ex) {
FileLogger.getLogger().error(ex);
try{_dbClient.endTransaction(false);}
catch(Exception ex1){}
}
return doExp;
}
public int deleteconfigaccount(String tablename,String id){
int doExp = 0;
try {
// XXX 进行sao中字段的有效性检查。
String Sql_Del_Showinfo = "delete from "+tablename+" where "+id+"=?";
Object[] value = new Object[1];
value[0] = saccountcode; //序号
_dbClient.beginTransaction(10000);
doExp = _dbClient.executeUpdate(Sql_Del_Showinfo,1000,value);
_dbClient.endTransaction(true);
}catch (Exception ex) {
FileLogger.getLogger().error(ex);
try{_dbClient.endTransaction(false);}
catch(Exception ex1){}
}
return doExp;
}
public int updateconfigaccount(){
int doExp = 0;
try {
// XXX 进行sao中字段的有效性检查。
String Sql_Upd_Showinfo = "update Ts_ConfigAccount set ACCOUNTNAME=? where ACCOUNTCODE=?";
Object[] value = new Object[2];
value[0] = saccountname; //
value[1] = saccountcode; //地市编码
_dbClient.beginTransaction(10000);
doExp = _dbClient.executeUpdate(Sql_Upd_Showinfo,1000,value);
_dbClient.endTransaction(true);
}catch (Exception ex) {
FileLogger.getLogger().error(ex);
try{_dbClient.endTransaction(false);}
catch(Exception ex1){}
}
return doExp;
}
public DataTable queryconfigaccount(String tablename,String field1,String filed1value){
DataTable dt = null;
try {
String S_SELECT_TICKET =
"select * from "+tablename+" where "+field1+"=?";
Object[] obbb = new Object[1];
obbb[0] = filed1value;
_dbClient.beginTransaction(10000);
dt = _dbClient.executeQuery(S_SELECT_TICKET, obbb);
_dbClient.endTransaction(true);
} catch (Exception ex) {
FileLogger.getLogger().error(ex);
try{_dbClient.endTransaction(false);}
catch(Exception ex1){}
}
return dt;
}
public String qryexistconfigaccount(String tablename,String field1,String field2){
String doExp = "0";
try {
String S_SELECT_TICKET =
"select count(*) from "+tablename+" where 1=? and "+field1+"=?";
Object[] obbb = new Object[2];
obbb[0] = "1";
obbb[1] = saccountcode;
_dbClient.beginTransaction(10000);
doExp = _dbClient.getStringFromSqlQuery(S_SELECT_TICKET, obbb);
_dbClient.endTransaction(true);
} catch (Exception ex) {
FileLogger.getLogger().error(ex);
try{_dbClient.endTransaction(false);}
catch(Exception ex1){}
}
return doExp;
}
//获得页数 参数:表名
public int getPageCount(String tablename){
DataTable dt=null;
try{
String str = "select count(*) count from "+tablename ;
_dbClient.beginTransaction(10000);
dt=_dbClient.executeQuery(str);
rowCount=dt.getRow(0).getInt("count");
if (rowCount % pageSize == 0)
pageCount = rowCount / pageSize;
else
pageCount = rowCount / pageSize + 1;
_dbClient.endTransaction(true);
}
catch(Exception ex){
FileLogger.getLogger().error(ex);
try{_dbClient.endTransaction(false);}
catch(Exception ex1){}
}
return pageCount;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -