package com.yanzhu.jh.project.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
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.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.yanzhu.jh.project.domain.SurProjectAttendanceGroup;
import com.yanzhu.jh.project.service.ISurProjectAttendanceGroupService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 广联达班组信息Controller
 * 
 * @author ruoyi
 * @date 2023-09-26
 */
@RestController
@RequestMapping("/project/gldAttendanceGroup")
public class SurProjectAttendanceGroupController extends BaseController
{
    @Autowired
    private ISurProjectAttendanceGroupService surProjectAttendanceGroupService;

    /**
     * 查询广联达班组信息列表
     */
    @PreAuthorize("@ss.hasPermi('project:gldAttendanceGroup:list')")
    @GetMapping("/list")
    public TableDataInfo list(SurProjectAttendanceGroup surProjectAttendanceGroup)
    {
        startPage();
        List<SurProjectAttendanceGroup> list = surProjectAttendanceGroupService.selectSurProjectAttendanceGroupList(surProjectAttendanceGroup);
        return getDataTable(list);
    }

    /**
     * 导出广联达班组信息列表
     */
    @PreAuthorize("@ss.hasPermi('project:gldAttendanceGroup:export')")
    @Log(title = "广联达班组信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, SurProjectAttendanceGroup surProjectAttendanceGroup)
    {
        List<SurProjectAttendanceGroup> list = surProjectAttendanceGroupService.selectSurProjectAttendanceGroupList(surProjectAttendanceGroup);
        ExcelUtil<SurProjectAttendanceGroup> util = new ExcelUtil<SurProjectAttendanceGroup>(SurProjectAttendanceGroup.class);
        util.exportExcel(response, list, "广联达班组信息数据");
    }

    /**
     * 获取广联达班组信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('project:gldAttendanceGroup:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(surProjectAttendanceGroupService.selectSurProjectAttendanceGroupById(id));
    }

    /**
     * 新增广联达班组信息
     */
    @PreAuthorize("@ss.hasPermi('project:gldAttendanceGroup:add')")
    @Log(title = "广联达班组信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SurProjectAttendanceGroup surProjectAttendanceGroup)
    {
        return toAjax(surProjectAttendanceGroupService.insertSurProjectAttendanceGroup(surProjectAttendanceGroup));
    }

    /**
     * 修改广联达班组信息
     */
    @PreAuthorize("@ss.hasPermi('project:gldAttendanceGroup:edit')")
    @Log(title = "广联达班组信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SurProjectAttendanceGroup surProjectAttendanceGroup)
    {
        return toAjax(surProjectAttendanceGroupService.updateSurProjectAttendanceGroup(surProjectAttendanceGroup));
    }

    /**
     * 删除广联达班组信息
     */
    @PreAuthorize("@ss.hasPermi('project:gldAttendanceGroup:remove')")
    @Log(title = "广联达班组信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(surProjectAttendanceGroupService.deleteSurProjectAttendanceGroupByIds(ids));
    }
}
