|
@@ -3,6 +3,7 @@ package com.chuanghai.ihotel.controller;
|
|
|
import java.util.Arrays;
|
|
import java.util.Arrays;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
+import com.chuanghai.ihotel.anno.AdminLoginCheck;
|
|
|
import com.chuanghai.ihotel.anno.ParamCheck;
|
|
import com.chuanghai.ihotel.anno.ParamCheck;
|
|
|
import com.chuanghai.ihotel.controller.request.RoomTypeQueryRequest;
|
|
import com.chuanghai.ihotel.controller.request.RoomTypeQueryRequest;
|
|
|
import com.chuanghai.ihotel.vo.RoomTypeShortDescVO;
|
|
import com.chuanghai.ihotel.vo.RoomTypeShortDescVO;
|
|
@@ -12,6 +13,7 @@ import org.springframework.web.bind.annotation.PathVariable;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.PutMapping;
|
|
import org.springframework.web.bind.annotation.PutMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
+import org.springframework.web.bind.annotation.RequestHeader;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
@@ -24,7 +26,7 @@ import com.chuanghai.ihotel.common.utils.PageParam;
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 房型
|
|
|
|
|
|
|
+ * 房型
|
|
|
*
|
|
*
|
|
|
* @author codingliang
|
|
* @author codingliang
|
|
|
* @email codingliang@gmail.com
|
|
* @email codingliang@gmail.com
|
|
@@ -50,8 +52,10 @@ public class RoomTypeController {
|
|
|
/**
|
|
/**
|
|
|
* 房型列表(管理端)
|
|
* 房型列表(管理端)
|
|
|
*/
|
|
*/
|
|
|
|
|
+ @AdminLoginCheck
|
|
|
@GetMapping("/page")
|
|
@GetMapping("/page")
|
|
|
- public CommonResult<PageUtils<RoomTypeEntity>> page(PageParam pageParam){
|
|
|
|
|
|
|
+ public CommonResult<PageUtils<RoomTypeEntity>> page(@RequestHeader("admin_token")String adminToken,
|
|
|
|
|
+ PageParam pageParam){
|
|
|
PageUtils page = roomTypeService.queryPage(pageParam);
|
|
PageUtils page = roomTypeService.queryPage(pageParam);
|
|
|
return CommonResult.ok().setResult(page);
|
|
return CommonResult.ok().setResult(page);
|
|
|
}
|
|
}
|
|
@@ -70,9 +74,11 @@ public class RoomTypeController {
|
|
|
/**
|
|
/**
|
|
|
* 新增房型
|
|
* 新增房型
|
|
|
*/
|
|
*/
|
|
|
- @PostMapping("/save")
|
|
|
|
|
@ParamCheck
|
|
@ParamCheck
|
|
|
- public CommonResult<String> save(@RequestBody RoomTypeEntity roomType){
|
|
|
|
|
|
|
+ @AdminLoginCheck
|
|
|
|
|
+ @PostMapping("/save")
|
|
|
|
|
+ public CommonResult<String> save(@RequestHeader("admin_token")String adminToken,
|
|
|
|
|
+ @RequestBody RoomTypeEntity roomType){
|
|
|
roomTypeService.save(roomType);
|
|
roomTypeService.save(roomType);
|
|
|
|
|
|
|
|
return CommonResult.ok();
|
|
return CommonResult.ok();
|
|
@@ -81,9 +87,11 @@ public class RoomTypeController {
|
|
|
/**
|
|
/**
|
|
|
* 修改房型
|
|
* 修改房型
|
|
|
*/
|
|
*/
|
|
|
- @PutMapping("/update")
|
|
|
|
|
|
|
+ @AdminLoginCheck
|
|
|
@ParamCheck
|
|
@ParamCheck
|
|
|
- public CommonResult<String> update(@RequestBody RoomTypeEntity roomType){
|
|
|
|
|
|
|
+ @PutMapping("/update")
|
|
|
|
|
+ public CommonResult<String> update(@RequestHeader("admin_token")String adminToken,
|
|
|
|
|
+ @RequestBody RoomTypeEntity roomType){
|
|
|
boolean flag = roomTypeService.updateById(roomType);
|
|
boolean flag = roomTypeService.updateById(roomType);
|
|
|
|
|
|
|
|
if (flag) {
|
|
if (flag) {
|
|
@@ -96,8 +104,10 @@ public class RoomTypeController {
|
|
|
/**
|
|
/**
|
|
|
* 删除房型
|
|
* 删除房型
|
|
|
*/
|
|
*/
|
|
|
|
|
+ @AdminLoginCheck
|
|
|
@DeleteMapping("/delete")
|
|
@DeleteMapping("/delete")
|
|
|
- public CommonResult<String> delete(@RequestBody Long[] ids){
|
|
|
|
|
|
|
+ public CommonResult<String> delete(@RequestHeader("admin_token")String adminToken,
|
|
|
|
|
+ @RequestBody Long[] ids){
|
|
|
boolean flag = roomTypeService.removeByIds(Arrays.asList(ids));
|
|
boolean flag = roomTypeService.removeByIds(Arrays.asList(ids));
|
|
|
|
|
|
|
|
if (flag) {
|
|
if (flag) {
|