📄 clientinfodaoimpl.java
字号:
pstmt = conn.prepareStatement(str);
rst = pstmt.executeQuery();
while (rst.next()) {
ClientInfo clientInfo = new ClientInfo();
clientInfo.setClientId(rst.getString(1));
clientInfo.setClientName(rst.getString(2));
clientInfo.setLinkman(rst.getString("linkman"));
clientInfo.setRivetPhone(rst.getString("rivet_phone"));
clientInfo.setMobilePhone(rst.getString("mobile_phone"));
clientInfo.setClientState(rst.getString("client_state"));
clientInfo.setServerMode(rst.getString("server_mode"));
clientInfo.setEmpId(rst.getString("emp_id"));
clientInfoList.add(clientInfo);
}
} catch (SQLException e) {
// TODO 自动生成 catch
e.printStackTrace();
} finally {
try {
if (rst != null) {
rst.close();
}
if (pstmt != null) {
pstmt.close();
}
if (conn != null) {
conn.close();
}
} catch (Exception e) {
// TODO: handle exception
}
}
return clientInfoList;
}
public void deptManagerForceQuitClientInfo(ClientInfo clientInfo) {
// TODO 自动生成方法存根
try {
clientInfo.setServerMode("放弃");
getHibernateTemplate().update(clientInfo);
} catch (HibernateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public ArrayList<ClientInfo> showMenberSortAscClientInfo(int start,
int count, String empId, String sortFiled) {
ArrayList<ClientInfo> clientInfoList = new ArrayList<ClientInfo>();
String str = "select *from client_info where emp_id ='" + empId + "' order by " + sortFiled + " asc" + " limit " + start + ",5";
Connection conn = getHibernateTemplate().getSessionFactory().openSession().connection();
PreparedStatement pstmt = null;
ResultSet rst = null;
try {
pstmt = conn.prepareStatement(str);
rst = pstmt.executeQuery();
while (rst.next()) {
ClientInfo clientInfo = new ClientInfo();
clientInfo.setClientId(rst.getString(1));
clientInfo.setClientName(rst.getString(2));
clientInfo.setLinkman(rst.getString("linkman"));
clientInfo.setRivetPhone(rst.getString("rivet_phone"));
clientInfo.setMobilePhone(rst.getString("mobile_phone"));
clientInfo.setClientState(rst.getString("client_state"));
clientInfo.setServerMode(rst.getString("server_mode"));
clientInfo.setEmpId(rst.getString("emp_id"));
clientInfoList.add(clientInfo);
}
} catch (SQLException e) {
// TODO 自动生成 catch
e.printStackTrace();
} finally {
try {
if (rst != null) {
rst.close();
}
if (pstmt != null) {
pstmt.close();
}
if (conn != null) {
conn.close();
}
} catch (Exception e) {
// TODO: handle exception
}
}
return clientInfoList;
}
public ArrayList<ClientInfo> showMenberSortDescClientInfo(int start,
int count, String empId, String sortFiled) {
// TODO 自动生成方法存根
ArrayList<ClientInfo> clientInfoList = new ArrayList<ClientInfo>();
String str = "select *from client_info where emp_id ='" + empId + "' order by " + sortFiled + " desc" + " limit " + start + ",5";
Connection conn = getHibernateTemplate().getSessionFactory().openSession().connection();
PreparedStatement pstmt = null;
ResultSet rst = null;
try {
pstmt = conn.prepareStatement(str);
rst = pstmt.executeQuery();
while (rst.next()) {
ClientInfo clientInfo = new ClientInfo();
clientInfo.setClientId(rst.getString(1));
clientInfo.setClientName(rst.getString(2));
clientInfo.setLinkman(rst.getString("linkman"));
clientInfo.setRivetPhone(rst.getString("rivet_phone"));
clientInfo.setMobilePhone(rst.getString("mobile_phone"));
clientInfo.setClientState(rst.getString("client_state"));
clientInfo.setServerMode(rst.getString("server_mode"));
clientInfo.setEmpId(rst.getString("emp_id"));
clientInfoList.add(clientInfo);
}
} catch (SQLException e) {
// TODO 自动生成 catch
e.printStackTrace();
} finally {
try {
if (rst != null) {
rst.close();
}
if (pstmt != null) {
pstmt.close();
}
if (conn != null) {
conn.close();
}
} catch (Exception e) {
// TODO: handle exception
}
}
return clientInfoList;
}
public ArrayList<ClientInfo> showMenberMyClientInfoByName(int start,
int count, String clientName, String empId) {
ArrayList<ClientInfo> clientInfoList = new ArrayList<ClientInfo>();
String str = "select *from client_info where client_name like '%" + clientName + "%' and emp_id = '" + empId + "' limit " + start + ",5";
Connection conn = getHibernateTemplate().getSessionFactory().openSession().connection();
PreparedStatement pstmt = null;
ResultSet rst = null;
try {
pstmt = conn.prepareStatement(str);
rst = pstmt.executeQuery();
while (rst.next()) {
ClientInfo clientInfo = new ClientInfo();
clientInfo.setClientId(rst.getString(1));
clientInfo.setClientName(rst.getString(2));
clientInfo.setLinkman(rst.getString("linkman"));
clientInfo.setRivetPhone(rst.getString("rivet_phone"));
clientInfo.setMobilePhone(rst.getString("mobile_phone"));
clientInfo.setClientState(rst.getString("client_state"));
clientInfo.setServerMode(rst.getString("server_mode"));
clientInfo.setEmpId(rst.getString("emp_id"));
clientInfoList.add(clientInfo);
}
} catch (SQLException e) {
// TODO 自动生成 catch
e.printStackTrace();
} finally {
try {
if (rst != null) {
rst.close();
}
if (pstmt != null) {
pstmt.close();
}
if (conn != null) {
conn.close();
}
} catch (Exception e) {
// TODO: handle exception
}
}
return clientInfoList;
}
public ArrayList<ClientInfo> findMemberAllQuitClientInfo(int start) {
ArrayList<ClientInfo> clientInfoList = new ArrayList<ClientInfo>();
String str = "select *from client_info where server_mode = '放弃' limit " + start + ",5";
Connection conn = getHibernateTemplate().getSessionFactory().openSession().connection();
PreparedStatement pstmt = null;
ResultSet rst = null;
try {
pstmt = conn.prepareStatement(str);
rst = pstmt.executeQuery();
while (rst.next()) {
ClientInfo clientInfo = new ClientInfo();
clientInfo.setClientId(rst.getString(1));
clientInfo.setClientName(rst.getString(2));
clientInfo.setLinkman(rst.getString("linkman"));
clientInfo.setRivetPhone(rst.getString("rivet_phone"));
clientInfo.setMobilePhone(rst.getString("mobile_phone"));
clientInfo.setClientState(rst.getString("client_state"));
clientInfo.setServerMode(rst.getString("server_mode"));
clientInfo.setEmpId(rst.getString("emp_id"));
clientInfoList.add(clientInfo);
}
} catch (SQLException e) {
// TODO 自动生成 catch
e.printStackTrace();
} finally {
try {
if (rst != null) {
rst.close();
}
if (pstmt != null) {
pstmt.close();
}
if (conn != null) {
conn.close();
}
} catch (Exception e) {
// TODO: handle exception
}
}
return clientInfoList;
}
public int getTotalRecordQuitClientInfo() {
String serverMode = "放弃";
String sql = "select count(*) from ClientInfo where server_mode = ?";
int count = 0;
count = Integer.parseInt(getHibernateTemplate().find(sql, serverMode).get(0).toString());
return count;
}
public ClientInfo findClientInfoByClientName(String clientName) {
List list = (getHibernateTemplate().find("from ClientInfo where client_name = ?", clientName));
ClientInfo clientInfo = null;
if (list.size() != 0) {
clientInfo = (ClientInfo) list.get(0);
}
return clientInfo;
}
public ArrayList<ClientInfo> showAllMenberClientInfo(int start) {
// TODO 自动生成方法存根
ArrayList<ClientInfo> clientInfoList = new ArrayList<ClientInfo>();
String str = "select *from client_info limit " + start + ",20";
Connection conn = getHibernateTemplate().getSessionFactory().openSession().connection();
PreparedStatement pstmt = null;
ResultSet rst = null;
try {
pstmt = conn.prepareStatement(str);
rst = pstmt.executeQuery();
while (rst.next()) {
ClientInfo clientInfo = new ClientInfo();
clientInfo.setClientId(rst.getString(1));
clientInfo.setClientName(rst.getString(2));
clientInfo.setLinkman(rst.getString("linkman"));
clientInfo.setRivetPhone(rst.getString("rivet_phone"));
clientInfo.setMobilePhone(rst.getString("mobile_phone"));
clientInfo.setClientState(rst.getString("client_state"));
clientInfo.setServerMode(rst.getString("server_mode"));
clientInfo.setEmpId(rst.getString("emp_id"));
clientInfoList.add(clientInfo);
}
} catch (SQLException e) {
// TODO 自动生成 catch
e.printStackTrace();
} finally {
try {
if (rst != null) {
rst.close();
}
if (pstmt != null) {
pstmt.close();
}
if (conn != null) {
conn.close();
}
} catch (Exception e) {
// TODO: handle exception
}
}
return clientInfoList;
}
public int getTotalRecordAllClient() {
// TODO 自动生成方法存根
String sql = "select count(*) from ClientInfo";
int count = 0;
count = Integer.parseInt(getHibernateTemplate().find(sql).get(0).toString());
return count;
}
public ClientInfo findOneClientByLxId(String networkId) {
// TODO 自动生成方法存根
ClientInfo clientInfo = new ClientInfo();
String sql = "from ClientInfo where network_id = ?";
List<ClientInfo> list = null;
list = getHibernateTemplate().find(sql, networkId);
if (list.size() > 0) {
clientInfo = list.get(0);
}
return clientInfo;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -