package com.iformall.controller;

import com.iformall.common.ErrorCode;
import com.iformall.common.Result;
import com.iformall.common.ResultData;
import com.iformall.domain.po.WxCUser;
import com.iformall.domain.po.WxPark;
import com.iformall.service.WxParkService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/wxPark")
@Api(description = "停车相关接口接口")
public class WxParkController extends BaseController {
    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private WxParkService wxParkService;

    @ApiOperation("查找用户车场信息")
    @GetMapping("/info")
    public ResultData findById() {
        WxPark parkQ = new WxPark();
        parkQ.setTenantId(getTenantId());
        WxPark park = wxParkService.getByObj(parkQ);
        if (park == null) {
            logger.error("车场未取到");
            return new ResultData(ErrorCode.CAR_PARK_NOT_FOUND);
        }
        return new ResultData(Result.SUCCESS, "查询成功", park);
    }

}
