diff --git a/src/com/nf/controller/DeleteOrderByIdServlet.java b/src/com/nf/controller/home/DeleteOrderByIdServlet.java similarity index 91% rename from src/com/nf/controller/DeleteOrderByIdServlet.java rename to src/com/nf/controller/home/DeleteOrderByIdServlet.java index 828d5e782db1e704be702b48200cdceec58791d4..872b03255d2f437d54ec29404bc1e10607f39ab2 100644 --- a/src/com/nf/controller/DeleteOrderByIdServlet.java +++ b/src/com/nf/controller/home/DeleteOrderByIdServlet.java @@ -1,6 +1,7 @@ -package com.nf.controller; +package com.nf.controller.home; import com.google.gson.Gson; +import com.nf.controller.BaseServlet; import com.nf.dao.OrderInfoDao; import com.nf.dao.impl.OrderInfoDaoImpl; import com.nf.util.GsonUtil; @@ -18,7 +19,7 @@ import java.util.Map; * 编写servlet,实现根据订单ID删除订单 */ @WebServlet("/api/DeleteOrderByIdServlet.do") -public class DeleteOrderByIdServlet extends BaseServlet{ +public class DeleteOrderByIdServlet extends BaseServlet { @Override protected void doDelete(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { BufferedReader reader= req.getReader(); diff --git a/src/com/nf/controller/OrderAddServlet.java b/src/com/nf/controller/home/OrderAddServlet.java similarity index 93% rename from src/com/nf/controller/OrderAddServlet.java rename to src/com/nf/controller/home/OrderAddServlet.java index f0cb6efbadeec0c9589a660a7cfdb16ddaa38dae..ad0f2d61d86f2c636f809640ba61988e067c81bc 100644 --- a/src/com/nf/controller/OrderAddServlet.java +++ b/src/com/nf/controller/home/OrderAddServlet.java @@ -1,6 +1,7 @@ -package com.nf.controller; +package com.nf.controller.home; import com.google.gson.Gson; +import com.nf.controller.BaseServlet; import com.nf.dao.OrderInfoDao; import com.nf.dao.impl.OrderInfoDaoImpl; import com.nf.entity.OrderInfo; @@ -16,7 +17,7 @@ import java.io.PrintWriter; * 编写servlet,实现添加订单 */ @WebServlet("/api/OrderAddServlet.do") -public class OrderAddServlet extends BaseServlet{ +public class OrderAddServlet extends BaseServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String filmName = req.getParameter("filmName"); diff --git a/src/com/nf/controller/SelectFilmByIdServlet.java b/src/com/nf/controller/home/SelectFilmByIdServlet.java similarity index 88% rename from src/com/nf/controller/SelectFilmByIdServlet.java rename to src/com/nf/controller/home/SelectFilmByIdServlet.java index 70de1b1d2d8b55fdf10bf45dd1344305c17daedd..b22950c6f9b79c05165ecc901d0647755e07b134 100644 --- a/src/com/nf/controller/SelectFilmByIdServlet.java +++ b/src/com/nf/controller/home/SelectFilmByIdServlet.java @@ -1,6 +1,7 @@ -package com.nf.controller; +package com.nf.controller.home; import com.google.gson.Gson; +import com.nf.controller.BaseServlet; import com.nf.dao.FilmInfoDao; import com.nf.dao.impl.FilmInfoDaoImpl; import com.nf.entity.FilmInfo; @@ -16,7 +17,7 @@ import java.io.PrintWriter; * 编写servle,实现通过影片ID 查询电影 */ @WebServlet("/api/SelectFilmByIdServlet.do") -public class SelectFilmByIdServlet extends BaseServlet{ +public class SelectFilmByIdServlet extends BaseServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { int id= Integer.parseInt(req.getParameter("filmId")); diff --git a/src/com/nf/controller/home/SelectFilmsByLikeServlet.java b/src/com/nf/controller/home/SelectFilmsByLikeServlet.java new file mode 100644 index 0000000000000000000000000000000000000000..1ba5bea07c07e11b924397f0129ce7d5d2a0f1e8 --- /dev/null +++ b/src/com/nf/controller/home/SelectFilmsByLikeServlet.java @@ -0,0 +1,36 @@ +package com.nf.controller.home; + +import com.google.gson.Gson; +import com.nf.controller.BaseServlet; +import com.nf.dao.FilmInfoDao; +import com.nf.dao.impl.FilmInfoDaoImpl; +import com.nf.entity.FilmInfo; + +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.io.PrintWriter; +import java.util.List; + +/** + * 编写servlet,实现影片的模糊查询 + */ +@WebServlet("/api/SelectFilmsByLikeServlet.do") +public class SelectFilmsByLikeServlet extends BaseServlet { + @Override + protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { + String cond=req.getParameter("cond"); + + FilmInfoDao dao =new FilmInfoDaoImpl(); + List list= dao.selectByLike(cond); + + resp.setContentType("application/json;charset=utf-8"); + PrintWriter out = resp.getWriter(); + + out.print(new Gson().toJson(successJson(list))); + out.flush(); + out.close(); + } +} diff --git a/src/com/nf/controller/home/SelectNotShowsFilmServlet.java b/src/com/nf/controller/home/SelectNotShowsFilmServlet.java new file mode 100644 index 0000000000000000000000000000000000000000..1ff08d804aea22e6f46414fb1d3dda7c122caa84 --- /dev/null +++ b/src/com/nf/controller/home/SelectNotShowsFilmServlet.java @@ -0,0 +1,35 @@ +package com.nf.controller.home; + +import com.google.gson.Gson; +import com.nf.controller.BaseServlet; +import com.nf.dao.FilmInfoDao; +import com.nf.dao.impl.FilmInfoDaoImpl; +import com.nf.entity.FilmInfo; + +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.io.PrintWriter; +import java.util.List; + +/** + * 编写servlet,实现查询所有未上映的电影 + */ +@WebServlet("/api/SelectNotShowsFilmServlet.do") +public class SelectNotShowsFilmServlet extends BaseServlet { + @Override + protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { + FilmInfoDao dao=new FilmInfoDaoImpl(); + + List list= dao.selectNotShows(); + + resp.setContentType("application/json;charset=utf-8"); + PrintWriter out = resp.getWriter(); + + out.print(new Gson().toJson(successJson(list))); + out.flush(); + out.close(); + } +} diff --git a/src/com/nf/controller/SelectOrderByIdServlet.java b/src/com/nf/controller/home/SelectOrderByIdServlet.java similarity index 88% rename from src/com/nf/controller/SelectOrderByIdServlet.java rename to src/com/nf/controller/home/SelectOrderByIdServlet.java index 58e0a77a735683073c440b0ff03bc25a4924711f..a247d574ad2e675c471aee179b019487ca8ad0db 100644 --- a/src/com/nf/controller/SelectOrderByIdServlet.java +++ b/src/com/nf/controller/home/SelectOrderByIdServlet.java @@ -1,6 +1,7 @@ -package com.nf.controller; +package com.nf.controller.home; import com.google.gson.Gson; +import com.nf.controller.BaseServlet; import com.nf.dao.OrderInfoDao; import com.nf.dao.impl.OrderInfoDaoImpl; import com.nf.entity.OrderInfo; @@ -17,7 +18,7 @@ import java.util.List; * 编写servlet,实现通过订单ID 查询订单 */ @WebServlet("/api/SelectOrderByIdServlet.do") -public class SelectOrderByIdServlet extends BaseServlet{ +public class SelectOrderByIdServlet extends BaseServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { int id= Integer.parseInt(req.getParameter("orderId")); diff --git a/src/com/nf/controller/SelectOrdersByUserIdServlet.java b/src/com/nf/controller/home/SelectOrdersByUserIdServlet.java similarity index 88% rename from src/com/nf/controller/SelectOrdersByUserIdServlet.java rename to src/com/nf/controller/home/SelectOrdersByUserIdServlet.java index 3dd42b850e732beb6a4072c408c340d628b5c7a0..90fe41be623c4746af5b0145655b43b805030582 100644 --- a/src/com/nf/controller/SelectOrdersByUserIdServlet.java +++ b/src/com/nf/controller/home/SelectOrdersByUserIdServlet.java @@ -1,6 +1,7 @@ -package com.nf.controller; +package com.nf.controller.home; import com.google.gson.Gson; +import com.nf.controller.BaseServlet; import com.nf.dao.OrderInfoDao; import com.nf.dao.impl.OrderInfoDaoImpl; import com.nf.vo.OrdersVo; @@ -17,7 +18,7 @@ import java.util.List; * 编写servlet,实现根据用户ID 查询其所有订单 */ @WebServlet("/api/SelectOrdersByUserIdServlet.do") -public class SelectOrdersByUserIdServlet extends BaseServlet{ +public class SelectOrdersByUserIdServlet extends BaseServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { int id= Integer.parseInt(req.getParameter("userId")); diff --git a/src/com/nf/controller/SelectSeatsByShowIdServlet.java b/src/com/nf/controller/home/SelectSeatsByShowIdServlet.java similarity index 92% rename from src/com/nf/controller/SelectSeatsByShowIdServlet.java rename to src/com/nf/controller/home/SelectSeatsByShowIdServlet.java index 6e563cb53008e510ff57d8fcd9a38efdf8c93f57..bb76070acba06b645d000bae7ba5933276dd5a62 100644 --- a/src/com/nf/controller/SelectSeatsByShowIdServlet.java +++ b/src/com/nf/controller/home/SelectSeatsByShowIdServlet.java @@ -1,6 +1,7 @@ -package com.nf.controller; +package com.nf.controller.home; import com.google.gson.Gson; +import com.nf.controller.BaseServlet; import com.nf.dao.SeatInfoDao; import com.nf.dao.SeatRowVoDao; import com.nf.dao.impl.SeatInfoDaoImpl; @@ -20,7 +21,7 @@ import java.util.List; * 编写servlet,实现根据放映ID 查询其场次影厅的座位,并以二维数组的json格式返回 */ @WebServlet("/api/SelectSeatsByShowIdServlet.do") -public class SelectSeatsByShowIdServlet extends BaseServlet{ +public class SelectSeatsByShowIdServlet extends BaseServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { int showId= Integer.parseInt(req.getParameter("showId")); diff --git a/src/com/nf/controller/SelectShowsByFilmIdServlet.java b/src/com/nf/controller/home/SelectShowsByFilmIdServlet.java similarity index 92% rename from src/com/nf/controller/SelectShowsByFilmIdServlet.java rename to src/com/nf/controller/home/SelectShowsByFilmIdServlet.java index 05143c5fbcbe604155c29263b3c486ae5ecb932b..2881b70ee4140f458bff4651deae889728dee13a 100644 --- a/src/com/nf/controller/SelectShowsByFilmIdServlet.java +++ b/src/com/nf/controller/home/SelectShowsByFilmIdServlet.java @@ -1,6 +1,7 @@ -package com.nf.controller; +package com.nf.controller.home; import com.google.gson.Gson; +import com.nf.controller.BaseServlet; import com.nf.dao.ShowDateVoDao; import com.nf.dao.ShowInfoDao; import com.nf.dao.impl.ShowDateVoDaoImpl; @@ -20,7 +21,7 @@ import java.util.List; * 编写servlet,实现根据影片ID 查询出所有的放映计划,并以二维数组的json格式返回 */ @WebServlet("/api/SelectShowsByFilmIdServlet.do") -public class SelectShowsByFilmIdServlet extends BaseServlet{ +public class SelectShowsByFilmIdServlet extends BaseServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { int id= Integer.parseInt(req.getParameter("filmId")); diff --git a/src/com/nf/controller/SelectShowsFilmServlet.java b/src/com/nf/controller/home/SelectShowsFilmServlet.java similarity index 87% rename from src/com/nf/controller/SelectShowsFilmServlet.java rename to src/com/nf/controller/home/SelectShowsFilmServlet.java index 910af309fb65e93594d2eba9dcacefb8c56f6043..10399bfda80051f68ceeb54bf188da0e2cb761e9 100644 --- a/src/com/nf/controller/SelectShowsFilmServlet.java +++ b/src/com/nf/controller/home/SelectShowsFilmServlet.java @@ -1,6 +1,7 @@ -package com.nf.controller; +package com.nf.controller.home; import com.google.gson.Gson; +import com.nf.controller.BaseServlet; import com.nf.dao.FilmInfoDao; import com.nf.dao.impl.FilmInfoDaoImpl; import com.nf.entity.FilmInfo; @@ -17,7 +18,7 @@ import java.util.List; * 编写servle,实现查询所有已上映电影 */ @WebServlet("/api/SelectShowsFilmServlet.do") -public class SelectShowsFilmServlet extends BaseServlet{ +public class SelectShowsFilmServlet extends BaseServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { FilmInfoDao dao=new FilmInfoDaoImpl(); diff --git a/src/com/nf/controller/SelectTicketInfoByShowIdServlet.java b/src/com/nf/controller/home/SelectTicketInfoByShowIdServlet.java similarity index 93% rename from src/com/nf/controller/SelectTicketInfoByShowIdServlet.java rename to src/com/nf/controller/home/SelectTicketInfoByShowIdServlet.java index fe62ccbc49f785468f593c1a0482b7cc6be8c34b..545e690373332b710e31047cde7668c0300917c1 100644 --- a/src/com/nf/controller/SelectTicketInfoByShowIdServlet.java +++ b/src/com/nf/controller/home/SelectTicketInfoByShowIdServlet.java @@ -1,6 +1,7 @@ -package com.nf.controller; +package com.nf.controller.home; import com.google.gson.Gson; +import com.nf.controller.BaseServlet; import com.nf.dao.TicketVoDao; import com.nf.dao.impl.TicketVoDaoImpl; import com.nf.vo.TicketVo; @@ -16,7 +17,7 @@ import java.io.PrintWriter; * 编写servlet ,实现根据放映ID 查询其放映场次的相关信息(多表查询) */ @WebServlet("/api/SelectTicketInfoByShowIdServlet.do") -public class SelectTicketInfoByShowIdServlet extends BaseServlet{ +public class SelectTicketInfoByShowIdServlet extends BaseServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { int showId= Integer.parseInt(req.getParameter("showId")); diff --git a/src/com/nf/controller/UpdateOrderStatusByIdServlet.java b/src/com/nf/controller/home/UpdateOrderStatusByIdServlet.java similarity index 91% rename from src/com/nf/controller/UpdateOrderStatusByIdServlet.java rename to src/com/nf/controller/home/UpdateOrderStatusByIdServlet.java index a9b7181e19e446196620d935a3eea5ff8c3e22ba..dd58ba63531f510fef075d4bc2976509ea1a57cc 100644 --- a/src/com/nf/controller/UpdateOrderStatusByIdServlet.java +++ b/src/com/nf/controller/home/UpdateOrderStatusByIdServlet.java @@ -1,6 +1,7 @@ -package com.nf.controller; +package com.nf.controller.home; import com.google.gson.Gson; +import com.nf.controller.BaseServlet; import com.nf.dao.OrderInfoDao; import com.nf.dao.impl.OrderInfoDaoImpl; import com.nf.util.GsonUtil; @@ -18,7 +19,7 @@ import java.util.Map; * 编写servlet,实现根据订单ID 修改订单的支付状态 */ @WebServlet("/api/UpdateOrderStatusByIdServlet.do") -public class UpdateOrderStatusByIdServlet extends BaseServlet{ +public class UpdateOrderStatusByIdServlet extends BaseServlet { @Override protected void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { BufferedReader reader= req.getReader(); diff --git a/src/com/nf/controller/UserUpdatePassServlet.java b/src/com/nf/controller/home/UserUpdatePassServlet.java similarity index 93% rename from src/com/nf/controller/UserUpdatePassServlet.java rename to src/com/nf/controller/home/UserUpdatePassServlet.java index 8a608eeaee4973f4bcf338f48fe03a39192c6dad..72ebba17ab50b80a233e067f302773683e656e82 100644 --- a/src/com/nf/controller/UserUpdatePassServlet.java +++ b/src/com/nf/controller/home/UserUpdatePassServlet.java @@ -1,6 +1,7 @@ -package com.nf.controller; +package com.nf.controller.home; import com.google.gson.Gson; +import com.nf.controller.BaseServlet; import com.nf.dao.UserInfoDao; import com.nf.dao.impl.UserInfoDaoImpl; import com.nf.util.GsonUtil; @@ -18,7 +19,7 @@ import java.util.Map; * 编写servlet程序,实现用户修改密码 */ @WebServlet("/api/UserUpdatePassServlet.do") -public class UserUpdatePassServlet extends BaseServlet{ +public class UserUpdatePassServlet extends BaseServlet { @Override protected void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { BufferedReader reader=req.getReader(); diff --git a/src/com/nf/controller/UserUpdatePersonServlet.java b/src/com/nf/controller/home/UserUpdatePersonServlet.java similarity index 92% rename from src/com/nf/controller/UserUpdatePersonServlet.java rename to src/com/nf/controller/home/UserUpdatePersonServlet.java index c3173dfc7d9174f7ced97275d3b1c15f3f6c8344..3b87fad37d9bf8a289fca52b867d697c49739742 100644 --- a/src/com/nf/controller/UserUpdatePersonServlet.java +++ b/src/com/nf/controller/home/UserUpdatePersonServlet.java @@ -1,6 +1,7 @@ -package com.nf.controller; +package com.nf.controller.home; import com.google.gson.Gson; +import com.nf.controller.BaseServlet; import com.nf.dao.UserInfoDao; import com.nf.dao.impl.UserInfoDaoImpl; import com.nf.util.GsonUtil; @@ -18,7 +19,7 @@ import java.util.Map; * 编写servlet程序,实现用户修改信息 */ @WebServlet("/api/UserUpdatePersonServlet.do") -public class UserUpdatePersonServlet extends BaseServlet{ +public class UserUpdatePersonServlet extends BaseServlet { @Override protected void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { BufferedReader reader=req.getReader(); diff --git a/src/com/nf/controller/LoginServlet.java b/src/com/nf/controller/login/LoginServlet.java similarity index 97% rename from src/com/nf/controller/LoginServlet.java rename to src/com/nf/controller/login/LoginServlet.java index a96cde82868eaf5080574911ad4a1e75aea21a5a..eb49416c52e7167eeeab52dabd158a8aadd58b20 100644 --- a/src/com/nf/controller/LoginServlet.java +++ b/src/com/nf/controller/login/LoginServlet.java @@ -1,6 +1,7 @@ -package com.nf.controller; +package com.nf.controller.login; import com.google.gson.Gson; +import com.nf.controller.BaseServlet; import com.nf.dao.AdminInfoDao; import com.nf.dao.UserInfoDao; import com.nf.dao.impl.AdminInfoDaoImpl; diff --git a/src/com/nf/controller/UserCheckServlet.java b/src/com/nf/controller/login/UserCheckServlet.java similarity index 88% rename from src/com/nf/controller/UserCheckServlet.java rename to src/com/nf/controller/login/UserCheckServlet.java index 49ba2246932997059ac97e9ea6b3dff0b878e262..bc7aeddf3e90e7fb66f80460d7e38660b5654d4b 100644 --- a/src/com/nf/controller/UserCheckServlet.java +++ b/src/com/nf/controller/login/UserCheckServlet.java @@ -1,6 +1,7 @@ -package com.nf.controller; +package com.nf.controller.login; import com.google.gson.Gson; +import com.nf.controller.BaseServlet; import com.nf.dao.UserInfoDao; import com.nf.dao.impl.UserInfoDaoImpl; import com.nf.entity.UserInfo; @@ -16,7 +17,7 @@ import java.io.PrintWriter; * 编写servle,实现用户注册时验证其账号名是否存在 */ @WebServlet("/api/UserCheckServlet.do") -public class UserCheckServlet extends BaseServlet{ +public class UserCheckServlet extends BaseServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String name=req.getParameter("userName"); diff --git a/src/com/nf/controller/UserRegisterServlet.java b/src/com/nf/controller/login/UserRegisterServlet.java similarity index 90% rename from src/com/nf/controller/UserRegisterServlet.java rename to src/com/nf/controller/login/UserRegisterServlet.java index 10d7c9d5d1f10814924bb8b52097dd424d959945..87528bc43420565a284dc0e73213a020ae8f5837 100644 --- a/src/com/nf/controller/UserRegisterServlet.java +++ b/src/com/nf/controller/login/UserRegisterServlet.java @@ -1,6 +1,7 @@ -package com.nf.controller; +package com.nf.controller.login; import com.google.gson.Gson; +import com.nf.controller.BaseServlet; import com.nf.dao.UserInfoDao; import com.nf.dao.impl.UserInfoDaoImpl; @@ -15,7 +16,7 @@ import java.io.PrintWriter; * 编写servle,实现用户注册 */ @WebServlet("/api/UserRegisterServlet.do") -public class UserRegisterServlet extends BaseServlet{ +public class UserRegisterServlet extends BaseServlet { @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String name=req.getParameter("username"); diff --git a/src/com/nf/controller/FilmListServlet.java b/src/com/nf/controller/manage/FilmListServlet.java similarity index 88% rename from src/com/nf/controller/FilmListServlet.java rename to src/com/nf/controller/manage/FilmListServlet.java index ede042a93eaf725b88a511e1d430f51c99134067..313fcf97d42b4fc2340c28dabf861a48377d77a9 100644 --- a/src/com/nf/controller/FilmListServlet.java +++ b/src/com/nf/controller/manage/FilmListServlet.java @@ -1,6 +1,7 @@ -package com.nf.controller; +package com.nf.controller.manage; import com.google.gson.Gson; +import com.nf.controller.BaseServlet; import com.nf.dao.FilmInfoDao; import com.nf.dao.impl.FilmInfoDaoImpl; import com.nf.entity.FilmInfo; @@ -17,7 +18,7 @@ import java.util.List; * 编写servlet程序,实现查询所有电影 */ @WebServlet("/api/FilmListServlet.do") -public class FilmListServlet extends BaseServlet{ +public class FilmListServlet extends BaseServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { FilmInfoDao dao=new FilmInfoDaoImpl(); diff --git a/src/com/nf/controller/HallDeleteServlet.java b/src/com/nf/controller/manage/HallDeleteServlet.java similarity index 91% rename from src/com/nf/controller/HallDeleteServlet.java rename to src/com/nf/controller/manage/HallDeleteServlet.java index 72fdd84f87b87965c7b27d998cfa9fc6c1542a95..8a8535889ea9bb5086d099d1cc22c71349a96388 100644 --- a/src/com/nf/controller/HallDeleteServlet.java +++ b/src/com/nf/controller/manage/HallDeleteServlet.java @@ -1,6 +1,7 @@ -package com.nf.controller; +package com.nf.controller.manage; import com.google.gson.Gson; +import com.nf.controller.BaseServlet; import com.nf.dao.HallInfoDao; import com.nf.dao.impl.HallInfoDaoImpl; import com.nf.util.GsonUtil; @@ -18,7 +19,7 @@ import java.util.Map; * 编写servlet,实现根据影厅Id 删除影厅 */ @WebServlet("/api/HallDeleteServlet.do") -public class HallDeleteServlet extends BaseServlet{ +public class HallDeleteServlet extends BaseServlet { @Override protected void doDelete(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { BufferedReader reader= req.getReader(); diff --git a/src/com/nf/controller/HallListServlet.java b/src/com/nf/controller/manage/HallListServlet.java similarity index 88% rename from src/com/nf/controller/HallListServlet.java rename to src/com/nf/controller/manage/HallListServlet.java index 6f3d933813263984707822e977f5595e1640c4cd..7475c3389c0c53503631755cf5f95d7e7e4c4c44 100644 --- a/src/com/nf/controller/HallListServlet.java +++ b/src/com/nf/controller/manage/HallListServlet.java @@ -1,6 +1,7 @@ -package com.nf.controller; +package com.nf.controller.manage; import com.google.gson.Gson; +import com.nf.controller.BaseServlet; import com.nf.dao.HallInfoDao; import com.nf.dao.impl.HallInfoDaoImpl; import com.nf.entity.HallInfo; @@ -17,7 +18,7 @@ import java.util.List; * 编写servlet程序,实现查询所有影厅 */ @WebServlet("/api/HallListServlet.do") -public class HallListServlet extends BaseServlet{ +public class HallListServlet extends BaseServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { HallInfoDao dao=new HallInfoDaoImpl(); diff --git a/src/com/nf/dao/FilmInfoDao.java b/src/com/nf/dao/FilmInfoDao.java index 20d5d12f4111a7680a068386958bf24fdfd17606..b89f27afc06132aafe2d3c2aa21a566489910865 100644 --- a/src/com/nf/dao/FilmInfoDao.java +++ b/src/com/nf/dao/FilmInfoDao.java @@ -17,11 +17,23 @@ public interface FilmInfoDao { */ public List selectShows(); + /** + * 查询所有未上映的电影 + * @return + */ + public List selectNotShows(); /** * 根据ID 查询电影 * @return */ public FilmInfo selectById(int filmId); + /** + * 模糊查询 + * @param cond + * @return + */ + public List selectByLike(String cond); + } diff --git a/src/com/nf/dao/impl/FilmInfoDaoImpl.java b/src/com/nf/dao/impl/FilmInfoDaoImpl.java index 9061a799bf60dfaa829bf3827138492ee401ea55..c71c2d2fa2c769396a5c4344814074af326d266b 100644 --- a/src/com/nf/dao/impl/FilmInfoDaoImpl.java +++ b/src/com/nf/dao/impl/FilmInfoDaoImpl.java @@ -53,7 +53,7 @@ public class FilmInfoDaoImpl implements FilmInfoDao { List list=new ArrayList(); Connection conn= DBUtil.getConnection(); - String sql="select film_id,film_name,film_picture,film_long,film_status from filmInfo where film_status=1"; + String sql="select * from filmInfo where film_status=1"; PreparedStatement pstmt=null; ResultSet rst=null; try { @@ -62,11 +62,53 @@ public class FilmInfoDaoImpl implements FilmInfoDao { while (rst.next()){ int id=rst.getInt(1); String name=rst.getString(2); - String img=rst.getString(3); - int filmLong=rst.getInt(4); - int status=rst.getInt(5); + String type=rst.getString(3); + String director=rst.getString(4); + String language=rst.getString(5); + int filmLong=rst.getInt(6); + String year=rst.getString(7); + String country=rst.getString(8); + String img=rst.getString(9); + int status=rst.getInt(10); + String desc=rst.getString(11); + + FilmInfo film=new FilmInfo(id,name,type,director,language,filmLong,year,country,img,status,desc); + list.add(film); + } + } catch (SQLException throwables) { + throwables.printStackTrace(); + }finally { + DBUtil.close(rst,pstmt,conn); + } + + return list; + } + + @Override + public List selectNotShows() { + List list=new ArrayList(); + + Connection conn= DBUtil.getConnection(); + String sql="select * from filmInfo where film_status=0"; + PreparedStatement pstmt=null; + ResultSet rst=null; + try { + pstmt=conn.prepareStatement(sql); + rst=pstmt.executeQuery(); + while (rst.next()){ + int id=rst.getInt(1); + String name=rst.getString(2); + String type=rst.getString(3); + String director=rst.getString(4); + String language=rst.getString(5); + int filmLong=rst.getInt(6); + String year=rst.getString(7); + String country=rst.getString(8); + String img=rst.getString(9); + int status=rst.getInt(10); + String desc=rst.getString(11); - FilmInfo film=new FilmInfo(id,name,null,null,null,filmLong,null,null,img,status,null); + FilmInfo film=new FilmInfo(id,name,type,director,language,filmLong,year,country,img,status,desc); list.add(film); } } catch (SQLException throwables) { @@ -114,4 +156,40 @@ public class FilmInfoDaoImpl implements FilmInfoDao { } return film; } + + @Override + public List selectByLike(String cond) { + List list=new ArrayList<>(); + + Connection conn=DBUtil.getConnection(); + String sql="select * from filmInFo where film_name like ?"; + PreparedStatement pstmt=null; + ResultSet rst=null; + try { + pstmt=conn.prepareStatement(sql); + pstmt.setString(1,"%"+cond+"%"); + rst= pstmt.executeQuery(); + while (rst.next()){ + int id=rst.getInt(1); + String name=rst.getString(2); + String type=rst.getString(3); + String director=rst.getString(4); + String language=rst.getString(5); + int filmLong=rst.getInt(6); + String year=rst.getString(7); + String country=rst.getString(8); + String img=rst.getString(9); + int status=rst.getInt(10); + String desc=rst.getString(11); + + FilmInfo film=new FilmInfo(id,name,type,director,language,filmLong,year,country,img,status,desc); + list.add(film); + } + } catch (SQLException throwables) { + throwables.printStackTrace(); + }finally { + DBUtil.close(rst,pstmt,conn); + } + return list; + } } diff --git a/src/com/nf/entity/FilmInfo.java b/src/com/nf/entity/FilmInfo.java index 4ea60f6af670a8c87967879518a1ee431d63739e..296feafbd02232943c7c107f6a23b43f35867aef 100644 --- a/src/com/nf/entity/FilmInfo.java +++ b/src/com/nf/entity/FilmInfo.java @@ -16,7 +16,7 @@ public class FilmInfo { private int filmStatus; private String filmDesc; - public FilmInfo(int id, String name, String filmType, String filmDirector, String filmLanguage, Integer o, Object filmYear, Object filmCountry, String img, Object o1, Object filmDesc){} + public FilmInfo(){} public FilmInfo(int filmId, String filmName, String filmType, String filmDirector, String filmLanguage, int filmLong, String filmYear, String filmCountry, String filmPicture, int filmStatus, String filmDesc) { this.filmId = filmId; this.filmName = filmName;