RoleService.java
资源名称:shihua.rar [点击查看]
上传用户:zghglow
上传日期:2022-08-09
资源大小:27227k
文件大小:2k
源码类别:
WEB源码(ASP,PHP,...)
开发平台:
JavaScript
- package com.chinacannel.xlchemical.service;
- import com.chinacannel.common.TranUtil;
- import com.chinacannel.common.CommonDAO;
- import org.apache.commons.logging.LogFactory;
- import org.apache.commons.logging.Log;
- import com.chinacannel.common.DAOException;
- import com.chinacannel.entity.Role;
- import java.util.List;
- public class RoleService extends TranUtil {
- private CommonDAO dao = new CommonDAO();
- private static Log log = LogFactory.getLog(RoleService.class);
- public boolean AddRole(Role role) {
- try {
- return dao.createObject(role);
- } catch (DAOException ex) {
- log.error(ex.getMessage(), ex);
- return false;
- }
- }
- public boolean UpdateRole(Role role) {
- try {
- return dao.updateObject(role);
- } catch (DAOException ex) {
- log.error(ex.getMessage(), ex);
- return false;
- }
- }
- public boolean DeleteRole(Role role) {
- try {
- return dao.removeObject(role);
- } catch (DAOException ex) {
- log.error(ex.getMessage(), ex);
- return false;
- }
- }
- public Role GetRoleById(Long Id) {
- try {
- return (Role) dao.loadObject(Id, Role.class);
- } catch (DAOException ex) {
- log.error(ex.getMessage(), ex);
- return null;
- }
- }
- public List GetAllRole() {
- try {
- return dao.loadObjectListBySQL(
- "from Role");
- } catch (DAOException ex) {
- log.error(ex.getMessage(), ex);
- return null;
- }
- }
- }