package com.njcn.csharmonic.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.csdevice.pojo.vo.EngineeringHomePageVO;
import com.njcn.csharmonic.service.HomePageService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author xy
 */
@Slf4j
@RestController
@RequestMapping("/homePage")
@Api(tags = "app首页")
@AllArgsConstructor
public class HomePageController extends BaseController {

    private final HomePageService homePageService;

    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/getEngineeringHomePage")
    @ApiOperation("工程用户首页")
    public HttpResult<List<EngineeringHomePageVO>> getEngineeringHomePage(){
        String methodDescribe = getMethodDescribe("getEngineeringHomePage");
        List<EngineeringHomePageVO> result = homePageService.getEngineeringHomePage();
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
    }

}
