代写java页面

编程入门 行业动态 更新时间:2024-10-26 07:32:18

<a href=https://www.elefans.com/category/jswz/34/1743341.html style=代写java页面"/>

代写java页面

java程序设计代写代做

日期:2018-05-14 01:16

public static Collection selEmp(String param, EmployeeSelType selType) {

// 连接数据库

Connection con = ConnectionManager.getConnection();

CallableStatement cst = null;

ResultSet rs = null;

// 建一个职员列表

Collection empc = new ArrayList();

try {

String proc = "{call proc_selEmp '" + param + "','" + selType

+ "'}";

// 取得职员表数据

cst = con.prepareCall(proc);

rs = cst.executeQuery();

while (rs.next()) {

Employee emp = new Employee();

emp.setId(rs.getInt("Eid"));

emp.setName(rs.getString("Ename"));

emp.setSex(rs.getString("Esex"));

emp.setAge(rs.getInt("Eage"));

emp.setPosition(rs.getString("Eposition"));

emp.setRemark(rs.getString("Eremark"));

empc.add(emp);

}

} catch (SQLException ex) {

ex.printStackTrace();

} finally {

ConnectionManager.closeResultSet(rs);

ConnectionManager.closeStatement(cst);

ConnectionManager.closeConnection(con);

}

return empc;

}

/**

* 查找大类信息

*

* @param name

*            大类名

* @param selType

*            查找类型

* @return

*/

public static Collection selCate(String name, CateSelType selType) {

// 连接数据库

Connection con = ConnectionManager.getConnection();

CallableStatement cst = null;

ResultSet rs = null;

// 建一个类别列表

Collection cc = new ArrayList();

try {

// 取得类别表数据

cst = con.prepareCall("{call proc_selCate '" + name + "','"

+ selType + "'}");

rs = cst.executeQuery();

while (rs.next()) {

Category c = new Category();

c.setId(rs.getInt("Cid"));

c.setName(rs.getString("Cname"));

cc.add(c);

}

} catch (SQLException ex) {

ex.printStackTrace();

} finally {

ConnectionManager.closeResultSet(rs);

ConnectionManager.closeStatement(cst);

ConnectionManager.closeConnection(con);

}

return cc;

}

/**

* 查找子类信息

*

* @param param

*            存储过程参数

* @param selType

*            查找类型

* @return

*/

public static Collection selSubcate(String param, SubcateSelType selType) {

// 连接数据库

Connection con = ConnectionManager.getConnection();

CallableStatement cst = null;

ResultSet rs = null;

// 建一个子类列表

Collection scc = new ArrayList();

try {

// 取得子类表数据

cst = con.prepareCall("{call proc_selSubcate '" + param + "','"

+ selType + "'}");

rs = cst.executeQuery();

while (rs.next()) {

Subcate sc = new Subcate();

sc.setId(rs.getInt("Sid"));

sc.setName(rs.getString("Sname"));

sc.setCateId(rs.getInt("SCid"));

scc.add(sc);

}

} catch (SQLException ex) {

ex.printStackTrace();

} finally {

ConnectionManager.closeResultSet(rs);

ConnectionManager.closeStatement(cst);

ConnectionManager.closeConnection(con);

}

return scc;

}

/**

* 查找资产信息

*

* @param procName

*            存储过程名

* @param param

*            存储过程参数

* @return

*/

public static Collection selAsset(String proc, String param) {

// 连接数据库

Connection con = ConnectionManager.getConnection();

CallableStatement cst = null;

ResultSet rs = null;

// 建一个资产信息列表

Collection ac = new ArrayList();

try {

// 取得资产信息表数据

cst = con.prepareCall("{call " + proc + " '" + param + "'}");

rs = cst.executeQuery();

while (rs.next()) {

Asset a = new Asset();

a.setId(rs.getInt(1));

a.setName(rs.getString(2));

a.setCateName(rs.getString(3));

a.setSubcateName(rs.getString(4));

a.setModel(rs.getString(5));

a.setPrice(rs.getDouble(6));

a.setPurDate(rs.getString(7));

a.setStatus(rs.getString(8));

a.setUseBy(rs.getString(9));

a.setRemark(rs.getString(10));

ac.add(a);

}

} catch (SQLException ex) {

ex.printStackTrace();

} finally {

ConnectionManager.closeResultSet(rs);

ConnectionManager.closeStatement(cst);

ConnectionManager.closeConnection(con);

}

return ac;

}

/**

* 查找借出资产信息

*

* @param param

*            存储过程参数

* @param selType

*            查找类型

* @return

*/

public static Collection selLent(String param, LentSelType selType) {

// 连接数据库

Connection con = ConnectionManager.getConnection();

CallableStatement cst = null;

ResultSet rs = null;

// 建一个借出记录列表

Collection lc = new ArrayList();

try {

// 取得借出记录表数据

cst = con.prepareCall("{call proc_selLent '" + param + "','"

+ selType + "'}");

rs = cst.executeQuery();

while (rs.next()) {

Lent l = new Lent();

l.setId(rs.getInt("Lid"));

l.setAssetId(rs.getInt("LAid"));

l.setEmpId(rs.getInt("LEid"));

l.setOperatorName(rs.getString("LOname"));

l.setDate(rs.getString("Ldate"));

l.setPurpose(rs.getString("Lpurpose"));

l.setRemark(rs.getString("Lremark"));

l.setAssetName(rs.getString("Aname"));

l.setModel(rs.getString("Amodel"));

l.setSubcateName(rs.getString("Sname"));

l.setUseBy(rs.getString("Ause_by"));

lc.add(l);

}

} catch (SQLException ex) {

ex.printStackTrace();

} finally {

ConnectionManager.closeResultSet(rs);

ConnectionManager.closeStatement(cst);

ConnectionManager.closeConnection(con);

}

return lc;

}

/**

* 查找归还记录

*

* @return

*/

public static Collection selReturned() {

// 连接数据库

Connection con = ConnectionManager.getConnection();

CallableStatement cst = null;

ResultSet rs = null;

// 建一个归还记录列表

Collection rc = new ArrayList();

try {

// 取得归还记录表数据

cst = con.prepareCall("{call proc_selReturned}");

rs = cst.executeQuery();

while (rs.next()) {

Returned r = new Returned();

r.setId(rs.getInt("Rid"));

r.setAssetId(rs.getInt("RAid"));

r.setAssetName(rs.getString("RAname"));

r.setUser(rs.getString("Ruse_by"));

r.setLentDate(rs.getString("RLdate"));

r.setReturnDate(rs.getString("Rdate"));

r.setLentOname(rs.getString("RLOname"));

r.setReturnOname(rs.getString("RROname"));

r.setRemark(rs.getString("Rremark"));

rc.add(r);

}

} catch (SQLException ex) {

ex.printStackTrace();

} finally {

ConnectionManager.closeResultSet(rs);

ConnectionManager.closeStatement(cst);

ConnectionManager.closeConnection(con);

}

return rc;

}

/**

* 修改记录:包括添加、删除、修改

*

* @param strProcInvoke

*            调用存储过程的字符串

* @return

*/

public static int modifyRecord(String strProcInvoke) {

Connection con = ConnectionManager.getConnection();

try {

return con.prepareCall("{call " + strProcInvoke + "}")

.executeUpdate();

} catch (SQLException e) {

e.printStackTrace();

return 0;

} finally {

ConnectionManager.closeConnection(con);

}

}

/**

* 子类别查找类型

*

* @author Tom

*/

public enum SubcateSelType {

BY_NAME, BY_CATE_NAME

}

/**

* 大类别查找类型

*

* @author Tom

*/

public enum CateSelType {

BY_NAME, BY_HAVE_SUBCATE, ALL

}

/**

* 管理员名查找类型

*

* @author Tom

*

*/

public enum OperatorSelType {

IN_NAME, IN_NAME_PWD

}

/**

* 借出记录查找类型

*

* @author Tom

*

*/

public enum LentSelType {

BY_OPERATOR_NAME, BY_EMPLOYEE_ID, BY_ASSET_ID, ALL

}

/**

* 职员查找类型

*

* @author Tom

*

*/

public enum EmployeeSelType {

BY_NAME, BY_POSITION, ALL

}

}

更多推荐

代写java页面

本文发布于:2024-02-08 21:55:24,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1675494.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:代写   页面   java

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!