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.HotelOderRefundEntity; import com.chuanghai.ihotel.service.HotelOderRefundService; 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("hotelOderRefund") public class HotelOderRefundController { @Autowired private HotelOderRefundService hotelOderRefundService; /** * 列表 */ @GetMapping("/list") public CommonResult> list(PageParam pageParam){ PageUtils page = hotelOderRefundService.queryPage(pageParam); return CommonResult.ok().setResult(page); } /** * 信息 */ @GetMapping("/info/{id}") public CommonResult info(@PathVariable("id") Long id){ HotelOderRefundEntity hotelOderRefund = hotelOderRefundService.getById(id); return CommonResult.ok().setResult(hotelOderRefund); } /** * 保存 */ @PostMapping("/save") public CommonResult save(@RequestBody HotelOderRefundEntity hotelOderRefund){ hotelOderRefundService.save(hotelOderRefund); return CommonResult.ok(); } /** * 修改 */ @PutMapping("/update") public CommonResult update(@RequestBody HotelOderRefundEntity hotelOderRefund){ boolean flag = hotelOderRefundService.updateById(hotelOderRefund); if (flag) { return CommonResult.ok(); } else { return CommonResult.fail(); } } /** * 删除 */ @DeleteMapping("/delete") public CommonResult delete(@RequestBody Long[] ids){ boolean flag = hotelOderRefundService.removeByIds(Arrays.asList(ids)); if (flag) { return CommonResult.ok(); } else { return CommonResult.fail(); } } }