package com.mosty.yjzl.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.mosty.common.base.domain.ResponseResult;
import com.mosty.common.base.entity.log.BusinessType;
import com.mosty.common.base.entity.log.Log;
import com.mosty.common.token.JwtSysUser;
import com.mosty.base.model.entity.yjzl.TbYjDyyjxx;
import com.mosty.base.model.query.yjzl.TbYjDyyjxxQuery;
import com.mosty.yjzl.service.TbYjDyyjxxService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags = "订阅预警信息接口")
@AllArgsConstructor
@RestController
@RequestMapping("/tbYjDyyjxx")
public class TbYjDyyjxxController {

    private TbYjDyyjxxService tbYjDyyjxxService;

    @ApiOperation("分页查询")
    @JwtSysUser
    @GetMapping
    public ResponseResult<IPage<TbYjDyyjxx>> paginQuery(TbYjDyyjxxQuery dto){
        return ResponseResult.success(tbYjDyyjxxService.queryByPage(dto));
    }

    @ApiOperation("新增数据")
    @JwtSysUser
    @PostMapping
    @Log(title = "订阅预警信息新增", businessType = BusinessType.INSERT)
    public ResponseResult<Integer> add(@RequestBody TbYjDyyjxx dyyjxx){
        return ResponseResult.success(tbYjDyyjxxService.insert(dyyjxx));
    }

    @ApiOperation("通过主键删除数据")
    @DeleteMapping("/bacth")
    @Log(title = "订阅预警信息删除", businessType = BusinessType.DELETE)
    public ResponseResult<Integer> deleteByIds(@RequestParam List<String> list){
        return ResponseResult.success(tbYjDyyjxxService.deleteById(list));
    }
}

