package com.mosty.rzzx.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
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.base.model.dto.rzzx.TbRzXtfkInsertDto;
import com.mosty.base.model.entity.rzzx.TbRzXtfk;
import com.mosty.base.model.query.rzzx.TbRzXtfkQueryDto;
import com.mosty.rzzx.service.TbRzXtfkService;
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/8/4
 * 系统反馈日志接口
 **/
@Api(tags = "日志中心-系统反馈日志接口")
@RestController
@AllArgsConstructor
@RequestMapping("/tbRzXtfk")
public class TbRzXtfkController {

    private final TbRzXtfkService tbRzXtfkService;

    @ApiOperation("新增系统反馈日志")
    @PostMapping("addEntity")
    @JwtSysUser
    @Log(title = "新增系统反馈日志", businessType = BusinessType.INSERT)
    public ResponseResult<Integer> insertEntity(@RequestBody TbRzXtfkInsertDto dto) {
        return ResponseResult.success(this.tbRzXtfkService.insertEntity(dto));
    }

    @ApiOperation("修改系统反馈日志")
    @JwtSysUser
    @Log(title = "修改系统反馈日志", businessType = BusinessType.UPDATE)
    @PostMapping("updateById")
    public ResponseResult<Boolean> updateById(@RequestBody TbRzXtfkInsertDto dto) {
        return ResponseResult.success(this.tbRzXtfkService.updateEntity(dto));
    }

    @ApiOperation("删除系统反馈日志")
    @JwtSysUser
    @DeleteMapping("delEntity")
    @Log(title = "删除系统反馈日志", businessType = BusinessType.DELETE)
    public ResponseResult<Integer> delEntity(String id) {
        this.tbRzXtfkService.deleteEntity(id);
        return ResponseResult.success();
    }

    @ApiOperation("查询系统反馈日志详情接口")
    @JwtSysUser
    @GetMapping("getInfo/{id}")
    public ResponseResult<TbRzXtfk> getInfo(@PathVariable("id") String id) {
        return ResponseResult.success(this.tbRzXtfkService.getInfo(id));
    }

    @ApiOperation("查询系统反馈日志分页列表")
    @JwtSysUser
    @GetMapping("getList")
    public ResponseResult<IPage<TbRzXtfk>> getList(TbRzXtfkQueryDto dto) {
        return ResponseResult.success(this.tbRzXtfkService.getList(dto));
    }
}
