package org.jeecg.modules.database.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.modules.database.entity.ExperimentSequence;
import org.jeecg.modules.database.service.IExperimentSequenceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Description: 试验序列
 * @Author: jeecg-boot
 * @Date: 2024-12-04
 * @Version: V1.0
 */
@Tag(name = "试验序列")
@RestController
@RequestMapping("/database/experimentSequence")
@Slf4j
public class ExperimentSequenceController extends JeecgController<ExperimentSequence, IExperimentSequenceService> {
    @Autowired
    private IExperimentSequenceService experimentSequenceService;

    /**
     * 获取序号
     *
     * @return
     */
    //@AutoLog(value = "试验序列-分页列表查询")
    @Operation(summary = "试验序列-获取序号")
    @GetMapping(value = "/next")
    public Result<String> next() {

        return Result.OK(experimentSequenceService.next());
    }

    //
    ///**
    // * 添加
    // *
    // * @param experimentSequence
    // * @return
    // */
    //@AutoLog(value = "试验序列-添加")
    //@Operation(summary = "试验序列-添加")
    ////@RequiresPermissions("database:experiment_sequence:add")
    //@PostMapping(value = "/add")
    //public Result<String> add(@RequestBody ExperimentSequence experimentSequence) {
    //    experimentSequenceService.save(experimentSequence);
    //    return Result.OK("添加成功！");
    //}
    //
    ///**
    // * 编辑
    // *
    // * @param experimentSequence
    // * @return
    // */
    //@AutoLog(value = "试验序列-编辑")
    //@Operation(summary = "试验序列-编辑")
    ////@RequiresPermissions("database:experiment_sequence:edit")
    //@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
    //public Result<String> edit(@RequestBody ExperimentSequence experimentSequence) {
    //    experimentSequenceService.updateById(experimentSequence);
    //    return Result.OK("编辑成功!");
    //}
    //
    ///**
    // * 通过id删除
    // *
    // * @param id
    // * @return
    // */
    //@AutoLog(value = "试验序列-通过id删除")
    //@Operation(summary = "试验序列-通过id删除")
    ////@RequiresPermissions("database:experiment_sequence:delete")
    //@DeleteMapping(value = "/delete")
    //public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
    //    experimentSequenceService.removeById(id);
    //    return Result.OK("删除成功!");
    //}
    //
    ///**
    // * 批量删除
    // *
    // * @param ids
    // * @return
    // */
    //@AutoLog(value = "试验序列-批量删除")
    //@Operation(summary = "试验序列-批量删除")
    ////@RequiresPermissions("database:experiment_sequence:delete")
    //@DeleteMapping(value = "/deleteBatch")
    //public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
    //    this.experimentSequenceService.removeByIds(Arrays.asList(ids.split(",")));
    //    return Result.OK("批量删除成功!");
    //}
    //
    ///**
    // * 通过id查询
    // *
    // * @param id
    // * @return
    // */
    ////@AutoLog(value = "试验序列-通过id查询")
    //@Operation(summary = "试验序列-通过id查询")
    //@GetMapping(value = "/queryById")
    //public Result<ExperimentSequence> queryById(@RequestParam(name = "id", required = true) String id) {
    //    ExperimentSequence experimentSequence = experimentSequenceService.getById(id);
    //    if (experimentSequence == null) {
    //        return Result.error("未找到对应数据");
    //    }
    //    return Result.OK(experimentSequence);
    //}
    //
    ///**
    // * 导出excel
    // *
    // * @param request
    // * @param experimentSequence
    // */
    ////
    //@RequestMapping(value = "/exportXls")
    //public ModelAndView exportXls(HttpServletRequest request, ExperimentSequence experimentSequence) {
    //    return super.exportXls(request, experimentSequence, ExperimentSequence.class, "试验序列");
    //}
    //
    ///**
    // * 通过excel导入数据
    // *
    // * @param request
    // * @param response
    // * @return
    // */
    ////@RequiresPermissions("database:experiment_sequence:add")
    //@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
    //public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
    //    return super.importExcel(request, response, ExperimentSequence.class);
    //}

}
