📄 modeldao.java
字号:
package com.accp.oa.dao.imple;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import com.accp.oa.common.Constants;
import com.accp.oa.common.DbUtil;
import com.accp.oa.dao.inface.*;
import com.accp.oa.bean.*;
/*
* 此类是用于
* 对表tb_model进行操作的
*/
public class ModelDAO implements BaseDAO {
public boolean add(Object obj) {
return false;
}
public boolean delete(Object obj) {
return false;
}
public boolean delete(int id) {
return false;
}
public boolean delete(String ag0) {
return false;
}
public Object search(Object obj) {
return null;
}
public int search(String ag0, String ag1) {
return 0;
}
public Object search(int id) {
return null;
}
/*
* 此方法用于查询出给定角色的 所有权限
*
* @see com.accp.oa.dao.inface.BaseDAO#search(java.lang.String)
*/
public ArrayList search(String roesId) {
int id = Integer.parseInt(roesId);
ArrayList models = new ArrayList();
Connection con = null;
PreparedStatement stmt = null;
ResultSet rs = null;
try {
con = DbUtil.connectToDB();
stmt = con.prepareStatement(Constants.SEARCH_RIGHT);
stmt.setInt(1, id);
rs = stmt.executeQuery();
while (rs.next()) {
Model model = new Model();
model.setId(rs.getInt(1));
model.setModelName(rs.getString(2));
models.add(model);
}
} catch (Exception ex) {
} finally {
try {
rs.close();
stmt.close();
con.close();
} catch (Exception ex) {
return null;
}
}
return models;
}
/*
* 查询出给定人员的所有权限
* @see com.accp.oa.dao.inface.BaseDAO#search(int, int)
*/
public ArrayList search(int perId, int age1) {
ArrayList models = new ArrayList();
Connection con = null;
PreparedStatement stmt = null;
ResultSet rs = null;
try {
con = DbUtil.connectToDB();
stmt = con.prepareStatement(Constants.SEARCH_RIGHT_BY_PERID);
stmt.setInt(1, perId);
rs = stmt.executeQuery();
while (rs.next()) {
Model model = new Model();
model.setId(rs.getInt(1));
model.setModelName(rs.getString(2));
models.add(model);
}
} catch (Exception ex) {
} finally {
try {
rs.close();
stmt.close();
con.close();
} catch (Exception ex) {
return null;
}
}
return models;
}
public ArrayList search() {
return null;
}
public boolean update(Object obj) {
return false;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -