package com.kym.admin.controller;

import com.kym.common.R;
import com.kym.common.controller.IController;
import com.kym.entity.admin.EquipmentRelation;
import com.kym.entity.admin.dto.BatchBindEquipmentRelation;
import com.kym.service.admin.EquipmentRelationService;
import jakarta.annotation.Resource;
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;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author skyline
 * @since 2023-08-07
 */
@RestController
@RequestMapping("/equipment-relation")
public class EquipmentRelationController extends IController {

    @Resource
    private EquipmentRelationService equipmentRelationService;

    @PostMapping("batchBind")
    R<?> batchBind(@RequestBody BatchBindEquipmentRelation equipmentRelation) {
        return resp((t) -> equipmentRelationService.batchBind(equipmentRelation));
    }



    @GetMapping("detail/{id}")
    public R<?> detail(@PathVariable(name = "id") String connectorId) {
        return resp(() -> equipmentRelationService.getByConnectorId(connectorId));
    }


}
