package com.fastbee.data.controller.gis;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.fastbee.common.core.controller.BaseController;
import com.fastbee.common.core.domain.AjaxResult;
import com.fastbee.ggroup.domain.GSiteIrrigateInfo;
import com.fastbee.ggroup.service.IGSiteIrrigateInfoService;


/**
 * 灌区基础信息Controller
 *
 * @author kerwincui
 * @date 2024-11-04
 */
@RestController
@RequestMapping("/gis/site/irrigated/info")
@Api(tags = "灌区基础信息")
public class GSiteIrrigateInfoController extends BaseController
{
    @Autowired
    private IGSiteIrrigateInfoService gSiteIrrigateInfoService;


    /**
     * 获取灌区基础信息详细信息
     */
//    @PreAuthorize("@ss.hasPermi('ggroup:info:query')")
    @GetMapping(value = "/{id}")
    @ApiOperation("获取灌区基础信息详细信息")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(gSiteIrrigateInfoService.selectGSiteIrrigateInfoBySiteId(id));
    }
    /**
     * 修改灌区基础信息
     */
//    @PreAuthorize("@ss.hasPermi('ggroup:info:edit')")
    @PutMapping
    @ApiOperation("修改灌区基础信息")
    public AjaxResult edit(@RequestBody GSiteIrrigateInfo gSiteIrrigateInfo)
    {
        return toAjax(gSiteIrrigateInfoService.updateGSiteIrrigateInfo(gSiteIrrigateInfo));
    }

}
