package com.ruoyi.web.controller.shate;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain_shate.UplodFile;
import com.ruoyi.system.service_shate.IRegionalFactorService;
import com.ruoyi.system.service_shate.ISoilFactorService;
import com.ruoyi.system.service_shate.ITopographicFactorService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.lang.reflect.Field;

/**
 * @Author: JinSheng Song
 * @Date: 2022/7/21 18:41
 */
@RestController
@RequestMapping(value = "/api/Total", produces = "application/json;charset=UTF-8")
public class TotalFactorController
{
    @Resource
    private IRegionalFactorService service;

    @Resource
    private ITopographicFactorService factorService;

    @Resource
    private ISoilFactorService soilService;


    @RequestMapping(value = "/selectTotalFactor",method = {RequestMethod.GET})
    @ApiOperation(value = "查询所有因子信息",httpMethod = "GET")
    public AjaxResult selectTotalFactor(String zone,String year)
    {
        UplodFile file=new UplodFile();

        file.setWaterFactors(service.sqlWater(zone,year));

        file.setRegionIndexs(service.sqlRegion(zone,year));

        file.setRoadFactors(service.sqlRoad(zone,year));

        file.setAltitudes(factorService.sqlAltitude(zone,year));

        file.setAspects(factorService.sqlAspect(zone,year));

        file.setSlopes(factorService.sqlSlope(zone,year));

        file.setSoilDesertifications(soilService.sqlDesert(zone,year));

        file.setSoilMoistures(soilService.sqlMoisture(zone,year));

        file.setSoilSalinizations(soilService.sqlSalin(zone,year));

        file.setClimate(service.sqlClimate(zone));

        return  AjaxResult.success(file);
    }
}
