package com.zehong.web.controller.supervise;

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.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.enums.BusinessType;
import com.zehong.system.domain.TEmployedPeopleInfoChangelog;
import com.zehong.system.service.ITEmployedPeopleInfoChangelogService;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.common.core.page.TableDataInfo;

/**
 * 从业人员信息变更记录Controller
 *
 * @author zehong
 * @date 2026-03-09
 */
@RestController
@RequestMapping("/system/changelog")
public class TEmployedPeopleInfoChangelogController extends BaseController
{
    @Autowired
    private ITEmployedPeopleInfoChangelogService tEmployedPeopleInfoChangelogService;

    /**
     * 查询从业人员信息变更记录列表
     */
    @GetMapping("/list")
    public TableDataInfo list(TEmployedPeopleInfoChangelog tEmployedPeopleInfoChangelog)
    {
        startPage();
        List<TEmployedPeopleInfoChangelog> list = tEmployedPeopleInfoChangelogService.selectTEmployedPeopleInfoChangelogList(tEmployedPeopleInfoChangelog);
        return getDataTable(list);
    }

    /**
     * 导出从业人员信息变更记录列表
     */
    @Log(title = "从业人员信息变更记录", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(TEmployedPeopleInfoChangelog tEmployedPeopleInfoChangelog)
    {
        List<TEmployedPeopleInfoChangelog> list = tEmployedPeopleInfoChangelogService.selectTEmployedPeopleInfoChangelogList(tEmployedPeopleInfoChangelog);
        ExcelUtil<TEmployedPeopleInfoChangelog> util = new ExcelUtil<TEmployedPeopleInfoChangelog>(TEmployedPeopleInfoChangelog.class);
        return util.exportExcel(list, "从业人员信息变更记录数据");
    }

    /**
     * 获取从业人员信息变更记录详细信息
     */
    @GetMapping(value = "/{employedPeopleId}")
    public AjaxResult getInfo(@PathVariable("employedPeopleId") Long employedPeopleId)
    {
        return AjaxResult.success(tEmployedPeopleInfoChangelogService.selectTEmployedPeopleInfoChangelogById(employedPeopleId));
    }

    /**
     * 新增从业人员信息变更记录
     */
    @Log(title = "从业人员信息变更记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TEmployedPeopleInfoChangelog tEmployedPeopleInfoChangelog)
    {
        return toAjax(tEmployedPeopleInfoChangelogService.insertTEmployedPeopleInfoChangelog(tEmployedPeopleInfoChangelog));
    }

    /**
     * 修改从业人员信息变更记录
     */
    @Log(title = "从业人员信息变更记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TEmployedPeopleInfoChangelog tEmployedPeopleInfoChangelog)
    {
        return toAjax(tEmployedPeopleInfoChangelogService.updateTEmployedPeopleInfoChangelog(tEmployedPeopleInfoChangelog));
    }

    /**
     * 删除从业人员信息变更记录
     */
    @Log(title = "从业人员信息变更记录", businessType = BusinessType.DELETE)
    @DeleteMapping("/{employedPeopleIds}")
    public AjaxResult remove(@PathVariable Long[] employedPeopleIds)
    {
        return toAjax(tEmployedPeopleInfoChangelogService.deleteTEmployedPeopleInfoChangelogByIds(employedPeopleIds));
    }
}