resourcebusiness.java

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

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

import com.business.vo.Resource;
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 ResourceBusiness {
	public String getNameById(String id) throws Exception{
		try{
			String str = "select resName from resource where resid = "+id;
			DaoImp dao = new DaoImp();
			return WebTools.showEx(dao.find(str).get("RESNAME"));
		}catch(Exception e){
			return "";
		}
	}
	
	public void add(Resource vo) throws Exception{
		try{
			String str = "insert into Resource(resName,resUrl,parentId) values('"+vo.getResName()+"','"+vo.getResUrl()+"',"+WebTools.paserInt(vo.getParentId())+")";
			DaoImp dao = new DaoImp();
			dao.insert(str);
		}catch(Exception e){
			throw e;
		}
	}
	public void edit(Resource vo) throws Exception{
		try{
			String str = "update resource set resName = '"+vo.getResName()+"',resUrl = '"+vo.getResUrl()+"',parentid="+WebTools.paserInt(vo.getParentId())+" where resId = "+vo.getResId();
			DaoImp dao = new DaoImp();
			dao.insert(str);
		}catch(Exception e){
			throw e;
		}
	}
	public void remove(Resource vo) throws Exception{
		try{
			String str = "delete from Resource where resId = "+vo.getResId();
			DaoImp dao = new DaoImp();
			dao.insert(str);
		}catch(Exception e){
			throw e;
		}
	} 
	
	public HashMap find(String key) throws Exception{
		try{
			String str = "select * from Resource where resId = "+key+"";
			DaoImp dao = new DaoImp();
			return dao.find(str);
		}catch(Exception e){
			return null;
		}
	} 
	
	public List getFirstResList(){
		try{	 
			String str = "select * from Resource where parentId = 0 order by resSeq";
			DaoImp dao = new DaoImp();
			return dao.select(str);
		}catch(Exception e){
			return null;
		}
	}
	public List getChildResListByParentId(String parentId){
		try{	 
			String str = "select * from Resource where  parentId = "+parentId+" order by resSeq";
			DaoImp dao = new DaoImp();
			return dao.select(str);
		}catch(Exception e){
			return null;
		}
	}
}

⌨️ 快捷键说明

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