package com.mosty.sjzx.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.mosty.base.model.dto.sjzx.TbSjRzDto;
import com.mosty.base.model.dto.sjzx.TbSjRzInsertDto;
import com.mosty.base.model.entity.sjzx.TbSjRz;
import com.mosty.base.model.query.jcgl.TbSjRzQuery;
import com.mosty.common.base.domain.ResponseResult;
import com.mosty.common.base.entity.log.BusinessType;
import com.mosty.common.base.entity.log.Log;
import com.mosty.common.token.JwtSysUser;
import com.mosty.sjzx.service.TbSjRzService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author dw
 * @since 2022/7/11
 **/
@AllArgsConstructor
@RestController
@RequestMapping("tbSjRz")
@Api(tags = "事件日志相关接口")
public class TbSjRzController {

    @Resource
    private TbSjRzService tbSjRzService;

    @PostMapping("/saveRz")
    @ApiOperation(value = "新增事件日志记录")
    @JwtSysUser
    @Log(title = "新增事件日志记录", businessType = BusinessType.INSERT)
    public ResponseResult<Void> saveRz(@RequestBody TbSjRzInsertDto dto) {
        this.tbSjRzService.saveRz(dto);
        return ResponseResult.success();
    }

    @GetMapping("/getPageList")
    @ApiOperation(value = "查询事件回溯列表")
    @JwtSysUser
    @Log(title = "查询事件回溯列表", businessType = BusinessType.OTHER)
    public ResponseResult<IPage<TbSjRzDto>> getPageList(TbSjRzQuery dto) {
        return ResponseResult.success(this.tbSjRzService.getPageList(dto));
    }
}


