package com.ruoyi.web.modules.farming.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.web.modules.farming.domain.dto.TechServicePersonnelSaveRequest;
import com.ruoyi.web.modules.farming.service.IBizTechServicePersonnelService;

/**
 * 科技服务人员管理（GET 查询 + PUT 保存）
 */
@RestController
@RequestMapping("/techService/techServicePersonnel")
public class BizTechServicePersonnelController extends BaseController
{
    @Autowired
    private IBizTechServicePersonnelService bizTechServicePersonnelService;

    @PreAuthorize("@ss.hasPermi('techService:techServicePersonnel:query')")
    @GetMapping
    public AjaxResult getConfig()
    {
        return success(bizTechServicePersonnelService.getCurrentConfig());
    }

    @PreAuthorize("@ss.hasPermi('techService:techServicePersonnel:edit')")
    @Log(title = "科技服务人员管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult save(@RequestBody TechServicePersonnelSaveRequest request)
    {
        return toAjax(bizTechServicePersonnelService.saveConfig(request, getUsername()));
    }
}
