package com.huatek.frame.base.log.controller;

import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.dubbo.config.annotation.Reference;
import com.huatek.frame.base.entity.RequestLog;
import com.huatek.frame.base.service.RequestLogService;
import com.huatek.frame.base.vo.UserVO;
import com.huatek.torch.frame.permission.KerPermission;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * @author key 操作日志
 */
@Api(tags={"操作日志接口"})
@RestController
@RequestMapping("/api/log")
public class LogController {

	@SuppressWarnings("unused")
	private static final Logger logger = LoggerFactory.getLogger(LogController.class);

	@Reference(check = false)
	private RequestLogService requestLogService;

	/**
	 * 操作日志列表
	 * 
	 * @param page
	 * @param limit
	 * @param Logs
	 * @return
	 */
	@ApiOperation(value = "用户列表",httpMethod="POST", notes= "用户列表", produces = "application/json;charset=utf-8",response=UserVO.class)
	@PostMapping(value="/logs", produces = { "application/json;charset=utf-8"})
	public  @KerPermission("10037") Map<String, Object> logss(@RequestBody  RequestLog log) {
		Map<String, Object> map = requestLogService.findLogPage(log);
		return map;
	}

	/**
	 * 查询操作日志对象
	 * 
	 * @param page
	 * @param limit
	 * @param Logs
	 * @return
	 */
	@ApiOperation(value = "用户列表",httpMethod="POST", notes= "用户列表", produces = "application/json;charset=utf-8",response=UserVO.class)
	@GetMapping(value="/findLogs/{id}", produces = { "application/json;charset=utf-8"})
	public  @KerPermission("10039") Map<String, Object> findLogs(@PathVariable("id")String id) {
		Map<String, Object> map = requestLogService.findLogs(id);
		return map;
	}

	/**
	 * 删除操作日志
	 * 
	 * @param ids
	 * @return
	 */
	@ApiOperation(value = "用户列表",httpMethod="POST", notes= "用户列表", produces = "application/json;charset=utf-8",response=UserVO.class)
	@PostMapping(value="/deleteLogs", produces = { "application/json;charset=utf-8"})
	public  @KerPermission("10038") Map<String, Object> deleteLogs(@RequestBody String[] ids) {
		Map<String, Object> map = requestLogService.deleteLogs(ids);
		return map;
	}
}
