package com.yunfeiyun.agmp.fms.controller;

import com.yunfeiyun.agmp.common.core.controller.BaseController;
import com.yunfeiyun.agmp.common.core.page.TableDataInfo;
import com.yunfeiyun.agmp.fms.domain.reqvo.FmsCalarmListReqVo;
import com.yunfeiyun.agmp.fms.domain.resvo.FmsCalarmListResVo;
import com.yunfeiyun.agmp.fms.service.IFmsCropcalarmService;
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.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Controller
 * 
 * @author 杨晓辉
 * @date 2023-05-15
 */
@RestController
@RequestMapping("/fms/cropcalarm")
public class FmsCropcalarmController extends BaseController
{
    @Autowired
    private IFmsCropcalarmService fmsCropcalarmService;

    /**
     * 查询病虫害列表
     */
    @PreAuthorize("@ss.hasPermi('fms:cropcalarm:list')")
    @GetMapping("/list")
    public TableDataInfo list(FmsCalarmListReqVo reqVo)
    {
        startPage();
        List<FmsCalarmListResVo> list = fmsCropcalarmService.selectFmsCropcalarmList(reqVo);
        return getDataTable(list);
    }

    /**
     * 查询病虫害库存在的作物名称
     */
    @PreAuthorize("@ss.hasPermi('fms:cropcalarm:name:list')")
    @GetMapping("/name/list")
    public TableDataInfo selectNameListForCalarm(FmsCalarmListReqVo reqVo)
    {
        List<FmsCalarmListResVo> fmsCropcalarms = fmsCropcalarmService.selectNameListForCalarm(reqVo);
        return getDataTable(fmsCropcalarms);
    }
}
