package com.njcn.product.device.ledger.controller;


import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;

import com.njcn.product.device.ledger.pojo.dto.TerminalTree;
import com.njcn.product.device.ledger.pojo.param.DeviceInfoParam;
import com.njcn.product.device.ledger.service.TerminalTreeService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * pqs
 * 终端树控制器
 * @author cdf
 * @date 2021/7/19
 */
@Slf4j
@Api(tags = "终端树管理")
@RestController
@RequiredArgsConstructor
@RequestMapping("/terminalTree")
public class TerminalTreeController extends BaseController {

    private final TerminalTreeService terminalTreeService;



    /**
     * 获取终端台账设备树
     * @author cdf
     * @date 2021/7/19
     */

    @ApiOperation("获取5层终端树")
    @OperateInfo(info = LogEnum.BUSINESS_MEDIUM)
    @PostMapping("getTerminalTreeForFive")
    @ApiImplicitParam(name = "deviceInfoParam", value = "台账查询参数", required = true)
    public HttpResult<List<TerminalTree>> getTerminalTreeForFive(@RequestBody @Validated DeviceInfoParam deviceInfoParam){
        String methodDescribe = getMethodDescribe("getTerminalTreeForFive");
        List<TerminalTree> tree = terminalTreeService.getTerminalTreeForFive(deviceInfoParam);

        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, tree, methodDescribe);
    }



}
