package com.ruoyi.web.modules.industryservice.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.PostMapping;
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.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.web.modules.industryservice.domain.dto.GrassLivestockBalanceCalculateRequest;
import com.ruoyi.web.modules.industryservice.service.IGrassLivestockBalanceService;

/**
 * 草畜平衡计算
 */
@RestController
@RequestMapping("/dataModel/grassLivestockBalance")
public class GrassLivestockBalanceController extends BaseController
{
    @Autowired
    private IGrassLivestockBalanceService grassLivestockBalanceService;

    @PreAuthorize("@ss.hasPermi('dataModel:grassLivestockBalance:query')")
    @PostMapping("/calculate")
    public AjaxResult calculate(@RequestBody GrassLivestockBalanceCalculateRequest request)
    {
        return success(grassLivestockBalanceService.calculate(request));
    }

    @PreAuthorize("@ss.hasPermi('dataModel:grassLivestockBalance:query')")
    @GetMapping("/defaults")
    public AjaxResult defaults()
    {
        return success(grassLivestockBalanceService.getDefaults());
    }
}
