package com.fs.company.controller.wx.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.wx.sop.domain.WxSopUserInfo;
import com.fs.wx.sop.service.IWxSopUserInfoService;
import com.fs.common.utils.poi.ExcelUtil;
import com.fs.common.core.page.TableDataInfo;

/**
 * 个微营期详情Controller
 * 
 * @author 吴树波
 * @date 2026-02-24
 */
@RestController
@RequestMapping("/wx/wxSopUserInfo")
public class WxSopUserInfoController extends BaseController
{
    @Autowired
    private IWxSopUserInfoService wxSopUserInfoService;

    /**
     * 查询个微营期详情列表
     */
    @GetMapping("/list")
    public TableDataInfo list(WxSopUserInfo wxSopUserInfo)
    {
        startPage();
        List<WxSopUserInfo> list = wxSopUserInfoService.selectWxSopUserInfoList(wxSopUserInfo);
        return getDataTable(list);
    }

    /**
     * 导出个微营期详情列表
     */
    @Log(title = "个微营期详情", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(WxSopUserInfo wxSopUserInfo)
    {
        List<WxSopUserInfo> list = wxSopUserInfoService.selectWxSopUserInfoList(wxSopUserInfo);
        ExcelUtil<WxSopUserInfo> util = new ExcelUtil<WxSopUserInfo>(WxSopUserInfo.class);
        return util.exportExcel(list, "个微营期详情数据");
    }

    /**
     * 获取个微营期详情详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(wxSopUserInfoService.selectWxSopUserInfoById(id));
    }

    /**
     * 新增个微营期详情
     */
    @Log(title = "个微营期详情", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody WxSopUserInfo wxSopUserInfo)
    {
        return toAjax(wxSopUserInfoService.insertWxSopUserInfo(wxSopUserInfo));
    }

    /**
     * 修改个微营期详情
     */
    @Log(title = "个微营期详情", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody WxSopUserInfo wxSopUserInfo)
    {
        return toAjax(wxSopUserInfoService.updateWxSopUserInfo(wxSopUserInfo));
    }

    /**
     * 删除个微营期详情
     */
    @Log(title = "个微营期详情", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(wxSopUserInfoService.deleteWxSopUserInfoByIds(ids));
    }
}
