package com.elephant.framework.galaxy.aroad.module.zhjc.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.zhjc.entity.ZhjcGljcXxbsqktjb;
import com.elephant.framework.galaxy.aroad.module.zhjc.service.ZhjcGljcXxbsqktjbService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
import com.elephant.framework.galaxy.aroad.module.common.controller.BaseController;


/**
 * 信息报送情况统计表
 *
 * @author wangjian
 * @date 2019-03-25 11:25:47
 */
@RestController
@AllArgsConstructor
@RequestMapping("/zhjc/zhjcgljcxxbsqktjb")
public class ZhjcGljcXxbsqktjbController extends BaseController  {

  private final  ZhjcGljcXxbsqktjbService zhjcGljcXxbsqktjbService;

  /**
   * 分页查询
   * @param page 分页对象
   * @param zhjcGljcXxbsqktjb 信息报送情况统计表
   * @return
   */
  @GetMapping("/page")
  public R getZhjcGljcXxbsqktjbPage(Page page, ZhjcGljcXxbsqktjb zhjcGljcXxbsqktjb) {
    return  new R<>(zhjcGljcXxbsqktjbService.page(page,Wrappers.query(zhjcGljcXxbsqktjb)));
  }


  /**
   * 通过id查询信息报送情况统计表
   * @param id id
   * @return R
   */
  @GetMapping("/{id}")
  public R getById(@PathVariable("id") Integer id){
    return new R<>(zhjcGljcXxbsqktjbService.getById(id));
  }

  /**
   * 新增信息报送情况统计表
   * @param zhjcGljcXxbsqktjb 信息报送情况统计表
   * @return R
   */
  @SysLog("新增信息报送情况统计表")
  @PostMapping
  public R save(@RequestBody ZhjcGljcXxbsqktjb zhjcGljcXxbsqktjb){
    return new R<>(zhjcGljcXxbsqktjbService.save(zhjcGljcXxbsqktjb));
  }

  /**
   * 修改信息报送情况统计表
   * @param zhjcGljcXxbsqktjb 信息报送情况统计表
   * @return R
   */
  @SysLog("修改信息报送情况统计表")
  @PutMapping
  public R updateById(@RequestBody ZhjcGljcXxbsqktjb zhjcGljcXxbsqktjb){
    return new R<>(zhjcGljcXxbsqktjbService.updateById(zhjcGljcXxbsqktjb));
  }

  /**
   * 通过id删除信息报送情况统计表
   * @param id id
   * @return R
   */
  @SysLog("删除信息报送情况统计表")
  @DeleteMapping("/{id}")
  public R removeById(@PathVariable Integer id){
    return new R<>(zhjcGljcXxbsqktjbService.removeById(id));
  }

}
