package com.zcloud.personnel.positioning.web;

import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.SingleResponse;
import com.zcloud.personnel.positioning.api.PositionPersonServiceI;
import com.zcloud.personnel.positioning.dto.PositionPersonPageQry;
import com.zcloud.personnel.positioning.dto.clientobject.PositionPersonCO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
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;

@Api(tags = "定位人员菜单")
@RestController
@RequiredArgsConstructor
@RequestMapping("/${application.gateway}/positionPerson")
public class PositionPersonController {
    private final PositionPersonServiceI positionPersonService;

    @ApiOperation("定位人员分页查询")
    @PostMapping("/list")
    public PageResponse<PositionPersonCO> list(@RequestBody PositionPersonPageQry qry) {
        return positionPersonService.list(qry);
    }

    @ApiOperation("定位人员详情查询")
    @GetMapping("/{userId}")
    public SingleResponse<PositionPersonCO> queryByUserId(@PathVariable("userId") Long userId) {
        return SingleResponse.of(positionPersonService.queryByUserId(userId));
    }
}
