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

import java.util.List;
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.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
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.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.web.modules.industryservice.domain.BizYakDiseaseWarning;
import com.ruoyi.web.modules.industryservice.service.IBizYakDiseaseWarningService;

/**
 * 牦牛疾病预警
 */
@RestController
@RequestMapping("/dataModel/yakDiseaseWarning")
public class BizYakDiseaseWarningController extends BaseController
{
    @Autowired
    private IBizYakDiseaseWarningService bizYakDiseaseWarningService;

    @PreAuthorize("@ss.hasPermi('dataModel:yakDiseaseWarning:list')")
    @GetMapping("/list")
    public TableDataInfo list(BizYakDiseaseWarning query)
    {
        startPage();
        List<BizYakDiseaseWarning> list = bizYakDiseaseWarningService.selectBizYakDiseaseWarningList(query);
        return getDataTable(list);
    }

    @PreAuthorize("@ss.hasPermi('dataModel:yakDiseaseWarning:query')")
    @GetMapping("/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(bizYakDiseaseWarningService.selectBizYakDiseaseWarningById(id, null));
    }

    @PreAuthorize("@ss.hasPermi('dataModel:yakDiseaseWarning:sync')")
    @Log(title = "牦牛疾病预警", businessType = BusinessType.OTHER)
    @PostMapping("/sync")
    public AjaxResult sync()
    {
        return success(bizYakDiseaseWarningService.syncFromThirdParty());
    }
}
