package com.elephant.framework.galaxy.aroad.module.zhjc.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
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.zhjc.entity.ZhjcXmjcGhxm;
import com.elephant.framework.galaxy.aroad.module.zhjc.service.ZhjcXmjcGhxmService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
import com.elephant.framework.galaxy.aroad.module.common.controller.BaseController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;


/**
 * 规划项目
 *
 * @author zyw
 * @date 2019-04-22 23:22:37
 */
@RestController
@AllArgsConstructor
@RequestMapping("/zhjc/zhjcxmjcghxm")
public class ZhjcXmjcGhxmController extends BaseController  {

  private final  ZhjcXmjcGhxmService zhjcXmjcGhxmService;

  /**
   * 分页查询
   * @param zhjcXmjcGhxm 规划项目
   * @return
   */
  @GetMapping("/list")
  public R getList(ZhjcXmjcGhxm zhjcXmjcGhxm) {
    return  new R<>(zhjcXmjcGhxmService.getList(zhjcXmjcGhxm));
  }


  /**
   * 通过id查询规划项目
   * @param id id
   * @return R
   */
  @GetMapping("/{id}")
  public R getById(@PathVariable("id") Integer id){
    return new R<>(zhjcXmjcGhxmService.getById(id));
  }

  /**
   * 新增规划项目
   * @param zhjcXmjcGhxm 规划项目
   * @return R
   */
  @SysLog("新增规划项目")
  @PostMapping
  public R save(@RequestBody ZhjcXmjcGhxm zhjcXmjcGhxm){
    return new R<>(zhjcXmjcGhxmService.save(zhjcXmjcGhxm));
  }

  /**
   * 修改规划项目
   * @param zhjcXmjcGhxm 规划项目
   * @return R
   */
  @SysLog("修改规划项目")
  @PutMapping
  public R updateById(@RequestBody ZhjcXmjcGhxm zhjcXmjcGhxm){
    return new R<>(zhjcXmjcGhxmService.updateById(zhjcXmjcGhxm));
  }

  /**
   * 通过id删除规划项目
   * @param id id
   * @return R
   */
  @SysLog("删除规划项目")
  @DeleteMapping("/{id}")
  public R removeById(@PathVariable Integer id){
    return new R<>(zhjcXmjcGhxmService.removeById(id));
  }

}
