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


/**
 * 智慧建设_汇总明细
 *
 * @author wangjian
 * @date 2019-05-17 17:50:54
 */
@RestController
@AllArgsConstructor
@RequestMapping("/zhj/shzmx")
public class ZhjsHzmxController extends BaseController  {

  private final  ZhjsHzmxService zhjsHzmxService;

  /**
   * 分页查询
   * @param page 分页对象
   * @param zhjsHzmx 智慧建设_汇总明细
   * @return
   */
  @GetMapping("/page")
  public R getZhjsHzmxPage(Page page, ZhjsHzmx zhjsHzmx) {
    return  new R<>(zhjsHzmxService.page(page,Wrappers.query(zhjsHzmx)));
  }


  /**
   * 通过id查询智慧建设_汇总明细
   * @param id id
   * @return R
   */
  @GetMapping("/{id}")
  public R getById(@PathVariable("id") String id){
    return new R<>(zhjsHzmxService.getById(id));
  }

  /**
   * 新增智慧建设_汇总明细
   * @param zhjsHzmx 智慧建设_汇总明细
   * @return R
   */
  @SysLog("新增智慧建设_汇总明细")
  @PostMapping
  public R save(@RequestBody ZhjsHzmx zhjsHzmx){
    return new R<>(zhjsHzmxService.save(zhjsHzmx));
  }

  /**
   * 修改智慧建设_汇总明细
   * @param zhjsHzmx 智慧建设_汇总明细
   * @return R
   */
  @SysLog("修改智慧建设_汇总明细")
  @PutMapping
  public R updateById(@RequestBody ZhjsHzmx zhjsHzmx){
    return new R<>(zhjsHzmxService.updateById(zhjsHzmx));
  }

  /**
   * 通过id删除智慧建设_汇总明细
   * @param id id
   * @return R
   */
  @SysLog("删除智慧建设_汇总明细")
  @DeleteMapping("/{id}")
  public R removeById(@PathVariable String id){
    return new R<>(zhjsHzmxService.removeById(id));
  }

}
