package com.dkl.large.controller;

import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.dkl.common.annotation.DataScope;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.dkl.common.annotation.Log;
import com.dkl.common.core.controller.BaseController;
import com.dkl.common.core.domain.AjaxResult;
import com.dkl.common.enums.BusinessType;
import com.dkl.large.domain.DklVideoData;
import com.dkl.large.service.IDklVideoDataService;
import com.dkl.common.utils.poi.ExcelUtil;
import com.dkl.common.core.page.TableDataInfo;

/**
 * 大客流视频数据获取Controller
 *
 * @author Dkl
 * @date 2025-06-06
 */
@RestController
@RequestMapping("/large/data")
public class DklVideoDataController extends BaseController
{
    @Autowired
    private IDklVideoDataService dklVideoDataService;

    /**
     * 查询大客流视频数据获取列表
     */
    @GetMapping("/list")
    @DataScope(deptAlias = "d")
    @PreAuthorize("@ss.hasPermi('large:data:list')")
    public TableDataInfo list(DklVideoData dklVideoData)
    {
        startPage();
        List<DklVideoData> list = dklVideoDataService.selectDklVideoDataList(dklVideoData);
        return getDataTable(list);
    }

    /**
     * 导出大客流视频数据获取列表
     */
    @Log(title = "大客流视频数据获取", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DklVideoData dklVideoData)
    {
        List<DklVideoData> list = dklVideoDataService.selectDklVideoDataList(dklVideoData);
        ExcelUtil<DklVideoData> util = new ExcelUtil<DklVideoData>(DklVideoData.class);
        util.exportExcel(response, list, "大客流视频数据获取数据");
    }

    /**
     * 获取大客流视频数据获取详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") int id)
    {
        return success(dklVideoDataService.selectDklVideoDataById(id));
    }

    /**
     * 新增大客流视频数据获取
     */
    @Log(title = "大客流视频数据获取", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DklVideoData dklVideoData)
    {
        //添加系统信息
        dklVideoData.setDelFlag("0");
        dklVideoData.setCreateTime(new Date());
        dklVideoData.setCreateBy(getUsername());
        dklVideoData.setDeptId(getDeptId());
        dklVideoData.setUpdateTime(new Date());
        dklVideoData.setUpdateBy(getUsername());
        return toAjax(dklVideoDataService.insertDklVideoData(dklVideoData));
    }

    /**
     * 修改大客流视频数据获取
     */
    @Log(title = "大客流视频数据获取", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DklVideoData dklVideoData)
    {
        //添加系统信息
        dklVideoData.setUpdateTime(new Date());
        dklVideoData.setUpdateBy(getUsername());
        return toAjax(dklVideoDataService.updateDklVideoData(dklVideoData));
    }

    /**
     * 删除大客流视频数据获取
     */
    @Log(title = "大客流视频数据获取", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable int[] ids)
    {
        return toAjax(dklVideoDataService.deleteDklVideoDataByIds(ids));
    }
}
