package com.base.biz.controller.rpc;


import com.base.api.model.SceneTargetPointRpcDTO;
import com.base.biz.model.dto.response.SceneTargetPointDTO;
import com.base.biz.model.entity.SceneTargetPoint;
import com.base.biz.service.SceneTargetPointService;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;

@RestController
@RequestMapping("/targetPoint")
public class SceneTargetPointRpcController {

    @Resource
    private SceneTargetPointService sceneTargetPointService;
    /**
     * 根据目标id,查询点列表
     * @param targetId 目标id
     * @return 点列表
     */
    @GetMapping("/list/by/targetId")
    public List<SceneTargetPointRpcDTO> getPointListByTargetId(String targetId){
        List<SceneTargetPointDTO> list=sceneTargetPointService.getPointListByTargetId(targetId);
        List<SceneTargetPointRpcDTO> res = new ArrayList<>();
        for (SceneTargetPointDTO s : list) {
            SceneTargetPointRpcDTO sceneTargetPointRpcDTO = new SceneTargetPointRpcDTO();
            BeanUtils.copyProperties(s, sceneTargetPointRpcDTO);
            res.add(sceneTargetPointRpcDTO);
        }
        return res;
    }

}
