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.ZhjcGljcXzspblqkb;
import com.elephant.framework.galaxy.aroad.module.zhjc.service.ZhjcGljcXzspblqkbService;
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 17:15:13
 */
@RestController
@AllArgsConstructor
@RequestMapping("/zhjc/zhjcgljcxzspblqkb")
public class ZhjcGljcXzspblqkbController extends BaseController  {

  private final  ZhjcGljcXzspblqkbService zhjcGljcXzspblqkbService;

  /**
   * 分页查询
   * @param page 分页对象
   * @param zhjcGljcXzspblqkb 行政审批办理情况表
   * @return
   */
  @GetMapping("/page")
  public R getZhjcGljcXzspblqkbPage(Page page, ZhjcGljcXzspblqkb zhjcGljcXzspblqkb) {
    return  new R<>(zhjcGljcXzspblqkbService.page(page,Wrappers.query(zhjcGljcXzspblqkb)));
  }


  /**
   * 通过id查询行政审批办理情况表
   * @param id id
   * @return R
   */
  @GetMapping("/{id}")
  public R getById(@PathVariable("id") Integer id){
    return new R<>(zhjcGljcXzspblqkbService.getById(id));
  }

  /**
   * 新增行政审批办理情况表
   * @param zhjcGljcXzspblqkb 行政审批办理情况表
   * @return R
   */
  @SysLog("新增行政审批办理情况表")
  @PostMapping
  public R save(@RequestBody ZhjcGljcXzspblqkb zhjcGljcXzspblqkb){
    return new R<>(zhjcGljcXzspblqkbService.save(zhjcGljcXzspblqkb));
  }

  /**
   * 修改行政审批办理情况表
   * @param zhjcGljcXzspblqkb 行政审批办理情况表
   * @return R
   */
  @SysLog("修改行政审批办理情况表")
  @PutMapping
  public R updateById(@RequestBody ZhjcGljcXzspblqkb zhjcGljcXzspblqkb){
    return new R<>(zhjcGljcXzspblqkbService.updateById(zhjcGljcXzspblqkb));
  }

  /**
   * 通过id删除行政审批办理情况表
   * @param id id
   * @return R
   */
  @SysLog("删除行政审批办理情况表")
  @DeleteMapping("/{id}")
  public R removeById(@PathVariable Integer id){
    return new R<>(zhjcGljcXzspblqkbService.removeById(id));
  }

}
