package com.prolog.cs.biz.inbound.controller.failure;

import com.prolog.cs.biz.inbound.dto.failure.ExceptionLogQueryDTO;
import com.prolog.cs.biz.inbound.dto.failure.ExceptionLogQueryVO;
import com.prolog.cs.biz.inbound.service.failure.ExceptionLogService;
import com.prolog.framework.common.message.RestMessage;
import com.prolog.framework.core.pojo.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Description // TODO
 * @Date 2021-03-24
 */

@Api(tags = "异常日志")
@RestController
@RequestMapping("/exceptionLog")
public class ExceptionLogController {

	@Resource
	private ExceptionLogService exceptionLogService;

	/**
	 * 异常日志详情查询
	 */
	@ApiOperation("详情查询(主键id)")
	@GetMapping("/v1/infoByPkId")
	public RestMessage<ExceptionLogQueryDTO> findByPkId(String pkId) {
		return RestMessage.newInstance(true, "findByPkIdSuccess", exceptionLogService.infoByPkId(pkId));
	}

	/**
	 * 异常日志条件分页查询
	 */
	@ApiOperation("条件分页查询")
	@GetMapping("/v1/page")
	public RestMessage<Page<ExceptionLogQueryDTO>> list(ExceptionLogQueryVO queryVO) throws Exception {
		return RestMessage.newInstance(true, "pageSuccess", exceptionLogService.findList(queryVO));
	}

}
