package org.jk.rag.controller;


import cn.dev33.satoken.annotation.SaCheckPermission;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import org.jk.common.core.domain.R;
import org.jk.common.excel.utils.ExcelUtil;
import org.jk.common.log.annotation.Log;
import org.jk.common.log.enums.BusinessType;
import org.jk.common.mybatis.core.page.PageQuery;
import org.jk.common.mybatis.core.page.TableDataInfo;
import org.jk.common.web.core.BaseController;
import org.jk.system.domain.SysProjectStaff;
import org.jk.system.service.ISysProjectStaffService;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * 【请填写功能名称】Controller
 *
 * @author takai
 * @date 2025-05-28
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/system/staff")
public class SysProjectStaffController extends BaseController
{
    private final ISysProjectStaffService sysProjectStaffService;

    /**
     * 查询【请填写功能名称】列表
     */
    //@SaCheckPermission("@ss.hasPermi('system:staff:list')")
    @GetMapping("/list")
    public TableDataInfo list(SysProjectStaff sysProjectStaff, PageQuery pageQuery)
    {
        Page<SysProjectStaff> list = sysProjectStaffService.selectPageList(sysProjectStaff,pageQuery);
        return TableDataInfo.build(list);
    }

    /**
     * 导出【请填写功能名称】列表
     */
    //@SaCheckPermission("@ss.hasPermi('system:staff:export')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, SysProjectStaff sysProjectStaff)
    {
        List<SysProjectStaff> list = sysProjectStaffService.selectSysProjectStaffList(sysProjectStaff);
        ExcelUtil.exportExcel( list, "【请填写功能名称】数据",SysProjectStaff.class,response);
    }

    /**
     * 获取【请填写功能名称】详细信息
     */
    //@SaCheckPermission("@ss.hasPermi('system:staff:query')")
    @GetMapping(value = "/{id}")
    public R<SysProjectStaff> getInfo(@PathVariable("id") Long id)
    {
        return R.ok(sysProjectStaffService.selectSysProjectStaffById(id));
    }

    /**
     * 新增【请填写功能名称】
     */
    //@SaCheckPermission("@ss.hasPermi('system:staff:add')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
    @PostMapping
    public R<Integer> add(@RequestBody SysProjectStaff sysProjectStaff)
    {
        return R.ok(sysProjectStaffService.insertSysProjectStaff(sysProjectStaff));
    }

    /**
     * 修改【请填写功能名称】
     */
    //@SaCheckPermission("@ss.hasPermi('system:staff:edit')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
    @PutMapping
    public R<Integer> edit(@RequestBody SysProjectStaff sysProjectStaff)
    {
        return R.ok(sysProjectStaffService.updateSysProjectStaff(sysProjectStaff));
    }

    /**
     * 删除【请填写功能名称】
     */
    //@SaCheckPermission("@ss.hasPermi('system:staff:remove')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public R<Integer> remove(@PathVariable Long[] ids)
    {
        return R.ok(sysProjectStaffService.deleteSysProjectStaffByIds(ids));
    }
}
