package com.ruoyi.web.v2.controller;


import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.web.v2.model.JsTraining;
import com.ruoyi.web.v2.service.IJsTrainingService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * <p>
 * v2.0员工培训 前端控制器
 * </p>
 *
 * @author author
 * @since 2025-06-19
 */
@RestController
@RequestMapping("/js-training")
@Api("2.0员工培训")
public class JsTrainingController {

    @Autowired
    private IJsTrainingService jsTrainingService;

    @ApiOperation("员工培训添加")
    @PostMapping("/add")
    public AjaxResult add(@RequestBody JsTraining jsTraining) {
        return jsTrainingService.add(jsTraining);
    }

    @ApiOperation("员工培训修改")
    @PostMapping("/edit")
    public AjaxResult edit(@RequestBody JsTraining jsTraining) {
        return jsTrainingService.edit(jsTraining);
    }

    @ApiOperation("员工培训删除")
    @PostMapping("/delete")
    public AjaxResult delete(@RequestBody Map<String, String> paramsMap) {
        String ids = paramsMap.get("ids");
        return jsTrainingService.delete(ids);
    }

    @ApiOperation("员工培训分页")
    @GetMapping("/page")
    public AjaxResult page(@RequestParam("pageNum") Integer pageNum, @RequestParam("pageSize") Integer pageSize
            , @RequestParam(value = "startTime", required = false) String startTime
            , @RequestParam(value = "endTime", required = false) String endTime) {
        return jsTrainingService.page(pageNum, pageSize, startTime, endTime);
    }
}
