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


/**
 * VIEW
 *
 * @author wangjian
 * @date 2019-03-22 15:05:25
 */
@RestController
@AllArgsConstructor
@RequestMapping("/zhjg/zhjgaqscaqscsgyb")
public class ZhjgAqscAqscsgybzhubandzibVController extends BaseController  {

  private final  ZhjgAqscAqscsgybzhubandzibVService zhjgAqscAqscsgybzhubandzibVService;

  /**
   * 分页查询
   * @param page 分页对象
   * @param zhjgAqscAqscsgybzhubandzibV VIEW
   * @return
   */
  @GetMapping("/page")
  public R getZhjgAqscAqscsgybzhubandzibVPage(Page page, ZhjgAqscAqscsgybzhubandzibV zhjgAqscAqscsgybzhubandzibV) {
    return  new R<>(zhjgAqscAqscsgybzhubandzibVService.page(page,Wrappers.query(zhjgAqscAqscsgybzhubandzibV)));
  }


  /**
   * 通过id查询VIEW
   * @param id id
   * @return R
   */
  @GetMapping("/{id}")
  public R getById(@PathVariable("id") Integer id){
    return new R<>(zhjgAqscAqscsgybzhubandzibVService.getById(id));
  }

  /**
   * 新增VIEW
   * @param zhjgAqscAqscsgybzhubandzibV VIEW
   * @return R
   */
  @SysLog("新增VIEW")
  @PostMapping
  public R save(@RequestBody ZhjgAqscAqscsgybzhubandzibV zhjgAqscAqscsgybzhubandzibV){
    return new R<>(zhjgAqscAqscsgybzhubandzibVService.save(zhjgAqscAqscsgybzhubandzibV));
  }

  /**
   * 修改VIEW
   * @param zhjgAqscAqscsgybzhubandzibV VIEW
   * @return R
   */
  @SysLog("修改VIEW")
  @PutMapping
  public R updateById(@RequestBody ZhjgAqscAqscsgybzhubandzibV zhjgAqscAqscsgybzhubandzibV){
    return new R<>(zhjgAqscAqscsgybzhubandzibVService.updateById(zhjgAqscAqscsgybzhubandzibV));
  }

  /**
   * 通过id删除VIEW
   * @param id id
   * @return R
   */
  @SysLog("删除VIEW")
  @DeleteMapping("/{id}")
  public R removeById(@PathVariable Integer id){
    return new R<>(zhjgAqscAqscsgybzhubandzibVService.removeById(id));
  }

}
