| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- package com.chuanghai.ihotel.controller;
- import java.util.Arrays;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.DeleteMapping;
- import org.springframework.web.bind.annotation.PathVariable;
- import org.springframework.web.bind.annotation.PostMapping;
- import org.springframework.web.bind.annotation.PutMapping;
- import org.springframework.web.bind.annotation.RequestBody;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.GetMapping;
- import org.springframework.web.bind.annotation.RestController;
- import com.chuanghai.ihotel.entity.HotelStaffEntity;
- import com.chuanghai.ihotel.service.HotelStaffService;
- import com.chuanghai.ihotel.common.utils.PageUtils;
- import com.chuanghai.ihotel.common.utils.CommonResult;
- import com.chuanghai.ihotel.common.utils.PageParam;
- /**
- * 酒店员工
- *
- * @author codingliang
- * @email codingliang@gmail.com
- * @date 2022-07-27 10:02:04
- */
- @RestController
- @RequestMapping("hotelStaff")
- public class HotelStaffController {
- @Autowired
- private HotelStaffService hotelStaffService;
- /**
- * 列表
- */
- @GetMapping("/list")
- public CommonResult<PageUtils<HotelStaffEntity>> list(PageParam pageParam){
- PageUtils page = hotelStaffService.queryPage(pageParam);
- return CommonResult.ok().setResult(page);
- }
- /**
- * 信息
- */
- @GetMapping("/info/{id}")
- public CommonResult<HotelStaffEntity> info(@PathVariable("id") Long id){
- HotelStaffEntity hotelStaff = hotelStaffService.getById(id);
- return CommonResult.ok().setResult(hotelStaff);
- }
- /**
- * 保存
- */
- @PostMapping("/save")
- public CommonResult<String> save(@RequestBody HotelStaffEntity hotelStaff){
- hotelStaffService.save(hotelStaff);
- return CommonResult.ok();
- }
- /**
- * 修改
- */
- @PutMapping("/update")
- public CommonResult<String> update(@RequestBody HotelStaffEntity hotelStaff){
- boolean flag = hotelStaffService.updateById(hotelStaff);
- if (flag) {
- return CommonResult.ok();
- } else {
- return CommonResult.fail();
- }
- }
- /**
- * 删除
- */
- @DeleteMapping("/delete")
- public CommonResult<String> delete(@RequestBody Long[] ids){
- boolean flag = hotelStaffService.removeByIds(Arrays.asList(ids));
- if (flag) {
- return CommonResult.ok();
- } else {
- return CommonResult.fail();
- }
- }
- }
|