current position:Home>Java project: tourism hotel management system (java + Maven + springboot + MySQL)
Java project: tourism hotel management system (java + Maven + springboot + MySQL)
2022-01-27 05:07:19 【qq_ one billion three hundred and thirty-four million six hundr】
This project is based on SpringBoot Tourism hotel management system , It is divided into foreground and background client. Users can register independently 、 Background administrator role . Front desk functions : Scenic spot 、 The hotel 、 strategy 、 Orders, etc . Background administrator function : User management 、 Scenic spot management 、 Album management 、 Message management 、 hotel management 、 Order management, etc . !
Running environment :jdk1.8 mysql5.7 idea/eclipse navicat/sqlyog maven3.5/3.6
Hotel order control layer :
/**
* Hotel order control layer
*/
@Controller
@CrossOrigin
@RequestMapping("/hotelorders")
public class Hotel_OrdersController {
@Autowired
private HotelOrdersService hotel_ordersService;
/**
* Add operation
* @param orders
*/
@ResponseBody
@RequestMapping(value ="/add",method=RequestMethod.POST)
public Result add(HotelOrders orders, HttpSession session){
User user = (User) session.getAttribute("user");
if (user == null){
return new Result(false,StatusCode.ACCESSERROR," Please log in ");
}
return hotel_ordersService.add(orders,user,orders.getId(),orders.getQty(),orders.getBegin(),orders.getEnd());
}
}
Background administrator controller layer :
/**
* Background administrator controller layer
*
*/
@Controller
@CrossOrigin
@RequestMapping("/admin")
public class AdminController {
@Autowired
private AdminService adminService;
@Autowired
BCryptPasswordEncoder encoder;
/**
* Query all data
* @return
*/
@ResponseBody
@RequestMapping(method= RequestMethod.GET)
public Result findAll(){
return new Result(true, StatusCode.OK," The query is successful ",adminService.findAll());
}
/**
* according to ID Inquire about
* @param id ID
* @return
*/
@ResponseBody
@RequestMapping(value="/{id}",method= RequestMethod.GET)
public Result findById(@PathVariable Long id){
return new Result(true,StatusCode.OK," The query is successful ",adminService.findById(id));
}
/**
* Pagination + Multiconditional query
* @param searchMap Query condition encapsulation
* @param page Page number
* @param size Page size
* @return Paging results
*/
@ResponseBody
@RequestMapping(value="/search/{page}/{size}",method=RequestMethod.POST)
public Result findSearch(@RequestBody Map searchMap , @PathVariable int page, @PathVariable int size){
Page<Admin> pageList = adminService.findSearch(searchMap, page, size);
return new Result(true,StatusCode.OK," The query is successful ", new PageResult<Admin>(pageList.getTotalElements(), pageList.getContent()) );
}
/**
* Query... According to the conditions
* @param searchMap
* @return
*/
@ResponseBody
@RequestMapping(value="/search",method = RequestMethod.POST)
public Result findSearch( @RequestBody Map searchMap){
return new Result(true,StatusCode.OK," The query is successful ",adminService.findSearch(searchMap));
}
/**
* increase
* @param admin
*/
@ResponseBody
@RequestMapping(method=RequestMethod.POST)
public Result add(@RequestBody Admin admin ){
adminService.add(admin);
return new Result(true,StatusCode.OK," Increase success ");
}
/**
* modify
* @param admin
*/
@ResponseBody
@RequestMapping(value="/{id}",method= RequestMethod.PUT)
public Result update(@RequestBody Admin admin, @PathVariable Long id ){
admin.setId(id);
adminService.update(admin);
return new Result(true,StatusCode.OK," Modification successful ");
}
/**
* Delete
* @param id
*/
@ResponseBody
@RequestMapping(value="/{id}",method= RequestMethod.DELETE)
public Result delete(@PathVariable String id ){
adminService.deleteById(id);
return new Result(true,StatusCode.OK," Delete successful ");
}
/**
* Administrator jump
* @return
*/
@RequestMapping(value = "/adminlogin")
public String adminlogin()
{
return "admin/login/login";
}
/**
* admin Sign in
* @param loginMap
* @param request
* @return
*/
@ResponseBody
@RequestMapping(value="/login",method= RequestMethod.POST)
public Result login(@RequestParam Map<String,String> loginMap,HttpServletRequest request){
Admin admin = adminService.finbyNameAndPassword(loginMap.get("name"),loginMap.get("password"));
if (admin!=null){
request.getSession().setAttribute("admin",admin);
Map map=new HashMap();
map.put("name",admin.getName());
return new Result(true,StatusCode.OK," Login successful ");
}else {
return new Result(false,StatusCode.ERROR," Wrong account password ");
}
}
/**
* Administrator login succeeded
* @return
*/
@RequestMapping(value = "/index")
public String success(){
return "admin/index";
}
/**
* User list
* @return
*/
@RequestMapping(value = "/userList")
public String user(){
return "admin/usermanage/userList";
}
@RequestMapping(value = "/echars")
public String analysis(){
return "admin/echars/console";
}
/**
* The administrator logs out
* @return
*/
@RequestMapping(value = "/logout")
public String logout(HttpSession session){
session.removeAttribute("admin");
return "admin/login/login";
}
/**
* The administrator changes the password
* @return
*/
@ResponseBody
@RequestMapping(value = "/passwd")
public Result passwd(HttpSession session,String passwd,String oldpad){
Admin admindmin= (Admin) session.getAttribute("admin");
Admin admins=adminService.findById(admindmin.getId());
boolean old=encoder.matches(oldpad,admins.getPassword());
if (old){
String newPassd=encoder.encode(passwd);
admins.setPassword(newPassd);
adminService.update(admins);
return new Result(true,StatusCode.OK," success ");
}else {
return new Result(false,StatusCode.ERROR," Update failed ");
}
}
}
Attraction controller layer :
/**
* Attraction controller layer
* @author yy
*
*/
@Controller
@CrossOrigin
@RequestMapping("/scenic")
public class ScenicController {
@Autowired
private ScenicService scenicService;
/**
* Query all data
* @return
*/
@ResponseBody
@RequestMapping(value = "list",method= RequestMethod.GET)
public Result findAll(){
List<Scenic> all = scenicService.findAll();
return new Result(true, StatusCode.OK," The query is successful ",all,all.size());
}
/**
* according to ID Inquire about
* @param id ID
* @return
*/
@ResponseBody
@RequestMapping(value="/{id}",method= RequestMethod.GET)
public Result findById(@PathVariable Long id){
return new Result(true,StatusCode.OK," The query is successful ",scenicService.findById(id));
}
/**
* Pagination + Multiconditional query
* @param searchMap Query condition encapsulation
* @param page Page number
* @param size Page size
* @return Paging results
*/
@ResponseBody
@RequestMapping(value="/search/{page}/{size}",method=RequestMethod.POST)
public Result findSearch(@RequestBody Map searchMap , @PathVariable int page, @PathVariable int size){
Page<Scenic> pageList = scenicService.findSearch(searchMap, page, size);
return new Result(true,StatusCode.OK," The query is successful ", new PageResult<Scenic>(pageList.getTotalElements(), pageList.getContent()) );
}
/**
* Query... According to the conditions
* @param searchMap
* @return
*/
@ResponseBody
@RequestMapping(value="/search",method = RequestMethod.POST)
public Result findSearch( @RequestBody Map searchMap){
return new Result(true,StatusCode.OK," The query is successful ",scenicService.findSearch(searchMap));
}
/**
* Add scenic spots
* @param scenic
*/
@ResponseBody
@RequestMapping(method=RequestMethod.POST)
public Result add(@RequestBody Scenic scenic){
if(StringUtils.isEmpty(scenic.getName())){
return new Result(false,StatusCode.ERROR," Please fill in the name of the scenic spot ");
}
if(StringUtils.isEmpty(scenic.getContry())){
return new Result(false,StatusCode.ERROR," Please fill in the location of the scenic spot ");
}
if(StringUtils.isEmpty(scenic.getComment())){
return new Result(false,StatusCode.ERROR," Please fill in the scenic spot Overview ");
}
if(StringUtils.isEmpty(scenic.getMiaoshu())){
return new Result(false,StatusCode.ERROR," Please fill in a detailed description ");
}
scenic.setCommentCount(0);
scenic.setStart(0);
if(scenicService.add(scenic)==null){
return new Result(false,StatusCode.ERROR," Failed to add scenic spot ");
}
return new Result(true,StatusCode.OK," Attractions added successfully ");
}
/**
* Scenic spot modification
* @param scenic
*/
@ResponseBody
@RequestMapping(value="/{id}",method= RequestMethod.PUT)
public Result update(@RequestBody Scenic scenic, @PathVariable Long id ){
if(StringUtils.isEmpty(scenic.getName())){
return new Result(false,StatusCode.ERROR," Please fill in the name of the scenic spot ");
}
if(StringUtils.isEmpty(scenic.getContry())){
return new Result(false,StatusCode.ERROR," Please fill in the location of the scenic spot ");
}
if(StringUtils.isEmpty(scenic.getComment())){
return new Result(false,StatusCode.ERROR," Please fill in the scenic spot Overview ");
}
if(StringUtils.isEmpty(scenic.getMiaoshu())){
return new Result(false,StatusCode.ERROR," Please fill in a detailed description ");
}
Scenic scenic1ById = scenicService.findById(id);
if(scenic1ById==null){
return new Result(false,StatusCode.ERROR," The attraction does not exist ");
}
BeanUtils.copyProperties(scenic,scenic1ById,"id","startdate","img","commentCount");
if(scenicService.update(scenic1ById)==null){
return new Result(false,StatusCode.ERROR," Failed to modify the scenic spot ");
}
return new Result(true,StatusCode.OK," Modification successful ");
}
/**
* Delete
* @param id
*/
@ResponseBody
@RequestMapping(value="/{id}",method= RequestMethod.DELETE)
public Result delete(@PathVariable String id ){
scenicService.deleteById(id);
return new Result(true,StatusCode.OK," Delete successful ");
}
@RequestMapping(value = "/scenicList")
public String scenicList(){
return "admin/scenicmanage/scenicList";
}
@RequestMapping(value = "/scenicAdd")
public String scenicAdd(){
return "admin/scenicmanage/scenicAdd";
}
}
copyright notice
author[qq_ one billion three hundred and thirty-four million six hundr],Please bring the original link to reprint, thank you.
https://en.cdmana.com/2022/01/202201270507148063.html
The sidebar is recommended
- Spring IOC container loading process
- [thinking] the difference between singleton mode and static method - object-oriented programming
- Hadoop environment setup (MySQL environment configuration)
- 10 minutes, using node JS creates a real-time early warning system for bad weather!
- Git tool
- Force deduction algorithm - 92 Reverse linked list II
- What is the sub problem of dynamic programming?
- C / C + +: static keyword summary
- Idea does not have the artifacts option when configuring Tomcat
- Anaconda can't open it
guess what you like
-
I don't know how to start this
-
Matlab simulation of transportation optimization algorithm based on PSO
-
MySQL slow log optimization
-
[Vue] as the window is stretched (larger, smaller, wider and higher), the text will not be displayed
-
Popular Linux distributions for embedded computing
-
Suzhou computer research
-
After installing SSL Certificate in Windows + tomcat, the domain name request is not successful. Please answer!!
-
Implementation time output and greetings of jQuery instance
-
The 72 year old uncle became popular. Wu Jing and Guo fan made his story into a film, which made countless dreamers blush
-
How to save computer research
Random recommended
- Springboot implements excel import and export, which is easy to use, and poi can be thrown away
- The final examination subjects of a class are mathematical programming, and the scores are sorted and output from high to low
- Two pronged approach, Tsinghua Professor Pro code JDK and hotspot source code notes, one-time learning to understand
- C + + recursive knapsack problem
- The use of GIT and GitHub and the latest git tutorial are easy to understand -- Video notes of crazy God speaking
- PostgreSQL statement query
- Ignition database test
- Context didn't understand why he got a high salary?, Nginxfair principle
- Bootstrap switch switch control user's guide, springcloud actual combat video
- A list that contains only strings. What other search methods can be used except sequential search
- [matlab path planning] multi ant colony algorithm grid map path planning [including GUI source code 650]
- [matlab path planning] improved genetic algorithm grid map path planning [including source code phase 525]
- Iinternet network path management system
- Appium settings app is not running after 5000ms
- Reactnative foundation - 07 (background image, status bar, statusbar)
- Reactnative foundation - 04 (custom rpx)
- If you want an embedded database (H2, hsql or Derby), please put it on the classpath
- When using stm32g070 Hal library, if you want to write to flash, you must perform an erase. If you don't let it, you can't write continuously.
- Linux checks where the software is installed and what files are installed
- SQL statement fuzzy query and time interval filtering
- 69. Sqrt (x) (c + + problem solving version with vs runnable source program)
- Fresh students are about to graduate. Do you choose Java development or big data?
- Java project: OA management system (java + SSM + bootstrap + MySQL + JSP)
- Titanic passenger survival prediction
- Vectorization of deep learning formula
- Configuration and use of private image warehouse of microservice architect docker
- Relearn JavaScript events
- For someone, delete return 1 and return 0
- How does Java dynamically obtain what type of data is passed? It is used to judge whether the data is the same, dynamic data type
- How does the database cow optimize SQL?
- [data structure] chain structure of binary tree (pre order traversal) (middle order traversal) (post order traversal) (sequence traversal)
- Webpack packaging optimization solution
- 5. Operation element
- Detailed explanation of red and black trees
- redhat7. 9 install database 19C
- Blue Bridge Cup notes: (the given elements are not repeated) complete arrangement (arrangement cannot be repeated, arrangement can be repeated)
- Detailed explanation of springboot default package scanning mechanism and @ componentscan specified scanning path
- How to solve the run-time exception of test times
- Detailed explanation of k8s management tool kubectl
- Android system view memory command