package com.ltgk.boat.controller;

import com.ltgk.boat.domain.dto.DeleteByIdsReq;
import com.ltgk.boat.domain.dto.GetBoatNameListReq;
import com.ltgk.boat.domain.dto.SaveBoatNameReq;
import com.ltgk.boat.domain.entity.DsBoatName;
import com.ltgk.boat.service.DsBoatNameService;
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:12
 * @Version: 1.0
 */
@RestController
@Api(tags = "渔船登记证书", description = "渔船登记证书")
@RequestMapping("/fishingPort/fishingBoatArchives")
@Valid
public class DsBoatNameController extends BaseController {
    @Autowired
    private DsBoatNameService dsBoatNameService;

    /**
     * 获取渔船登记证书列表
     *
     * @param getBoatNameListReq
     * @return {@link List<DsBoatName>}
     */
    @RequestMapping(value = "/getBoatNameList")
    public TableDataInfo getBoatNameList(@RequestBody @Valid GetBoatNameListReq getBoatNameListReq) {
        return getDataTable(dsBoatNameService.getBoatNameList(getBoatNameListReq));
    }

    /**
     * 修改渔船登记证书
     *
     * @param saveBoatNameReq
     * @return
     */
    @RequestMapping(value = "/saveBoatName")
    public AjaxResult saveBoatName(@RequestBody @Validated SaveBoatNameReq saveBoatNameReq) throws IllegalAccessException {
        return dsBoatNameService.saveBoatName(saveBoatNameReq);
    }

    /**
     * 删除渔船登记证书
     *
     * @param deleteByIdsReq
     * @return
     */
    @RequestMapping(value = "/deleteBoatName")
    public AjaxResult deleteBoatName(@RequestBody @Validated DeleteByIdsReq deleteByIdsReq) {
        return dsBoatNameService.deleteBoatName(deleteByIdsReq);
    }
}
