package com.huijy.web.controller.management;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.huijy.common.annotation.Log;
import com.huijy.common.core.controller.BaseController;
import com.huijy.common.core.domain.AjaxResult;
import com.huijy.common.enums.BusinessType;
import com.huijy.management.domain.ShopGuestRecord;
import com.huijy.management.service.IShopGuestRecordService;
import com.huijy.common.utils.poi.ExcelUtil;
import com.huijy.common.core.page.TableDataInfo;

/**
 * 酒店客人数据记录Controller
 *
 * @author luobo
 * @date 2021-10-10
 */
@RestController
@RequestMapping("/management/guestRecord")
public class ShopGuestRecordController extends BaseController
{
    @Autowired
    private IShopGuestRecordService shopGuestRecordService;

    /**
     * 查询酒店客人数据记录列表
     */
    @PreAuthorize("@ss.hasPermi('management:guestRecord:list')")
    @GetMapping("/list")
    public TableDataInfo list(ShopGuestRecord shopGuestRecord)
    {
        startPage();
        List<ShopGuestRecord> list = shopGuestRecordService.selectShopGuestRecordList(shopGuestRecord);
        return getDataTable(list);
    }

    /**
     * 导出酒店客人数据记录列表
     */
    @PreAuthorize("@ss.hasPermi('management:guestRecord:export')")
    @Log(title = "酒店客人数据记录", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(ShopGuestRecord shopGuestRecord)
    {
        List<ShopGuestRecord> list = shopGuestRecordService.selectShopGuestRecordList(shopGuestRecord);
        ExcelUtil<ShopGuestRecord> util = new ExcelUtil<ShopGuestRecord>(ShopGuestRecord.class);
        return util.exportExcel(list, "酒店客人数据记录数据");
    }

    /**
     * 获取酒店客人数据记录详细信息
     */
    @PreAuthorize("@ss.hasPermi('management:guestRecord:query')")
    @GetMapping(value = "/{shopGuestRecord}")
    public AjaxResult getInfo(@PathVariable("shopGuestRecord") Long shopGuestRecord)
    {
        return AjaxResult.success(shopGuestRecordService.selectShopGuestRecordByShopGuestRecord(shopGuestRecord));
    }

    /**
     * 新增酒店客人数据记录
     */
    @PreAuthorize("@ss.hasPermi('management:guestRecord:add')")
    @Log(title = "酒店客人数据记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ShopGuestRecord shopGuestRecord)
    {
        return toAjax(shopGuestRecordService.insertShopGuestRecord(shopGuestRecord));
    }

    /**
     * 修改酒店客人数据记录
     */
    @PreAuthorize("@ss.hasPermi('management:guestRecord:edit')")
    @Log(title = "酒店客人数据记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ShopGuestRecord shopGuestRecord)
    {
        return toAjax(shopGuestRecordService.updateShopGuestRecord(shopGuestRecord));
    }

    /**
     * 删除酒店客人数据记录
     */
    @PreAuthorize("@ss.hasPermi('management:guestRecord:remove')")
    @Log(title = "酒店客人数据记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{shopGuestRecords}")
    public AjaxResult remove(@PathVariable Long[] shopGuestRecords)
    {
        return toAjax(shopGuestRecordService.deleteShopGuestRecordByShopGuestRecords(shopGuestRecords));
    }
}
