roleresbusiness.java

来自「企业进销存源码」· Java 代码 · 共 81 行

JAVA
81
字号
package com.business;
import java.util.*;

import com.business.vo.*;
import com.dao.util.DaoImp;
import com.web.util.WebTools;
/**
 * @author Administrator
 *
 * To change this generated comment edit the template variable "typecomment":
 * Window>Preferences>Java>Templates.
 * To enable and disable the creation of type comments go to
 * Window>Preferences>Java>Code Generation.
 */
public class RoleResBusiness {
	public void add(RoleRes vo) throws Exception{
		try{
			String str = "insert into RoleRes(roleId,resId,operate) values("+vo.getRoleId()+","+vo.getResId()+",'"+vo.getOperate()+"')";
			DaoImp dao = new DaoImp();
			dao.insert(str);
		}catch(Exception e){
			throw e;
		}
	}
	
	public void removeRoleResByRoleId(String roleId) throws Exception{
		try{
			String str = "delete from RoleRes where roleId = "+roleId;
			DaoImp dao = new DaoImp();
			dao.insert(str);
		}catch(Exception e){
			throw e;
		}
	}
	
	public List getRoleListByResId(String resId){
		try{	 
			String str = "select roleId from RoleRes where resId = "+resId;
			DaoImp dao = new DaoImp();
			return dao.select(str);
		}catch(Exception e){
			return null;
		}
	}
	public RoleRes findEntityByRoleIdResId(String roleId,String resId){
		try{	 
			String str = "select roleResId ,operate from RoleRes where resId = "+resId+" and roleId = "+roleId;
			System.out.println(str);
			DaoImp dao = new DaoImp();
			HashMap map = dao.find(str);
			RoleRes result = new RoleRes();
			result.setRoleResId(WebTools.showEx(map.get("ROLERESID")));
			result.setOperate(WebTools.showEx(map.get("OPERATE")));
			return result;
		}catch(Exception e){
			return null;
		}
	}
	public String getRolResIdByRoleIdResId(String roleId,String resId){
		try {
			String str = "select roleResId from roleRes  where roleId ="+roleId+" and resId = "+resId;
			DaoImp dao = new DaoImp();
			HashMap map = dao.find(str);
			return WebTools.showEx(map.get("roleResId"));
		} catch (Exception e) {
			return "";
		}
	}
	public String getDefaultOperByRoleIdResId(String roleId,String resId){
		try {
			String str = "select operate from roleRes  where roleId ="+roleId+" and resId = "+resId;
			DaoImp dao = new DaoImp();
			HashMap map = dao.find(str);
			return WebTools.showEx(map.get("operate"));
		} catch (Exception e) {
			e.printStackTrace();
			return "";
		}
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?