package com.fs.company.controller;

import java.util.List;
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.fs.common.annotation.Log;
import com.fs.common.core.controller.BaseController;
import com.fs.common.core.domain.AjaxResult;
import com.fs.common.enums.BusinessType;
import com.fs.company.domain.CompanyLogininfor;
import com.fs.company.service.ICompanyLogininforService;
import com.fs.common.utils.poi.ExcelUtil;
import com.fs.common.core.page.TableDataInfo;

/**
 * 系统访问记录Controller
 * 
 * @author fs
 * @date 2021-10-04
 */
@RestController
@RequestMapping("/company/companyLogininfor")
public class CompanyLogininforController extends BaseController
{
    @Autowired
    private ICompanyLogininforService companyLogininforService;

    /**
     * 查询系统访问记录列表
     */
    @PreAuthorize("@ss.hasPermi('company:companyLogininfor:list')")
    @GetMapping("/list")
    public TableDataInfo list(CompanyLogininfor companyLogininfor)
    {
        startPage();
        List<CompanyLogininfor> list = companyLogininforService.selectCompanyLogininforList(companyLogininfor);
        return getDataTable(list);
    }

    /**
     * 导出系统访问记录列表
     */
    @PreAuthorize("@ss.hasPermi('company:companyLogininfor:export')")
    @Log(title = "系统访问记录", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(CompanyLogininfor companyLogininfor)
    {
        List<CompanyLogininfor> list = companyLogininforService.selectCompanyLogininforList(companyLogininfor);
        ExcelUtil<CompanyLogininfor> util = new ExcelUtil<CompanyLogininfor>(CompanyLogininfor.class);
        return util.exportExcel(list, "companyLogininfor");
    }

    /**
     * 获取系统访问记录详细信息
     */
    @PreAuthorize("@ss.hasPermi('company:companyLogininfor:query')")
    @GetMapping(value = "/{infoId}")
    public AjaxResult getInfo(@PathVariable("infoId") Long infoId)
    {
        return AjaxResult.success(companyLogininforService.selectCompanyLogininforById(infoId));
    }

    /**
     * 新增系统访问记录
     */
    @PreAuthorize("@ss.hasPermi('company:companyLogininfor:add')")
    @Log(title = "系统访问记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody CompanyLogininfor companyLogininfor)
    {
        return toAjax(companyLogininforService.insertCompanyLogininfor(companyLogininfor));
    }

    /**
     * 修改系统访问记录
     */
    @PreAuthorize("@ss.hasPermi('company:companyLogininfor:edit')")
    @Log(title = "系统访问记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody CompanyLogininfor companyLogininfor)
    {
        return toAjax(companyLogininforService.updateCompanyLogininfor(companyLogininfor));
    }

    /**
     * 删除系统访问记录
     */
    @PreAuthorize("@ss.hasPermi('company:companyLogininfor:remove')")
    @Log(title = "系统访问记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{infoIds}")
    public AjaxResult remove(@PathVariable Long[] infoIds)
    {
        return toAjax(companyLogininforService.deleteCompanyLogininforByIds(infoIds));
    }
}
