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

import com.elephant.framework.galaxy.aroad.module.common.annotation.SysLog;
import com.elephant.framework.galaxy.aroad.module.common.controller.BaseController;
import com.elephant.framework.galaxy.aroad.module.zhjc.entity.ZhjcXmjcGhxm;
import com.elephant.framework.galaxy.aroad.module.zhjc.service.ZhjcXmjcGhxmService;
import com.elephant.framework.galaxy.aroad.response.R;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;


/**
 * 规划项目
 *
 * @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));
  }

  @GetMapping("/gclist")
  public R getGCList() {
    return  new R<>(zhjcXmjcGhxmService.getGCList());
  }


  /**
   * 通过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));
  }

}
