package com.tofly.feesapi.mxcx.controller;

import com.tofly.feesapi.common.core.ResultRespone;
import com.tofly.feesapi.common.core.dto.PageDto;
import com.tofly.feesapi.mxcx.entity.dto.YyBgLogFilter;
import com.tofly.feesapi.mxcx.service.YyBgLogService;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import org.springframework.web.bind.annotation.ModelAttribute;

@RestController
@RequestMapping("/yybglog")
@Api(tags = "日志变更记录接口")
public class YyBgLogController {

    @Autowired
    private YyBgLogService yyBgLogService;

    @GetMapping("/page")
    @ApiOperation(value = "分页查询")
    public ResultRespone getYyBgLogPage(PageDto pageDto, @ModelAttribute YyBgLogFilter filter) {
        return ResultRespone.success(yyBgLogService.getPage(pageDto, filter));
    }

    @GetMapping("/{id}")
    @ApiOperation(value = "通过ID查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "ID", required = true, dataType = "String")
    })
    public ResultRespone getById(@PathVariable("id") String id) {
        return ResultRespone.success(yyBgLogService.getById(id));
    }
}
