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


/**
 * 督查情况任务分发表
 *
 * @author zyw
 * @date 2019-03-15 16:59:03
 */
@RestController
@AllArgsConstructor
@RequestMapping("/zhjg/zhjgdckhrwff")
public class ZhjgDckhRwFfController extends BaseController  {

  private final  ZhjgDckhRwFfService zhjgDckhRwFfService;

  /**
   * 分页查询
   * @param page 分页对象
   * @param zhjgDckhRwFf 督查情况任务分发表
   * @return
   */
  @GetMapping("/page")
  public R getZhjgDckhRwFfPage(Page page, ZhjgDckhRwFf zhjgDckhRwFf) {
    return  new R<>(zhjgDckhRwFfService.page(page,Wrappers.query(zhjgDckhRwFf)));
  }


  /**
   * 通过id查询督查情况任务分发表
   * @param id id
   * @return R
   */
  @GetMapping("/{id}")
  public R getById(@PathVariable("id") Integer id){
    return new R<>(zhjgDckhRwFfService.getById(id));
  }

  /**
   * 新增督查情况任务分发表
   * @param zhjgDckhRwFf 督查情况任务分发表
   * @return R
   */
  @SysLog("新增督查情况任务分发表")
  @PostMapping
  public R save(@RequestBody ZhjgDckhRwFf zhjgDckhRwFf){
    return new R<>(zhjgDckhRwFfService.save(zhjgDckhRwFf));
  }

  /**
   * 修改督查情况任务分发表
   * @param zhjgDckhRwFf 督查情况任务分发表
   * @return R
   */
  @SysLog("修改督查情况任务分发表")
  @PutMapping
  public R updateById(@RequestBody ZhjgDckhRwFf zhjgDckhRwFf){
    return new R<>(zhjgDckhRwFfService.updateById(zhjgDckhRwFf));
  }

  /**
   * 通过id删除督查情况任务分发表
   * @param id id
   * @return R
   */
  @SysLog("删除督查情况任务分发表")
  @DeleteMapping("/{id}")
  public R removeById(@PathVariable Integer id){
    return new R<>(zhjgDckhRwFfService.removeById(id));
  }

}
