package com.ruoyi.web.v2.controller;


import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.web.v2.model.JsDisinfectManage;
import com.ruoyi.web.v2.service.IJsDisinfectManageService;
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;

import static com.ruoyi.common.core.domain.AjaxResult.success;

/**
 * <p>
 * 2.0消毒方式管理 前端控制器
 * </p>
 *
 * @author author
 * @since 2025-05-20
 */
@RestController
@RequestMapping("/js-disinfect-manage")
@Api("2.0消毒方式管理")
public class JsDisinfectManageController extends BaseController {

    @Autowired
    private IJsDisinfectManageService disinfectManageService;

    @ApiOperation("消毒方式管理添加")
    @PostMapping("/add")
    public AjaxResult add(@RequestBody JsDisinfectManage jsDisinfectManage){
        return disinfectManageService.add(jsDisinfectManage);
    }

    @ApiOperation("消毒方式管理修改")
    @PostMapping("/edit")
    public AjaxResult edit(@RequestBody JsDisinfectManage jsDisinfectManage){
        return disinfectManageService.edit(jsDisinfectManage);
    }

    @ApiOperation("消毒方式管理删除")
    @PostMapping("/delete")
    public AjaxResult delete(@RequestBody Map<String, String> paramsMap) {
        String ids = paramsMap.get("ids");
        return disinfectManageService.delete(ids);
    }

    @ApiOperation("消毒方式管理列表")
    @PostMapping("/list")
    public AjaxResult listAll(){
        return disinfectManageService.listAll();
    }

    @ApiOperation("消毒方式管理分页")
    @GetMapping("/page")
    public AjaxResult page(@RequestParam("pageNum") Integer pageNum, @RequestParam("pageSize") Integer pageSize
            , @RequestParam(value = "disinfectMethod", required = false) String disinfectMethod) {
        return disinfectManageService.page(pageNum, pageSize, disinfectMethod);
    }
    @ApiOperation("消毒方式管理详情")
    @PostMapping("/listById")
    public AjaxResult listById(@RequestBody Map<String, String> paramsMap){
        String id = paramsMap.get("id");
        return success(disinfectManageService.getById(id));
    }
}
