package cn.com.ty.lift.ud.motiontrail.controller;

import cn.com.ty.lift.ud.motiontrail.controller.query.MotionTrailQuery;
import cn.com.ty.lift.ud.motiontrail.mapper.entity.MotionTrail;
import cn.com.ty.lift.ud.motiontrail.service.IMotionTrailService;
import cn.com.xwy.boot.web.dto.RestResponse;
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.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 人员轨迹API
 *
 * @author Xson
 * @date 2020-07-15
 */
//@CrossOrigin
@Api(tags = "人员轨迹api")
@RestController
@RequestMapping("/api/motionTrails")
public class MotionTrailController {

    private final Logger log = LoggerFactory.getLogger(MotionTrailController.class);

    private @Autowired
    IMotionTrailService motionTrailService;

    /**
     * 根据条件查询人员轨迹
     * @param request
     * @return
     */
    @PostMapping("queryTrail")
    @ApiOperation(value = "根据条件查询人员轨迹")
    public RestResponse queryTrail(@RequestBody MotionTrailQuery request){

        return motionTrailService.queryTrail(request);
    }
    
    /**
     * 根据条件查询团队成员
     * @param request
     * @return
     */
    @PostMapping("queryTrailByTeam")
    @ApiOperation(value = "根据条件查询团队成员")
    public RestResponse queryTrailByTeam(@RequestBody MotionTrailQuery request){

        return motionTrailService.queryTrailByTeam(request);
    }

    /**
     * 新增位置记录
     * @param motionTrail
     * @return
     */
    @PostMapping("addTrail")
    @ApiOperation(value = "新增位置记录")
    public RestResponse addTrail(@RequestBody MotionTrail motionTrail){

        return motionTrailService.addTrail(motionTrail);
    }


}