package com.agri.system.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.agri.system.domain.SysDtuRemark;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.agri.common.annotation.Log;
import com.agri.common.core.controller.BaseController;
import com.agri.common.core.domain.AjaxResult;
import com.agri.common.enums.BusinessType;
import com.agri.system.domain.SysDtuRemarkBak;
import com.agri.system.service.ISysDtuRemarkBakService;
import com.agri.common.utils.poi.ExcelUtil;
import com.agri.common.core.page.TableDataInfo;

/**
 * dtu设备备注Controller
 * 
 * @author lld
 * @date 2026-03-17
 */
@RestController
@RequestMapping("/assets/remark_bak")
public class SysDtuRemarkBakController extends BaseController
{
    @Autowired
    private ISysDtuRemarkBakService sysDtuRemarkBakService;

    /**
     * 查询dtu设备备注列表
     */
    @PreAuthorize("@ss.hasPermi('assets:remark_bak:list')")
    @GetMapping("/list")
    public TableDataInfo list(SysDtuRemarkBak sysDtuRemarkBak)
    {
        startPage();
        List<SysDtuRemarkBak> list = sysDtuRemarkBakService.selectSysDtuRemarkBakList(sysDtuRemarkBak);
        return getDataTable(list);
    }

    /**
     * 导出dtu设备备注列表
     */
    @PreAuthorize("@ss.hasPermi('assets:remark_bak:export')")
    @Log(title = "dtu设备备注", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, SysDtuRemarkBak sysDtuRemarkBak)
    {
        List<SysDtuRemarkBak> list = sysDtuRemarkBakService.selectSysDtuRemarkBakList(sysDtuRemarkBak);
        ExcelUtil<SysDtuRemarkBak> util = new ExcelUtil<SysDtuRemarkBak>(SysDtuRemarkBak.class);
        util.exportExcel(response, list, "dtu设备备注数据");
    }

    /**
     * 获取dtu设备备注详细信息
     */
    @PreAuthorize("@ss.hasPermi('assets:remark_bak:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(sysDtuRemarkBakService.selectSysDtuRemarkBakById(id));
    }

    /**
     * 新增dtu设备备注
     */
    @PreAuthorize("@ss.hasPermi('assets:remark_bak:add')")
    @Log(title = "dtu设备备注", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SysDtuRemarkBak sysDtuRemarkBak)
    {
        return toAjax(sysDtuRemarkBakService.insertSysDtuRemarkBak(sysDtuRemarkBak));
    }

    /**
     * 修改dtu设备备注
     */
    @PreAuthorize("@ss.hasPermi('assets:remark_bak:edit')")
    @Log(title = "dtu设备备注", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SysDtuRemarkBak sysDtuRemarkBak)
    {
        return toAjax(sysDtuRemarkBakService.updateSysDtuRemarkBak(sysDtuRemarkBak));
    }

    /**
     * 删除dtu设备备注
     */
    @PreAuthorize("@ss.hasPermi('assets:remark_bak:remove')")
    @Log(title = "dtu设备备注", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(sysDtuRemarkBakService.deleteSysDtuRemarkBakByIds(ids));
    }


    /**
     * 获取dtu设备备注详细信息getDtuRemarkByImei
     */
    @PreAuthorize("@ss.hasPermi('assets:remark_bak:list')")
    @GetMapping(value = "/getDtuRemarkByImei")
    public AjaxResult getDtuRemarkByImei(@RequestParam("imei") String imei)
    {
        SysDtuRemarkBak dtuRemark = sysDtuRemarkBakService.getDtuRemarkByImei(imei);
        return success(dtuRemark);
    }

    @PreAuthorize("@ss.hasPermi('assets:remark_bak:add')")
    @Log(title = "dtu设备备注", businessType = BusinessType.INSERT)
    @PostMapping("/saveAgriRemark")
    public AjaxResult saveAgriRemark(@RequestBody SysDtuRemarkBak sysDtuRemarkBak)
    {
        return toAjax(sysDtuRemarkBakService.saveAgriRemark(sysDtuRemarkBak));
    }

}
