package com.fs.qw;


import com.fs.common.annotation.Log;
import com.fs.common.core.controller.BaseController;
import com.fs.common.core.domain.AjaxResult;
import com.fs.common.core.domain.R;
import com.fs.common.core.page.TableDataInfo;
import com.fs.common.enums.BusinessType;
import com.fs.core.security.LoginUser;
import com.fs.core.web.service.TokenService;
import com.fs.qw.mapper.QwUserMapper;
import com.fs.qw.param.SopUserLogsVO;
import com.fs.sop.domain.SopUserLogs;
import com.fs.sop.params.SopUserLogsParam;
import com.fs.sop.service.ISopUserLogsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * sopUserLogsController
 *
 * @author fs
 * @date 2024-12-27
 */
@RestController
@RequestMapping("/qwSop/sopUserLogs")
public class SopUserLogsController extends BaseController
{
    @Autowired
    private ISopUserLogsService sopUserLogsService;
    @Autowired
    private TokenService tokenService;
    @Autowired
    private QwUserMapper qwUserMapper;
    /**
     * 查询sopUserLogs列表
     */
    @PreAuthorize("@ss.hasPermi('qw:sop:list')")
    @GetMapping("/list")
    public TableDataInfo list(SopUserLogsParam sopUserLogs)
    {
        startPage();
        List<SopUserLogsVO> list = sopUserLogsService.selectSopUserLogsList(sopUserLogs);
        list.forEach(item->{
            item.setQwUserName(qwUserMapper.selectQwUserByQwUserIdAndCorpId(item.getQwUserId(), item.getCorpId()));
        });
        return getDataTable(list);
    }

//    /**
//     * 导出sopUserLogs列表
//     */
//    @PreAuthorize("@ss.hasPermi('qwSop:sopUserLogs:export')")
//    @Log(title = "sopUserLogs", businessType = BusinessType.EXPORT)
//    @GetMapping("/export")
//    public AjaxResult export(SopUserLogs sopUserLogs)
//    {
//        List<SopUserLogs> list = sopUserLogsService.selectSopUserLogsList(sopUserLogs);
//        ExcelUtil<SopUserLogs> util = new ExcelUtil<SopUserLogs>(SopUserLogs.class);
//        return util.exportExcel(list, "sopUserLogs数据");
//    }

    /**
     * 获取sopUserLogs详细信息
     */
    @PreAuthorize("@ss.hasPermi('qw:sop:list')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return AjaxResult.success(sopUserLogsService.selectSopUserLogsById(id));
    }

    /**
    * 修复营期
    */

    @Log(title = "repairSopUserLogs", businessType = BusinessType.UPDATE)
    @PostMapping("/repairSopUserLogs")
    public R repairSopUserLogs(@RequestBody SopUserLogs sopUserLogs){

        return sopUserLogsService.repairSopUserLogs(sopUserLogs);
    }


//    /**
//     * 删除sopUserLogs
//     */
//    @PreAuthorize("@ss.hasPermi('qwSop:sopUserLogs:remove')")
//    @Log(title = "sopUserLogs", businessType = BusinessType.DELETE)
//	@DeleteMapping("/{ids}")
//    public AjaxResult remove(@PathVariable Long[] ids)
//    {
//        return toAjax(sopUserLogsService.deleteSopUserLogsByIds(ids));
//    }
}
