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

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.elephant.framework.galaxy.aroad.response.R;
import com.elephant.framework.galaxy.aroad.module.common.annotation.SysLog;
import com.elephant.framework.galaxy.aroad.module.zhtj.entity.ZhtjZhzsLnsj;
import com.elephant.framework.galaxy.aroad.module.zhtj.service.ZhtjZhzsLnsjService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
import com.elephant.framework.galaxy.aroad.module.common.controller.BaseController;


/**
 * 历年数据
 *
 * @author xuzhitu
 * @date 2019-04-16 17:23:38
 */
@RestController
@AllArgsConstructor
@RequestMapping("/zhtj/zhtjzhzslnsj")
public class ZhtjZhzsLnsjController extends BaseController  {

  private final  ZhtjZhzsLnsjService zhtjZhzsLnsjService;

  /**
   * 分页查询
   * @param page 分页对象
   * @param zhtjZhzsLnsj 历年数据
   * @return
   */
  @GetMapping("/page")
  public R getZhtjZhzsLnsjPage(Page page, ZhtjZhzsLnsj zhtjZhzsLnsj) {
    return  new R<>(zhtjZhzsLnsjService.page(page,Wrappers.query(zhtjZhzsLnsj)));
  }

  /**
   * 分页查询
   * @param year 年份
   * @return
   */
  @GetMapping("/getInfoByYear")
  public R getListByYear(String year) {
    return  new R<>(zhtjZhzsLnsjService.getListByYear(year));
  }

  /**
   * 通过id查询历年数据
   * @param id id
   * @return R
   */
  @GetMapping("/{id}")
  public R getById(@PathVariable("id") Integer id){
    return new R<>(zhtjZhzsLnsjService.getById(id));
  }



  /**
   * 查询全省和普通国省道历年数据
   * @param zhtjZhzsLnsj 历年数据
   * @return
   */
  @GetMapping("/lnsj")
  public R getLnsj(ZhtjZhzsLnsj zhtjZhzsLnsj) {
    return  new R<>(zhtjZhzsLnsjService.selectLnsj(zhtjZhzsLnsj));
  }

}
