package com.jiayue.ipfcst.fileupload.controller;

import com.jiayue.ipfcst.common.core.web.vo.ResponseVO;
import com.jiayue.ipfcst.common.data.entity.UploadFileLogDetail;
import com.jiayue.ipfcst.fileupload.service.UploadFileLogDetailService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("uploadFileLogDetail")
@Slf4j
public class UploadFileLogDetailController {
  private final UploadFileLogDetailService uploadFileLogDetailService;
  @Autowired
  public UploadFileLogDetailController(UploadFileLogDetailService uploadFileLogDetailService){
    this.uploadFileLogDetailService = uploadFileLogDetailService;
  }

  @GetMapping("/{uploadFileLogId}")
  public ResponseVO getByFileLogId(@PathVariable("uploadFileLogId") Integer uploadFileLogId){
    List<UploadFileLogDetail> list =uploadFileLogDetailService.getByFileLogId(uploadFileLogId);
    return ResponseVO.success(list);
  }
  @DeleteMapping("/{uploadFileLogId}")
  public ResponseVO deleteByUploadFileLogId(@PathVariable("uploadFileLogId") Integer uploadFileLogId){
    uploadFileLogDetailService.deleteByUploadFileLogId(uploadFileLogId);
    return ResponseVO.success(1);
  }
}
