package com.bonus.canteen.core.common.export.controller;

import com.bonus.canteen.core.common.export.dto.ExportRecordQueryDTO;
import com.bonus.canteen.core.common.export.service.ExportRecordService;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.houqin.encrypt.RequiresGuest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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 javax.annotation.Resource;

@RestController
@RequestMapping({"/api/v4/export"})
public class ExportRecordController {
   private static final Logger log = LoggerFactory.getLogger(ExportRecordController.class);
   @Resource
   private ExportRecordService exportRecordService;

   @PostMapping({"/page"})
   @RequiresGuest
   public AjaxResult page(@RequestBody ExportRecordQueryDTO dto) {
      return AjaxResult.success(this.exportRecordService.page(dto));
   }

   @PostMapping({"/stop"})
   @RequiresGuest
   public AjaxResult stop(@RequestBody Long dto) {
      this.exportRecordService.stopAndDelete(dto);
      return AjaxResult.success();
   }
}
