pubsbo.java

来自「房产交易平台 服务器端建议代码。工厂模型。」· Java 代码 · 共 180 行

JAVA
180
字号
package com.fc.bo;

import java.util.List;

import com.fc.dao.Pubs;
import com.fc.dao.PubsDao;
import com.fc.dao.PubsFactory;
import com.fc.dao.User;
import com.fc.dao.tools.BoException;

public class PubsBo {
	public PubsBo(){}
	
	public void save(Pubs pubs) throws BoException{
		PubsDao pd=PubsFactory.getPubsDao();
		if(!pd.save(pubs)){
			throw new BoException("保存失败");
		}
	}
	
	public void modify(Pubs pubs) throws BoException{
		PubsDao pd=PubsFactory.getPubsDao();
		if(!pd.modify(pubs)){
			throw new BoException("修改失败");
		}
	}
	
	public void remove(Pubs pubs) throws BoException{
		PubsDao pd=PubsFactory.getPubsDao();
		if(!pd.delete(pubs)){
			throw new BoException("删除失败");
		}
	}
	
	public Pubs findByID(long id) throws BoException{
		PubsDao pd=PubsFactory.getPubsDao();
		Pubs temp=pd.findByID(id);
		if(temp==null){
			temp=null;
			throw new BoException("没有数据");
		}
		return temp;
		
	}
	
	public Pubs findByUser(User u) throws BoException{
		PubsDao pd=PubsFactory.getPubsDao();
		Pubs temp=pd.findByUser(u);
		if(temp==null){
			temp=null;
			throw new BoException("没有数据");
		}
		return temp;
		
	}
	
	public List findByQuyu(Pubs pubs) throws BoException{
		PubsDao pd=PubsFactory.getPubsDao();
		List temp=pd.findByQuyu(pubs);
		if(temp.size()<=0){
			temp=null;
			throw new BoException("没有数据");
		}
		return temp;
	}
	
	public List findByHuxing_Quyu(Pubs pubs) throws BoException{
		PubsDao pd=PubsFactory.getPubsDao();
		List temp=pd.findByHuxing_Quyu(pubs);
		if(temp.size()<=0){
			temp=null;
			throw new BoException("没有数据");
		}
		return temp;
	}
	
	public List findByWuyeleixing_Quyu(Pubs pubs) throws BoException{
		PubsDao pd=PubsFactory.getPubsDao();
		List temp=pd.findByWuyeleixing_Quyu(pubs);
		if(temp.size()<=0){
			temp=null;
			throw new BoException("没有数据");
		}
		return temp;
	}
	
	public List findByXiaoQu_Quyu(Pubs pubs) throws BoException{
		PubsDao pd=PubsFactory.getPubsDao();
		List temp=pd.findByXiaoQu_Quyu(pubs);
		if(temp.size()<=0){
			temp=null;
			throw new BoException("没有数据");
		}
		return temp;
	}
	
	public List findByXiaoQu_Quyu_Huxing(Pubs pubs) throws BoException{
		PubsDao pd=PubsFactory.getPubsDao();
		List temp=pd.findByXiaoQu_Quyu_Huxing(pubs);
		if(temp.size()<=0){
			temp=null;
			throw new BoException("没有数据");
		}
		return temp;
	}
	
	public List findByXiaoQu_Quyu_Wuyeleixing(Pubs pubs) throws BoException{
		PubsDao pd=PubsFactory.getPubsDao();
		List temp=pd.findByXiaoQu_Quyu_Wuyeleixing(pubs);
		if(temp.size()<=0){
			temp=null;
			throw new BoException("没有数据");
		}
		return temp;
	}
	
	public List findByXiaoQu_Quyu_Huxing_Wuyeleixing(Pubs pubs) throws BoException{
		PubsDao pd=PubsFactory.getPubsDao();
		List temp=pd.findByXiaoQu_Quyu_Huxing_Wuyeleixing(pubs);
		if(temp.size()<=0){
			temp=null;
			throw new BoException("没有数据");
		}
		return temp;
	}
	
	public List findByQuyu_Huxing_Wuyeleixing(Pubs pubs) throws BoException{
		PubsDao pd=PubsFactory.getPubsDao();
		List temp=pd.findByQuyu_Huxing_Wuyeleixing(pubs);
		if(temp.size()<=0){
			temp=null;
			throw new BoException("没有数据");
		}
		return temp;
	}
	
	public List findByXiaoQu_Wuyeleixing(Pubs pubs) throws BoException{
		PubsDao pd=PubsFactory.getPubsDao();
		List temp=pd.findByXiaoQu_Wuyeleixing(pubs);
		if(temp.size()<=0){
			temp=null;
			throw new BoException("没有数据");
		}
		return temp;
	}
	
	public List findByPubsTime(String time) throws BoException{
		PubsDao pd=PubsFactory.getPubsDao();
		List temp=pd.findByPubsTime(time);
		if(temp.size()<=0){
			temp=null;
			throw new BoException("没有数据");
		}
		return temp;
	}
	
	public List findByPubsTime() throws BoException{
		PubsDao pd=PubsFactory.getPubsDao();
		List temp=pd.findByPubsTime();
		if(temp.size()<=0){
			temp=null;
			throw new BoException("没有数据");
		}
		return temp;
	}
	
	
	public List findByType(int type) throws BoException{
		PubsDao pd=PubsFactory.getPubsDao();
		List temp=pd.findByType(type);
		if(temp.size()<=0){
			temp=null;
			throw new BoException("没有数据");
		}
		return temp;
	}
	
	
}

⌨️ 快捷键说明

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