/*
 * 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.QfmidjfjlE;
import com.tofly.watermeter.service.QfmidjfjlEService;
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;
/**
 * 沱源_计费记录表
 *
 * @author wangjieliu
 * @date Wed Apr 14 00:00:00 CST 2021
 */
@RestController
@AllArgsConstructor
@RequestMapping("/qfmidjfjle")
@Api(tags="沱源_计费记录表接口")
public class QfmidjfjlEController {

    private final  QfmidjfjlEService qfmidjfjlEService;

    /**
    * 分页查询
    * @param page 分页对象
    * @param qfmidjfjlE 沱源_计费记录表
    * @return
    */
    @GetMapping("/page" )
    @ApiOperation(value = "分页查询")
    public ResultRespone getQfmidjfjlEPage(Page page, @ModelAttribute QfmidjfjlE qfmidjfjlE) {
      return ResultRespone.success(qfmidjfjlEService.page(page, Wrappers.query(qfmidjfjlE)));
    }


    /**
     * 通过id查询沱源_计费记录表
     * @param lsbh id
     * @return ResultRespone
     */
    @GetMapping("/{lsbh}" )
    @ApiOperation(value = "通过ID查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "lsbh", value = "ID", required = true, dataType = "String")
    })
    public ResultRespone getById(@PathVariable("lsbh" ) String lsbh) {
      return ResultRespone.success(qfmidjfjlEService.getById(lsbh));
    }

    /**
     * 新增沱源_计费记录表
     * @param qfmidjfjlE 沱源_计费记录表
     * @return ResultRespone
     */
    //="新增沱源_计费记录表" )
    @ApiOperation(value = "新增沱源_计费记录表")
    @PostMapping
    public ResultRespone save(@RequestBody QfmidjfjlE qfmidjfjlE) {
      return ResultRespone.success(qfmidjfjlEService.save(qfmidjfjlE));
    }

    /**
     * 修改沱源_计费记录表
     * @param qfmidjfjlE 沱源_计费记录表
     * @return ResultRespone
     */
    //="修改沱源_计费记录表" )
    @ApiOperation(value = "修改沱源_计费记录表")
    @PutMapping
    public ResultRespone updateById(@RequestBody QfmidjfjlE qfmidjfjlE) {
      return ResultRespone.success(qfmidjfjlEService.updateById(qfmidjfjlE));
    }

    /**
     * 通过id删除沱源_计费记录表
     * @param lsbh id
     * @return ResultRespone
     */
    //="通过id删除沱源_计费记录表" )
    @ApiOperation(value = "通过ID删除沱源_计费记录表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "lsbh", value = "ID", required = true, dataType = "String")
    })
    @DeleteMapping("/{lsbh}" )
    public ResultRespone removeById(@PathVariable String lsbh) {
      return ResultRespone.success(qfmidjfjlEService.removeById(lsbh));
    }

    /**
     * 通过id批量删除沱源_计费记录表
     * @param ids id
     * @return ResultRespone
     */
    //="通过id批量删除沱源_计费记录表" )
    @ApiOperation(value = "通过ID批量删除沱源_计费记录表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "ids", value = "批量删除，多个id以逗号隔开", required = true, dataType = "String")
    })
    @DeleteMapping("/deleteByIds" )
    public ResultRespone removeByIds(String ids) {
        return ResultRespone.success(qfmidjfjlEService.removeByIds(Arrays.asList(ids.split(","))));
    }
}
