/*
 * 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.QfmidcbqfmxE;
import com.tofly.watermeter.service.QfmidcbqfmxEService;
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_QFMIDCBQFMX_E 当月抄表明细
 *
 * @author wangjieliu
 * @date Wed Apr 14 00:00:00 CST 2021
 */
@RestController
@AllArgsConstructor
@RequestMapping("/qfmidcbqfmxe")
@Api(tags="TF_YWPN_QFMIDCBQFMX_E 当月抄表明细接口")
public class QfmidcbqfmxEController {

    private final  QfmidcbqfmxEService qfmidcbqfmxEService;

    /**
    * 分页查询
    * @param page 分页对象
    * @param qfmidcbqfmxE TF_YWPN_QFMIDCBQFMX_E 当月抄表明细
    * @return
    */
    @GetMapping("/page" )
    @ApiOperation(value = "分页查询")
    public ResultRespone getQfmidcbqfmxEPage(Page page, @ModelAttribute QfmidcbqfmxE qfmidcbqfmxE) {
      return ResultRespone.success(qfmidcbqfmxEService.page(page, Wrappers.query(qfmidcbqfmxE)));
    }


    /**
     * 通过id查询TF_YWPN_QFMIDCBQFMX_E 当月抄表明细
     * @param yhbh id
     * @return ResultRespone
     */
    @GetMapping("/{yhbh}" )
    @ApiOperation(value = "通过ID查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "yhbh", value = "ID", required = true, dataType = "String")
    })
    public ResultRespone getById(@PathVariable("yhbh" ) String yhbh) {
      return ResultRespone.success(qfmidcbqfmxEService.getById(yhbh));
    }

    /**
     * 新增TF_YWPN_QFMIDCBQFMX_E 当月抄表明细
     * @param qfmidcbqfmxE TF_YWPN_QFMIDCBQFMX_E 当月抄表明细
     * @return ResultRespone
     */
    //="新增TF_YWPN_QFMIDCBQFMX_E 当月抄表明细" )
    @ApiOperation(value = "新增TF_YWPN_QFMIDCBQFMX_E 当月抄表明细")
    @PostMapping
    public ResultRespone save(@RequestBody QfmidcbqfmxE qfmidcbqfmxE) {
      return ResultRespone.success(qfmidcbqfmxEService.save(qfmidcbqfmxE));
    }

    /**
     * 修改TF_YWPN_QFMIDCBQFMX_E 当月抄表明细
     * @param qfmidcbqfmxE TF_YWPN_QFMIDCBQFMX_E 当月抄表明细
     * @return ResultRespone
     */
    //="修改TF_YWPN_QFMIDCBQFMX_E 当月抄表明细" )
    @ApiOperation(value = "修改TF_YWPN_QFMIDCBQFMX_E 当月抄表明细")
    @PutMapping
    public ResultRespone updateById(@RequestBody QfmidcbqfmxE qfmidcbqfmxE) {
      return ResultRespone.success(qfmidcbqfmxEService.updateById(qfmidcbqfmxE));
    }

    /**
     * 通过id删除TF_YWPN_QFMIDCBQFMX_E 当月抄表明细
     * @param yhbh id
     * @return ResultRespone
     */
    //="通过id删除TF_YWPN_QFMIDCBQFMX_E 当月抄表明细" )
    @ApiOperation(value = "通过ID删除TF_YWPN_QFMIDCBQFMX_E 当月抄表明细")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "yhbh", value = "ID", required = true, dataType = "String")
    })
    @DeleteMapping("/{yhbh}" )
    public ResultRespone removeById(@PathVariable String yhbh) {
      return ResultRespone.success(qfmidcbqfmxEService.removeById(yhbh));
    }

    /**
     * 通过id批量删除TF_YWPN_QFMIDCBQFMX_E 当月抄表明细
     * @param ids id
     * @return ResultRespone
     */
    //="通过id批量删除TF_YWPN_QFMIDCBQFMX_E 当月抄表明细" )
    @ApiOperation(value = "通过ID批量删除TF_YWPN_QFMIDCBQFMX_E 当月抄表明细")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "ids", value = "批量删除，多个id以逗号隔开", required = true, dataType = "String")
    })
    @DeleteMapping("/deleteByIds" )
    public ResultRespone removeByIds(String ids) {
        return ResultRespone.success(qfmidcbqfmxEService.removeByIds(Arrays.asList(ids.split(","))));
    }
}
