/*
 * 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.QfmidysxzxfbmE;
import com.tofly.watermeter.service.QfmidysxzxfbmEService;
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("/qfmidysxzxfbme")
@Api(tags="沱源_性质细分接口")
public class QfmidysxzxfbmEController {

    private final  QfmidysxzxfbmEService qfmidysxzxfbmEService;

    /**
    * 分页查询
    * @param page 分页对象
    * @param qfmidysxzxfbmE 沱源_性质细分
    * @return
    */
    @GetMapping("/page" )
    @ApiOperation(value = "分页查询")
    public ResultRespone getQfmidysxzxfbmEPage(Page page, @ModelAttribute QfmidysxzxfbmE qfmidysxzxfbmE) {
      return ResultRespone.success(qfmidysxzxfbmEService.page(page, Wrappers.query(qfmidysxzxfbmE)));
    }


    /**
     * 通过id查询沱源_性质细分
     * @param bm id
     * @return ResultRespone
     */
    @GetMapping("/{bm}" )
    @ApiOperation(value = "通过ID查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "bm", value = "ID", required = true, dataType = "String")
    })
    public ResultRespone getById(@PathVariable("bm" ) String bm) {
      return ResultRespone.success(qfmidysxzxfbmEService.getById(bm));
    }

    /**
     * 新增沱源_性质细分
     * @param qfmidysxzxfbmE 沱源_性质细分
     * @return ResultRespone
     */
    //="新增沱源_性质细分" )
    @ApiOperation(value = "新增沱源_性质细分")
    @PostMapping
    public ResultRespone save(@RequestBody QfmidysxzxfbmE qfmidysxzxfbmE) {
      return ResultRespone.success(qfmidysxzxfbmEService.save(qfmidysxzxfbmE));
    }

    /**
     * 修改沱源_性质细分
     * @param qfmidysxzxfbmE 沱源_性质细分
     * @return ResultRespone
     */
    //="修改沱源_性质细分" )
    @ApiOperation(value = "修改沱源_性质细分")
    @PutMapping
    public ResultRespone updateById(@RequestBody QfmidysxzxfbmE qfmidysxzxfbmE) {
      return ResultRespone.success(qfmidysxzxfbmEService.updateById(qfmidysxzxfbmE));
    }

    /**
     * 通过id删除沱源_性质细分
     * @param bm id
     * @return ResultRespone
     */
    //="通过id删除沱源_性质细分" )
    @ApiOperation(value = "通过ID删除沱源_性质细分")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "bm", value = "ID", required = true, dataType = "String")
    })
    @DeleteMapping("/{bm}" )
    public ResultRespone removeById(@PathVariable String bm) {
      return ResultRespone.success(qfmidysxzxfbmEService.removeById(bm));
    }

    /**
     * 通过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(qfmidysxzxfbmEService.removeByIds(Arrays.asList(ids.split(","))));
    }
}
