⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 goodsbusiness.java

📁 企业进销存源码
💻 JAVA
字号:
package com.business;
import java.util.HashMap;
import java.util.List;

import com.business.vo.Goods;
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 GoodsBusiness {
	public String getNameById(String id) throws Exception{
		try{
			String str = "select name from goods where id = "+id;
			DaoImp dao = new DaoImp();
			return WebTools.showEx(dao.find(str).get("NAME"));
		}catch(Exception e){
			return "";
		}
	}
	
	public void add(Goods vo) throws Exception{
		try{
			String str = "insert into Goods(name,type,memo,price,gg,xh) values('"+vo.getName()+"','"+vo.getType()+"','"+vo.getMemo()+"','"+vo.getPrice()+"','"+vo.getGg()+"','"+vo.getXh()+"')";
			DaoImp dao = new DaoImp();
			dao.insert(str);
		}catch(Exception e){
			throw e;
		}
	}
	public void edit(Goods vo) throws Exception{
		try{
			String str = "update goods set name = '"+vo.getName()+"',type = '"+vo.getType()+"',memo = '"+vo.getMemo()+"',price = '"+vo.getPrice()+"',gg = '"+vo.getGg()+"',xh = '"+vo.getXh()+"' where Id = "+vo.getId();
			DaoImp dao = new DaoImp();
			dao.insert(str);
		}catch(Exception e){
			throw e;
		}
	}
	public void remove(Goods vo) throws Exception{
		try{
			String str = "delete from Goods where Id = "+vo.getId();
			DaoImp dao = new DaoImp();
			dao.insert(str);
		}catch(Exception e){
			throw e;
		}
	} 
	
	public HashMap find(String key) throws Exception{
		try{
			String str = "select * from Goods where Id = "+key+"";
			DaoImp dao = new DaoImp();
			return dao.find(str);
		}catch(Exception e){
			return null;		
		}
	} 
	public List select()throws Exception {
		try {
			String str = "select TOP 9 * from Goods order by id desc";
			DaoImp dao = new DaoImp();
			return dao.select(str);
		} catch (Exception e) {
			return null;
		}
	}
	public String getMemo(String id) throws Exception{
		try{
			String result = "";
			String str = "select memo from goods where id = "+id;
			DaoImp dao = new DaoImp();
			result += "<table  width=100% border=0 cellpadding=0 cellspacing=0><tr><td class=min-td01 align=center>";
			result += "说明";
			result += "</td></tr>";
			result += "<tr><td class=min-td02 height=50>";
			result += WebTools.showEx(dao.find(str).get("MEMO"));			
			result += "</td></tr> ";
			result += "</table>";
			return result;
		}catch(Exception e){
			return "";
		}
	}
}

⌨️ 快捷键说明

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