package com.ltgk.boat.controller;

import com.ltgk.boat.domain.dto.DeleteByIdsReq;
import com.ltgk.boat.domain.dto.GetBoatFishingListReq;
import com.ltgk.boat.domain.dto.SaveBoatFishingReq;
import com.ltgk.boat.domain.entity.DsBoatFishing;
import com.ltgk.boat.service.DsBoatFishingService;
import com.ltgk.common.core.controller.BaseController;
import com.ltgk.common.core.domain.AjaxResult;
import com.ltgk.common.core.page.TableDataInfo;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.List;

/**
 * @Author: wan kun
 * @Description: 渔船捕捞证书
 * @Date: 2024/12/25 9:01
 * @Version: 1.0
 */
@RestController
@Api(tags = "渔船捕捞证书", description = "渔船捕捞证书")
@RequestMapping("/fishingPort/fishingBoatArchives")
@Valid
public class DsBoatFishingController extends BaseController {
    @Autowired
    private DsBoatFishingService dsBoatFishingService;

    /**
     * 获取渔船捕捞证书列表
     *
     * @param getBoatFishingListReq
     * @return {@link List<DsBoatFishing>}
     */
    @RequestMapping(value = "/getBoatFishingList")
    public TableDataInfo getBoatFishingList(@RequestBody @Valid GetBoatFishingListReq getBoatFishingListReq) {
        return getDataTable(dsBoatFishingService.getBoatFishingList(getBoatFishingListReq));
    }

    /**
     * 修改渔船捕捞证书
     *
     * @param saveBoatFishingReq
     * @return
     */
    @RequestMapping(value = "/saveBoatFishing")
    public AjaxResult saveBoatFishing(@RequestBody @Validated SaveBoatFishingReq saveBoatFishingReq) throws IllegalAccessException {
        return dsBoatFishingService.saveBoatFishing(saveBoatFishingReq);
    }

    /**
     * 删除渔船捕捞证书
     *
     * @param deleteByIdsReq
     * @return
     */
    @RequestMapping(value = "/deleteBoatFishing")
    public AjaxResult deleteBoatFishing(@RequestBody @Validated DeleteByIdsReq deleteByIdsReq) {
        return dsBoatFishingService.deleteBoatFishing(deleteByIdsReq);
    }
}
