📄 qxglroledao.java
字号:
package gov.gdlt.ssgly.taxcore.taxdao.qxgl;
import gov.gdlt.ssgly.taxcore.comm.dao.*;
import gov.gdlt.ssgly.taxcore.taxevent.qxgl.*;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.sql.Connection;
import gov.gdlt.ssgly.taxcore.comm.servicelocator.JDBCLocator;
public class QXGLroleDAO extends BaseDataAccessObject {
private int jsDm;
private String jsMc;
private String jsDesc;
private String jgjc;
private String swjgDm;
public QXGLroleDAO() {
}
/* 添加角色以及角色功能树菜单 */
public boolean addRole(QXGLroleVO roleVO) {
this.getSqlMapClient(); //用父类方法获取SqlMap对象
Connection connection = null;
try {
connection = JDBCLocator.getInstance().getJDBCConnection();
connection.setAutoCommit(false);
sqlMap.setUserConnection(connection);
// 获取新的角色代码
roleVO.setJsDm(((Integer)sqlMap.queryForObject("T_QXGL_JS.getNewJsDm", null)).intValue());
// 插入角色记录
sqlMap.insert("T_QXGL_JS.insertRole", roleVO);
// 插入角色-功能树记录
ArrayList gnDmList = roleVO.getGnDmList();
QXGLrole2menuDAO role2menuDAO = new QXGLrole2menuDAO();
for (int i = 0; i < gnDmList.size(); i++) {
role2menuDAO.setJsDm(roleVO.getJsDm());
role2menuDAO.setGnDm((new Integer((String)gnDmList.get(i))).intValue());
sqlMap.insert("T_QXGL_JS.insertJsGns", role2menuDAO);
}
connection.commit();
} catch (SQLException e) {
try {
if (connection != null) {
connection.rollback();
}
} catch (SQLException ex) {
}
return false;
} finally {
try {
if (connection != null) {
connection.close();
}
} catch (SQLException e) {
}
}
return true;
}
/* 更新角色以及角色功能树菜单 */
public boolean updateRole(QXGLroleVO roleVO) {
this.getSqlMapClient(); //用父类方法获取SqlMap对象
Connection connection = null;
try {
connection = JDBCLocator.getInstance().getJDBCConnection();
connection.setAutoCommit(false);
sqlMap.setUserConnection(connection);
// 更新角色记录
sqlMap.update("T_QXGL_JS.updateRole", roleVO);
// 删除旧的角色-功能树记录
sqlMap.delete("T_QXGL_JS.deleteJsGns", new Integer(roleVO.getJsDm()));
// 插入新的角色-功能树记录
ArrayList gnDmList = roleVO.getGnDmList();
QXGLrole2menuDAO role2menuDAO = new QXGLrole2menuDAO();
for (int i = 0; i < gnDmList.size(); i++) {
role2menuDAO.setJsDm(roleVO.getJsDm());
role2menuDAO.setGnDm((new Integer((String)gnDmList.get(i))).intValue());
sqlMap.insert("T_QXGL_JS.insertJsGns", role2menuDAO);
}
connection.commit();
} catch (SQLException e) {
try {
if (connection != null) {
connection.rollback();
}
} catch (SQLException ex) {
}
return false;
} finally {
try {
if (connection != null) {
connection.close();
}
} catch (SQLException e) {
}
}
return true;
}
/* 删除角色以及角色功能树菜单 */
public boolean deleteRole(int jsDm) {
// 删除角色表记录
super.delete("T_QXGL_JS.deleteRole", new Integer(jsDm));
// 删除角色-功能树记录
super.delete("T_QXGL_JS.deleteJsGns", new Integer(jsDm));
return true;
}
public List getAllRoles() {
return selectAll("T_QXGL_JS.selectAllRole", null);
}
public List getRolesInQx(String swryDm) {
return selectAll("T_QXGL_JS.selectAllRoleInQx", swryDm);
}
public List getRoleByJsDm(int jsDm) {
return selectAll("T_QXGL_JS.getRoleByJsDm", new Integer(jsDm));
}
public void setJsDm(int jsDm) {
this.jsDm = jsDm;
}
public void setJsMc(String jsMc) {
this.jsMc = jsMc;
}
public void setJsDesc(String jsDesc) {
this.jsDesc = jsDesc;
}
public void setJgjc(String jgjc) {
this.jgjc = jgjc;
}
public void setSwjgDm(String swjgDm) {
this.swjgDm = swjgDm;
}
public int getJsDm() {
return jsDm;
}
public String getJsMc() {
return jsMc;
}
public String getJsDesc() {
return jsDesc;
}
public String getJgjc() {
return jgjc;
}
public String getSwjgDm() {
return swjgDm;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -