/*
 * Author: wangjian
 * 生成controller
 */
package com.tofly.xrtymis.custom.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.xrtymis.custom.service.LeakInfoService;
import com.tofly.xrtymis.entity.LeakInfo;
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;

/**
 * 漏点基本信息表
 *
 * @author admin
 * @date Mon Mar 21 00:00:00 CST 2022
 */
@RestController
@AllArgsConstructor
@RequestMapping("/leakinfo")
@Api(tags="漏点基本信息表接口")
public class LeakInfoController {

    private final LeakInfoService leakInfoService;

    /**
    * 分页查询
    * @param page 分页对象
    * @param leakInfo 漏点基本信息表
    * @return
    */
    @GetMapping("/page" )
    @ApiOperation(value = "分页查询")
    public ResultRespone getLeakInfoPage(Page page, @ModelAttribute LeakInfo leakInfo) {
      return ResultRespone.success(leakInfoService.page(page, Wrappers.query(leakInfo)));
    }


    /**
     * 通过id查询漏点基本信息表
     * @param id id
     * @return ResultRespone
     */
    @GetMapping("/{id}" )
    @ApiOperation(value = "通过ID查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "ID", required = true, dataType = "Long")
    })
    public ResultRespone getById(@PathVariable("id" ) Long id) {
      return ResultRespone.success(leakInfoService.getById(id));
    }

}
