package com.fjhx.iot.controller.tda;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.fjhx.common.constant.SourceConstant;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.iot.entity.tda.vo.TdaConfigVo;
import com.fjhx.iot.entity.tda.dto.TdaConfigSelectDto;
import com.fjhx.iot.entity.tda.dto.TdaConfigDto;
import com.ruoyi.common.core.domain.BaseSelectDto;
import com.fjhx.iot.service.tda.TdaConfigService;
import org.springframework.beans.factory.annotation.Autowired;


/**
 * <p>
 * iot配置 前端控制器
 * </p>
 *
 * @author zlj
 * @since 2023-03-21
 */
@DS(SourceConstant.IOT)
@RestController
@RequestMapping("/tdaConfig")
public class TdaConfigController {

    @Autowired
    private TdaConfigService tdaConfigService;

    /**
     * iot配置分页
     */
    @PostMapping("/page")
    public Page<TdaConfigVo> page(@RequestBody TdaConfigSelectDto dto) {
        return tdaConfigService.getPage(dto);
    }

    /**
     * iot配置明细
     */
    @PostMapping("/detail")
    public TdaConfigVo detail(@RequestBody BaseSelectDto dto) {
        return tdaConfigService.detail(dto.getId());
    }

    /**
     * iot配置新增
     */
    @PostMapping("/add")
    public void add(@RequestBody TdaConfigDto tdaConfigDto) {
        tdaConfigService.add(tdaConfigDto);
    }

    /**
     * iot配置编辑
     */
    @PostMapping("/edit")
    public void edit(@RequestBody TdaConfigDto tdaConfigDto) {
        tdaConfigService.edit(tdaConfigDto);
    }

    /**
     * iot配置删除
     */
    @PostMapping("/delete")
    public void delete(@RequestBody BaseSelectDto dto) {
        tdaConfigService.delete(dto.getId());
    }

}
