版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/helloworld_1996/article/details/82503662
希尔顿大酒店项目 – 无技术难点
-- 酒店表
create table hotel0907(
id number primary key,
roomnum number,
roomtype varchar2(200),
roomfloor number,
roomstate varchar2(200),
roomprice number
)
select * from hotel0907
create sequence seq_t_hotel0907
insert into hotel0907 values(seq_t_hotel0907.nextval,101,'单人房',1,'住净',288)
--房间类型表
create table t_hotel0907_roomtype(
id number primary key,
roomtype varchar2(200)
)
select * from t_hotel0907_roomtype
create sequence seq_t_hotel0907_roomtype
insert into t_hotel0907_roomtype values(seq_t_hotel0907_roomtype.nextval,'单人房')
insert into t_hotel0907_roomtype values(seq_t_hotel0907_roomtype.nextval,'普通大床房')
insert into t_hotel0907_roomtype values(seq_t_hotel0907_roomtype.nextval,'豪华大床房')
insert into t_hotel0907_roomtype values(seq_t_hotel0907_roomtype.nextval,'商务双床房')
--楼层表
create table t_hotel0907_roomfloor(
id number primary key,
roomfloor number
)
select * from t_hotel0907_roomfloor
create sequence seq_t_hotel0907_roomfloor
insert into t_hotel0907_roomfloor values(seq_t_hotel0907_roomfloor.nextval,1)
insert into t_hotel0907_roomfloor values(seq_t_hotel0907_roomfloor.nextval,2)
insert into t_hotel0907_roomfloor values(seq_t_hotel0907_roomfloor.nextval,3)
insert into t_hotel0907_roomfloor values(seq_t_hotel0907_roomfloor.nextval,4)
--状态表
create table t_hotel0907_roomstate(
id number primary key,
roomstate varchar2(200)
)
select * from t_hotel0907_roomstate
create sequence seq_t_hotel0907_roomstate
insert into t_hotel0907_roomstate values(seq_t_hotel0907_roomstate.nextval,'空净')
insert into t_hotel0907_roomstate values(seq_t_hotel0907_roomstate.nextval,'空脏')
insert into t_hotel0907_roomstate values(seq_t_hotel0907_roomstate.nextval,'住净')
insert into t_hotel0907_roomstate values(seq_t_hotel0907_roomstate.nextval,'住脏')
-- 统计房间类型
select roomtype,count(roomtype) from hotel0907 group by roomtype
<?xml version="1.0" encoding="UTF-8" `这里写代码片`?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hao.mapper.IHotelMapper">
<select id="findHotelList" resultType="com.hao.dto.Hotel" >
select * from hotel0907
</select>
<!-- <select id="findStudentById" parameterType="int" resultType="org.gzj.dto.Student">
select * from t_student where id = #{id}
</select> -->
<select id="findTypeList" resultType="map">
select * from t_hotel0907_roomtype
</select>
<select id="findFloorList" resultType="map">
select * from t_hotel0907_roomfloor
</select>
<select id="findStateList" resultType="map">
select * from t_hotel0907_roomstate
</select>
<insert id="add" parameterType="com.hao.dto.Hotel">
insert into hotel0907 values(seq_t_hotel0907.nextval,#{roomnum},#{roomtype},#{roomfloor},#{roomstate},#{roomprice})
</insert>
<select id="findCheckList" resultType="map">
select roomtype,count(roomtype) count from hotel0907 group by roomtype
</select>
</mapper>
package com.hao.controller;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.hao.dto.Hotel;
import com.hao.service.IHotelService;
@Controller
public class HotelController {
@Autowired
private IHotelService iHotelService;
@RequestMapping("list")
public String list(HttpServletRequest request){
List<Hotel> hotelList = iHotelService.findHotelList();
request.setAttribute("hotelList", hotelList);
return "list";
}
@RequestMapping("toAdd")
public String toAdd(HttpServletRequest request){
List<Map<String, Object>> roomtypeList = iHotelService.findTypeList();
List<Map<String, Integer>> roomfloorList = iHotelService.findFloorList();
System.out.println(roomfloorList);
List<Map<String, Object>> roomstateList = iHotelService.findStateList();
request.setAttribute("roomtypeList", roomtypeList);
request.setAttribute("roomfloorList", roomfloorList);
request.setAttribute("roomstateList", roomstateList);
return "add";
}
@RequestMapping("add")
public String add(Hotel hotel){
iHotelService.add(hotel);
return "redirect:list.do";
}
@RequestMapping("checkmsg")
public String checkmsg(HttpServletRequest request){
List<Map<String, Object>> checkList = iHotelService.findCheckList();
request.setAttribute("checkList", checkList);
return "checkmsg";
}
}
他教我收余恨、免娇嗔、且自新、改性情、休恋逝水、苦海回身、早悟兰因
《锁麟囊》