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


/**
 * 市局重点监管桥梁
 *
 * @author wangjian
 * @date 2019-04-22 10:53:58
 */
@RestController
@AllArgsConstructor
@RequestMapping("/zhyh/qldtjgsjzdjgql")
public class ZhyhQldtjgSjzdjgqlController extends BaseController  {

  private final  ZhyhQldtjgSjzdjgqlService zhyhQldtjgSjzdjgqlService;

  /**
   * 分页查询
   * @param page 分页对象
   * @param zhyhQldtjgSjzdjgql 市局重点监管桥梁
   * @return
   */
  @GetMapping("/page")
  public R getZhyhQldtjgSjzdjgqlPage(Page page, ZhyhQldtjgSjzdjgql zhyhQldtjgSjzdjgql) {
    return  new R<>(zhyhQldtjgSjzdjgqlService.page(page,Wrappers.query(zhyhQldtjgSjzdjgql)));
  }


  /**
   * 通过id查询市局重点监管桥梁
   * @param id id
   * @return R
   */
  @GetMapping("/{id}")
  public R getById(@PathVariable("id") String id){
    return new R<>(zhyhQldtjgSjzdjgqlService.getById(id));
  }

  /**
   * 新增市局重点监管桥梁
   * @param zhyhQldtjgSjzdjgql 市局重点监管桥梁
   * @return R
   */
  @SysLog("新增市局重点监管桥梁")
  @PostMapping
  public R save(@RequestBody ZhyhQldtjgSjzdjgql zhyhQldtjgSjzdjgql){
    return new R<>(zhyhQldtjgSjzdjgqlService.save(zhyhQldtjgSjzdjgql));
  }

  /**
   * 修改市局重点监管桥梁
   * @param zhyhQldtjgSjzdjgql 市局重点监管桥梁
   * @return R
   */
  @SysLog("修改市局重点监管桥梁")
  @PutMapping
  public R updateById(@RequestBody ZhyhQldtjgSjzdjgql zhyhQldtjgSjzdjgql){
    return new R<>(zhyhQldtjgSjzdjgqlService.updateById(zhyhQldtjgSjzdjgql));
  }

  /**
   * 通过id删除市局重点监管桥梁
   * @param id id
   * @return R
   */
  @SysLog("删除市局重点监管桥梁")
  @DeleteMapping("/{id}")
  public R removeById(@PathVariable String id){
    return new R<>(zhyhQldtjgSjzdjgqlService.removeById(id));
  }

}
