package com.skr.mdm.api.index.controller;

import com.skr.mdm.api.index.service.DeviceAssetService;
import com.skr.mdm.dto.LoginAdminDTO;
import com.skr.mdm.result.ResponseResult;
import com.skr.mdm.bean.vo.index.DeviceAssetInfoVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.core.Authentication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;


/**
 * @ProjectName: mdm_new
 * @Package: com.skr.mdm.largeScreenManagement.controller
 * @ClassName: DeviceAssetMessageController
 * @Author: Tty
 * @Description: 设备资产分析
 * @Date: 2020/9/9 16:21
 * @Version: 1.0
 */
@RestController
@RequestMapping("deviceAsset")
@Api(tags = "设备资产分析")
@Slf4j
public class DeviceAssetMessageController {

	@Autowired
	private DeviceAssetService deviceAssetService;

	/**
	 * @param authentication
	 * @return java.lang.Object
	 * @Description 用户活跃数
	 * @outher Tty
	 * @date 2020/9/8
	 **/
	@GetMapping(value = "/queryDeviceAsset")
	@ApiOperation(value = "设备资产分析")
	@ApiResponses({
			@ApiResponse(code = 200, message = "ok", response = DeviceAssetInfoVO.class)
	})
	@PreAuthorize("hasAnyAuthority('sys:index')")
	public ResponseResult getDeviceAssetList(@ApiIgnore Authentication authentication) throws Exception {
		LoginAdminDTO admin = (LoginAdminDTO) authentication.getPrincipal();
		return deviceAssetService.selectByStyleSelect(admin);
	}

}
