package com.artfess.rescue.base.controller;


import com.artfess.base.annotation.ApiGroup;
import com.artfess.base.constants.ApiGroupConsts;
import com.artfess.base.model.CommonResult;
import com.artfess.rescue.uc.vo.OrgInfoVO;
import com.artfess.rescue.uc.vo.RoadSegmentLevelVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import com.artfess.base.controller.BaseController;
import com.artfess.rescue.base.model.BizElectronicFenec;
import com.artfess.rescue.base.manager.BizElectronicFenecManager;

import java.util.List;

/**
 * 电子围栏 前端控制器
 *
 * @company 阿特菲斯信息技术有限公司
 * @author 系统管理员
 * @since 2025-03-05
 */
@Api(tags = "电子围栏点位信息")
@ApiGroup(group = {ApiGroupConsts.GROUP_BIZ_RESCUE})
@RestController
@RequestMapping("/bizElectronicFenec/v1/")
public class BizElectronicFenecController extends BaseController<BizElectronicFenecManager, BizElectronicFenec> {

    @GetMapping("/fenecTree")
    @ApiOperation("组织队伍树")
    public CommonResult<RoadSegmentLevelVO> teamTree(@RequestParam(required = false,value = "type")String type) {
        RoadSegmentLevelVO orgs = baseService.fenecTree(type);
        return CommonResult.success(orgs,"");
    }

    @GetMapping("/getFenec")
    @ApiOperation("根据队伍查询电子围栏")
    public CommonResult<List<?>> getFenec(@RequestParam(required = false,value = "teamIds")String teamIds) {
        List<BizElectronicFenec> orgs = baseService.getFenec(teamIds);
        return CommonResult.success(orgs,"");
    }

    @PostMapping("/delete/{teamIds}")
    @ApiOperation("根据队伍查询电子围栏")
    public CommonResult<String> deleteByTeamIds(@PathVariable(value = "teamIds")String teamIds) {
        boolean delete = baseService.deleteByTeam(teamIds);
        return new CommonResult<String>(delete,delete?"删除成功":"删除失败");
    }

}
