Newer
Older
huludao / src / main / java / com / newfiber / api / pc / controller / WaterQuality / SiteInfoBasisController.java
package com.newfiber.api.pc.controller.WaterQuality;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.newfiber.api.core.bean.ReqBodyObj;
import com.newfiber.api.core.bean.RespBodyObj;
import com.newfiber.api.pc.dao.WaterQuality.ProSiteInfoDao;
import com.newfiber.api.pc.dao.WaterQuality.SiteInfoBasisDao;
import com.newfiber.api.pc.dao.WaterQuality.WaterQualityDataDao;
import com.newfiber.api.pc.model.WaterQuality.SiteInfoBasis;
import com.newfiber.api.pc.model.WaterQuality.WaterQualityData;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by XuChengChao on 2019/5/14.
 */
@RestController
public class SiteInfoBasisController {

    @Autowired
    private SiteInfoBasisDao siteInfoBasisDao;

    @Autowired
    private WaterQualityDataDao waterQualityDataDao;

    @Resource
    private ProSiteInfoDao proSiteInfoDao;

    /**
     * 查询所有站点信息
     * @return
     */
    @PostMapping("getSiteList")
    public RespBodyObj getSiteList(){
        List<SiteInfoBasis> list = siteInfoBasisDao.selectAll();
        return RespBodyObj.ok(list);

    }

    /**
     * 获取所有站点的监测数据
     * @return
     */
    @PostMapping("getSiteMonitorData")
    public RespBodyObj getSiteMonitorData(){
//        List<SiteInfoBasis> list = siteInfoBasisDao.selectAll();
        return RespBodyObj.ok(proSiteInfoDao.selectList(new EntityWrapper<>()));
    }

    @PostMapping("getSiteData")
    public RespBodyObj getSiteData(@RequestBody ReqBodyObj<Map<String,String>> param){
        String siteNo = param.getData().get("siteNO");
        List<WaterQualityData> data = waterQualityDataDao.selectLatestData(siteNo);
        return RespBodyObj.ok(data);

    }
}