/*
 * Author: wangjian
 * 生成controller
 */
package com.tofly.watermeter.controller;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tofly.common.core.entity.ResultRespone;
import com.tofly.common.log.annotation.ToFlyAppLog;
import com.tofly.watermeter.entity.QfmidbzywE;
import com.tofly.watermeter.service.QfmidbzywEService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import org.springframework.web.bind.annotation.ModelAttribute;

import java.util.Arrays;
/**
 * TF_YWPN_QFMIDBZYW_E 报装业务
 *
 * @author wangjieliu
 * @date Wed Apr 14 00:00:00 CST 2021
 */
@RestController
@AllArgsConstructor
@RequestMapping("/qfmidbzywe")
@Api(tags="TF_YWPN_QFMIDBZYW_E 报装业务接口")
public class QfmidbzywEController {

    private final  QfmidbzywEService qfmidbzywEService;

    /**
    * 分页查询
    * @param page 分页对象
    * @param qfmidbzywE TF_YWPN_QFMIDBZYW_E 报装业务
    * @return
    */
    @GetMapping("/page" )
    @ApiOperation(value = "分页查询")
    public ResultRespone getQfmidbzywEPage(Page page, @ModelAttribute QfmidbzywE qfmidbzywE) {
      return ResultRespone.success(qfmidbzywEService.page(page, Wrappers.query(qfmidbzywE)));
    }


    /**
     * 通过id查询TF_YWPN_QFMIDBZYW_E 报装业务
     * @param id id
     * @return ResultRespone
     */
    @GetMapping("/{id}" )
    @ApiOperation(value = "通过ID查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "ID", required = true, dataType = "String")
    })
    public ResultRespone getById(@PathVariable("id" ) String id) {
      return ResultRespone.success(qfmidbzywEService.getById(id));
    }

    /**
     * 新增TF_YWPN_QFMIDBZYW_E 报装业务
     * @param qfmidbzywE TF_YWPN_QFMIDBZYW_E 报装业务
     * @return ResultRespone
     */
    //="新增TF_YWPN_QFMIDBZYW_E 报装业务" )
    @ApiOperation(value = "新增TF_YWPN_QFMIDBZYW_E 报装业务")
    @PostMapping
    public ResultRespone save(@RequestBody QfmidbzywE qfmidbzywE) {
      return ResultRespone.success(qfmidbzywEService.save(qfmidbzywE));
    }

    /**
     * 修改TF_YWPN_QFMIDBZYW_E 报装业务
     * @param qfmidbzywE TF_YWPN_QFMIDBZYW_E 报装业务
     * @return ResultRespone
     */
    //="修改TF_YWPN_QFMIDBZYW_E 报装业务" )
    @ApiOperation(value = "修改TF_YWPN_QFMIDBZYW_E 报装业务")
    @PutMapping
    public ResultRespone updateById(@RequestBody QfmidbzywE qfmidbzywE) {
      return ResultRespone.success(qfmidbzywEService.updateById(qfmidbzywE));
    }

    /**
     * 通过id删除TF_YWPN_QFMIDBZYW_E 报装业务
     * @param id id
     * @return ResultRespone
     */
    //="通过id删除TF_YWPN_QFMIDBZYW_E 报装业务" )
    @ApiOperation(value = "通过ID删除TF_YWPN_QFMIDBZYW_E 报装业务")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "ID", required = true, dataType = "String")
    })
    @DeleteMapping("/{id}" )
    public ResultRespone removeById(@PathVariable String id) {
      return ResultRespone.success(qfmidbzywEService.removeById(id));
    }

    /**
     * 通过id批量删除TF_YWPN_QFMIDBZYW_E 报装业务
     * @param ids id
     * @return ResultRespone
     */
    //="通过id批量删除TF_YWPN_QFMIDBZYW_E 报装业务" )
    @ApiOperation(value = "通过ID批量删除TF_YWPN_QFMIDBZYW_E 报装业务")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "ids", value = "批量删除，多个id以逗号隔开", required = true, dataType = "String")
    })
    @DeleteMapping("/deleteByIds" )
    public ResultRespone removeByIds(String ids) {
        return ResultRespone.success(qfmidbzywEService.removeByIds(Arrays.asList(ids.split(","))));
    }
}
