package com.vote.system.controller;

import com.vctgo.common.core.web.domain.AjaxResult;
import com.vctgo.system.api.domain.dto.SysBranchKindergartenDto;
import com.vote.system.domain.vo.VoteSysBranchKindergartenVo;
import com.vote.system.service.VoteSysBranchKindergartenService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author feng
 * @date 2024/8/22
 */
@RestController
@RequestMapping("/branchKindergarten")
public class VoteSysBranchKindergartenController {

    @Autowired
    private VoteSysBranchKindergartenService voteSysBranchKindergartenService;

    /**
     * 查询园区列表
     *
     */
    @GetMapping(value = "/get")
    public AjaxResult list(String districtId) {
        List<VoteSysBranchKindergartenVo> kindergartens = voteSysBranchKindergartenService.selectByDistrictId(districtId);
        return AjaxResult.success(kindergartens);
    }


    /**
     * 保存
     * @param sysBranchKindergartenDto
     * @return
     */
    @PostMapping("/save")
    public AjaxResult save(@RequestBody SysBranchKindergartenDto sysBranchKindergartenDto){
       return AjaxResult.success(voteSysBranchKindergartenService.save(sysBranchKindergartenDto));
    }

}
