public interface BuildingPicDao {
	public void insertBuildingPic(BuildingPic u);
	public int deleteBuildingPic(BuildingPic u);
	public int updateBuildingPic(BuildingPic u);
	public BuildingPic selectBuildingPic(BuildingPic u);
	public List<String> selectBuildingPicByBuildingId(int id);
	public List<BuildingPic> selectAll();
} public interface BuyHouseCommentDao {
	
	public void insertBuyHouseComment(BuyHouseComment u);
	public int deleteBuyHouseComment(BuyHouseComment u);
	public int updateBuyHouseComment(BuyHouseComment u);
	public BuyHouseComment selectBuyHouseComment(BuyHouseComment u);
	public List<BuyHouseComment> selectAllByUserId(int id);
	public List<BuyHouseComment> selectAllByBuildingId(int id);
} public interface UserCollectBuildingDao {
	public void insertUserCollectBuilding(UserCollectBuilding u);
	public int deleteUserCollectBuilding(UserCollectBuilding u);
	public List<UserCollectBuilding> selectAllByUserId(UserCollectBuilding u);
} public interface UserDao {
	public void insertUser(User u);
	public int deleteUser(User u);
	public int updateUser(User u);
	public User selectUserByUserId(User u);
	public User selectUserByUserNameAndPassword(User u);
	public User selectUserByUserName(User u);
	public List<User> selectAllUser(); 
}
 public class BuildingInfo {
	
	private String buildingAddress;
	private int buildingId;
	private String buildingName;
	private String buildingDecoration;
	private int buildingMaxArea;
	private int buildingMinArea;
	private String buildingNeighbourhood;
	private int buildingReferencePrice;
	private String buildingSaleState;
	private Date buildingTimeHanded;
	
	public String getBuildingAddress() {
		return buildingAddress;
	}
	public void setBuildingAddress(String buildingAddress) {
		this.buildingAddress = buildingAddress;
	}
	public int getBuildingId() {
		return buildingId;
	}
	public void setBuildingId(int buildingId) {
		this.buildingId = buildingId;
	}
	public String getBuildingName() {
		return buildingName;
	}
	public void setBuildingName(String buildingName) {
		this.buildingName = buildingName;
	}
	public String getBuildingDecoration() {
		return buildingDecoration;
	}
	public void setBuildingDecoration(String buildingDecoration) {
		this.buildingDecoration = buildingDecoration;
	}
	public int getBuildingMaxArea() {
		return buildingMaxArea;
	}
	public void setBuildingMaxArea(int buildingMaxArea) {
		this.buildingMaxArea = buildingMaxArea;
	}
	public int getBuildingMinArea() {
		return buildingMinArea;
	}
	public void setBuildingMinArea(int buildingMinArea) {
		this.buildingMinArea = buildingMinArea;
	}
	public String getBuildingNeighbourhood() {
		return buildingNeighbourhood;
	}
	public void setBuildingNeighbourhood(String buildingNeighbourhood) {
		this.buildingNeighbourhood = buildingNeighbourhood;
	}
	public int getBuildingReferencePrice() {
		return buildingReferencePrice;
	}
	public void setBuildingReferencePrice(int buildingReferencePrice) {
		this.buildingReferencePrice = buildingReferencePrice;
	}
	public String getBuildingSaleState() {
		return buildingSaleState;
	}
	public void setBuildingSaleState(String buildingSaleState) {
		this.buildingSaleState = buildingSaleState;
	}
	public Date getBuildingTimeHanded() {
		return buildingTimeHanded;
	}
	public void setBuildingTimeHanded(Date buildingTimeHanded) {
		this.buildingTimeHanded = buildingTimeHanded;
	}
} public class BuyHouseComment {
	private int buildingId;
	private int userId;
	private int buyHouseCommentId;
	private String userComment;
	private Date userCommentDate;
	
	public int getBuildingId() {
		return buildingId;
	}
	public void setBuildingId(int buildingId) {
		this.buildingId = buildingId;
	}
	public int getUserId() {
		return userId;
	}
	public void setUserId(int userId) {
		this.userId = userId;
	}
	public int getBuyHouseCommentId() {
		return buyHouseCommentId;
	}
	public void setBuyHouseCommentId(int buyHouseCommentId) {
		this.buyHouseCommentId = buyHouseCommentId;
	}
	public String getUserComment() {
		return userComment;
	}
	public void setUserComment(String userComment) {
		this.userComment = userComment;
	}
	public Date getUserCommentDate() {
		return userCommentDate;
	}
	public void setUserCommentDate(Date userCommentDate) {
		this.userCommentDate = userCommentDate;
	}
}
 public class Collect {
	public int houseId;
	public String houseAddress;
	public String province;
	public String region;
	public String name;
	public String decoration;
	public String picUrl;
	public int price;
	public int room;
	public int commentId;
	public String comment;
} public class User {
	
	private int userId;
	private String username;
	private String name;
	private String userPassword;
	private String userSex;
	private String userEmail;
	private String userPhoneNumber;
	private String userPhoto;
	
	public int getUserId() {
		return userId;
	}
	
	public void setUserId(int userId) {
		this.userId = userId;
	}
	
	public String getUsername() {
		return username;
	}
	
	public void setUsername(String username) {
		this.username = username;
	}
	
	public String getName() {
		return name;
	}
	
	public void setName(String name) {
		this.name = name;
	}
	
	public String getUserPassword() {
		return userPassword;
	}
	
	public void setUserPassword(String userPassword) {
		this.userPassword = userPassword;
	}
	
	public String getUserSex() {
		return userSex;
	}
	
	public void setUserSex(String userSex) {
		this.userSex = userSex;
	}
	
	public String getUserEmail() {
		return userEmail;
	}
	
	public void setUserEmail(String userEmail) {
		this.userEmail = userEmail;
	}
	
	public String getUserPhoneNumber() {
		return userPhoneNumber;
	}
	
	public void setUserPhoneNumber(String userPhoneNumber) {
		this.userPhoneNumber = userPhoneNumber;
	}
	
	public String getUserPhoto() {
		return userPhoto;
	}
	
	public void setUserPhoto(String userPhoto) {
		this.userPhoto = userPhoto;
	}
} public class UserCollectBuilding {
	
	private int userId;
	private int buildingId;
	private Date collectTime;
	
	public int getUserId() {
		return userId;
	}
	public void setUserId(int userId) {
		this.userId = userId;
	}
	public int getBuildingId() {
		return buildingId;
	}
	public void setBuildingId(int buildingId) {
		this.buildingId = buildingId;
	}
	public Date getCollectTime() {
		return collectTime;
	}
	public void setCollectTime(Date collectTime) {
		this.collectTime = collectTime;
	}
} public interface BuildingSearch {
	// 地址、最低价、最高价作为关键字获得对应的楼盘列表
	public List<BuildingInfo> searchBuilding(String Address, int lowPrice, int highPrice);
	public BuildingInfo searchBuildingById(int id);
}
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
import com.easyhousing.dao.BuildingPicDao;
import com.easyhousing.dao.BuyHouseCommentDao;
import com.easyhousing.dao.UserCollectBuildingDao;
import com.easyhousing.dao.UserDao;
import com.easyhousing.model.BuildingInfo;
import com.easyhousing.model.BuyHouseComment;
import com.easyhousing.model.Collect;
import com.easyhousing.model.User;
import com.easyhousing.model.UserCollectBuilding;
import com.easyhousing.service.BuildingSearch;
package com.easyhousing.controller;




/**
 * 
 * @author 王辰辰
 * 显示楼盘具体信息
 */
@Controller
public class buildingDetailController {
	
	@Autowired
	private BuildingSearch buildingSearch;
	
	@Autowired
	private BuyHouseCommentDao buyHouseCommentDao;
	
	@Autowired
	private UserDao userDao;
	
	@Autowired
	private UserCollectBuildingDao userCollectBuildingDao;
	
	@Autowired
	private BuildingPicDao buildingPicDao;
	
	//显示租房具体信息
	@RequestMapping(value="buildingDetail.do", method={RequestMethod.GET,RequestMethod.POST})
	public ModelAndView buildingDetail(HttpServletRequest request) {
		Cookie[] cookie = request.getCookies();
		HttpSession session = request.getSession();
		ModelAndView modelAndView = new ModelAndView();
		
		//获取显示楼盘的id
		int buildingId = 0;
		for(Cookie iCookie : cookie) {
			String name = iCookie.getName();
			String value = iCookie.getValue();
			if(name.equals("buildingId")) {
				buildingId = Integer.parseInt(value);
			}
		}
		BuildingInfo buildingInfo = buildingSearch.searchBuildingById(buildingId);