package com.base.biz.controller.rpc;

import com.base.api.model.SatelliteAppendixRpcDTO;
import com.base.biz.model.entity.SatelliteAppendix;
import com.base.biz.service.SatelliteAppendixService;
import com.base.orbit.utils.BizUtils;
import org.springframework.web.bind.annotation.*;

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

@RestController
@RequestMapping("/rpc/appendix")
public class SatelliteAppendixRpcController {

    @Resource
    SatelliteAppendixService satelliteAppendixService;

    @PostMapping("/getList")
    public List<SatelliteAppendixRpcDTO> getList(@RequestBody List<String> satelliteCode) {
        return BizUtils.copyEntityToDto(SatelliteAppendixRpcDTO.class, satelliteAppendixService.getList(satelliteCode));
    }

    @PostMapping("/update/add")
    public void update(@RequestBody SatelliteAppendix satelliteAppendix) {
        satelliteAppendixService.updateAddById(satelliteAppendix);
    }

    @PostMapping("/save")
    public void save(@RequestBody SatelliteAppendix satelliteAppendix) {
        satelliteAppendixService.saveSatelliteAppendix(satelliteAppendix);
    }

    @PostMapping("/remove")
    public void remove(String id) {
        satelliteAppendixService.removeById(id);
    }
}
