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


/**
 * VIEW
 *
 * @author wangjian
 * @date 2019-04-08 15:22:28
 */
@RestController
@AllArgsConstructor
@RequestMapping("/zhjs/htgl")
public class ZhjsGchtandgcxmVController extends BaseController  {

  private final  ZhjsGchtandgcxmVService zhjsGchtandgcxmVService;

  /**
   * 分页查询
   * @param page 分页对象
   * @param zhjsGchtandgcxmV VIEW
   * @return
   */
  @GetMapping("/page")
  public R getZhjsGchtandgcxmVPage(Page page, ZhjsGchtandgcxmV zhjsGchtandgcxmV) {
    return  new R<>(zhjsGchtandgcxmVService.page(page,Wrappers.query(zhjsGchtandgcxmV)));
  }


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

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

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

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

}
