package com.elephant.framework.galaxy.aroad.module.zhjc.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.elephant.framework.galaxy.aroad.module.common.controller.BaseController;
import com.elephant.framework.galaxy.aroad.module.zhjc.service.ZhjcZljcJtfzfxService;
import com.elephant.framework.galaxy.aroad.response.R;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * 交通发展分析视图
 *
 * @author wangjian
 * @date 2019-04-18 16:07:05
 */
@RestController
@AllArgsConstructor
@RequestMapping("/zhjc/zhjczljcjtfzfx")
public class ZhjcZljcJtfzfxController extends BaseController {

    private final ZhjcZljcJtfzfxService zhjcZljcJtfzfxService;

    /**
     * 获取mapData数据
     *
     * @param year 年度
     * @return
     */
    @GetMapping("/list/{year}")
    public R getMapDataList(@PathVariable("year") String year) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("year", year);
        return new R<>(zhjcZljcJtfzfxService.list(queryWrapper));
    }


    /**
     * 获取lineData数据
     *
     * @param area 地市
     * @return
     */
    @GetMapping("/getLineData/{area}")
    public R getLineData(@PathVariable("area") String area) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("area", area);
        queryWrapper.orderByAsc("year");
        return new R<>(zhjcZljcJtfzfxService.list(queryWrapper));
    }

}
