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.TbRzHjInsertDto;
import com.mosty.base.model.dto.rzzx.TbRzHjUpdateDto;
import com.mosty.base.model.entity.rzzx.TbRzHj;
import com.mosty.base.model.query.rzzx.TbRzHjQueryDto;
import com.mosty.rzzx.service.TbRzHjService;
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/18
 * 呼叫日志接口
 **/
@Api(tags = "日志中心-呼叫日志接口")
@RestController
@AllArgsConstructor
@RequestMapping("/tbRzHj")
public class TbRzHjController {

    private final TbRzHjService tbRzHjService;

    @ApiOperation("呼叫日志接口新增")
    @JwtSysUser
    @Log(title = "呼叫日志接口新增", businessType = BusinessType.INSERT)
    @PostMapping("add")
    public ResponseResult<Integer> insertEntity(@RequestBody TbRzHjInsertDto dto) {
        return ResponseResult.success(this.tbRzHjService.insertEntity(dto));
    }

    @ApiOperation("呼叫日志接口修改-修改结束时间")
    @JwtSysUser
    @Log(title = "呼叫日志接口修改-修改结束时间", businessType = BusinessType.UPDATE)
    @PostMapping("update")
    public ResponseResult<Integer> updateEntity(@RequestBody TbRzHjUpdateDto dto) {
        return ResponseResult.success(this.tbRzHjService.updateEntity(dto));
    }

    @ApiOperation("查询呼叫详情接口")
    @JwtSysUser
    @GetMapping("getInfo/{id}")
    public ResponseResult<TbRzHj> getInfo(@PathVariable("id") String id) {
        return ResponseResult.success(this.tbRzHjService.getInfo(id));
    }

    @ApiOperation("查询分页列表")
    @JwtSysUser
    @GetMapping("getList")
    public ResponseResult<IPage<TbRzHj>> getList(TbRzHjQueryDto dto) {
        return ResponseResult.success(this.tbRzHjService.getList(dto));
    }
}
