package com.ics.admin.controller.meeting;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.ics.common.core.domain.R;
import com.ics.common.core.controller.BaseController;
import com.ics.admin.domain.meeting.CustomerTicket;
import com.ics.admin.service.meeting.ICustomerTicketService;
import org.wf.jwtp.annotation.RequiresPermissions;

/**
 * 企业优惠卷关联 提供者
 *
 * @author chen
 * @date 2024-02-25
 */
@RestController
@RequestMapping("/meeting/customerTicket")
public class CustomerTicketController extends BaseController {

    @Autowired
    private ICustomerTicketService customerTicketService;

    /**
     * 查询企业优惠卷关联
     */
    @GetMapping("get/{id}")
    public CustomerTicket get(@PathVariable("id") Long id) {
        return customerTicketService.selectCustomerTicketById(id);
    }

    /**
     * 查询企业优惠卷关联列表
     */
    @RequiresPermissions("meeting:customerTicket:list")
    @GetMapping("list")
    public R list(CustomerTicket customerTicket) {
        startPage();
        return result(customerTicketService.selectCustomerTicketList(customerTicket));
    }


    /**
     * 新增保存企业优惠卷关联
     */
    @RequiresPermissions("meeting:customerTicket:add")
    @PostMapping("save")
    public R addSave(@RequestBody CustomerTicket customerTicket) {
        return toAjax(customerTicketService.insertCustomerTicket(customerTicket));
    }

    /**
     * 修改保存企业优惠卷关联
     */
    @RequiresPermissions("meeting:customerTicket:edit")
    @PostMapping("update")
    public R editSave(@RequestBody CustomerTicket customerTicket) {
        return toAjax(customerTicketService.updateCustomerTicket(customerTicket));
    }

    /**
     * 删除企业优惠卷关联
     */
    @RequiresPermissions("meeting:customerTicket:remove")
    @PostMapping("remove")
    public R remove(String ids) {
        return toAjax(customerTicketService.deleteCustomerTicketByIds(ids));
    }

}
