package com.hxhq.business.controller;

import java.util.Arrays;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.hxhq.business.domain.StudyMaterialMjy;
import com.hxhq.business.service.IStudyMaterialMjyService;
import com.hxhq.common.core.web.controller.BaseController;
import com.hxhq.common.core.web.domain.AjaxResult;
import com.hxhq.common.core.web.page.TableDataInfo;


/**
 * 试验-物资列表-麻精药Controller
 *
 * @author hxhq
 * @date 2026-01-05
 */
@RestController
@RequestMapping("/business/studyMaterialMjy")
public class StudyMaterialMjyController extends BaseController
{
    @Autowired
    private IStudyMaterialMjyService studyMaterialMjyService;

    /**
     * 查询试验-物资列表-麻精药列表
     */
    @GetMapping("/list")
    public TableDataInfo list(StudyMaterialMjy studyMaterialMjy)
    {
        startPage();
        List<StudyMaterialMjy> list = studyMaterialMjyService.queryList(studyMaterialMjy);
        return getDataTable(list);
    }

    /**
     * 获取试验-物资列表-麻精药详细信息
     */
    @GetMapping(value = "/info")
    public AjaxResult getInfo(Long id)
    {
        return AjaxResult.success(studyMaterialMjyService.getById(id));
    }

    /**
     * 新增试验-物资列表-麻精药信息
     */
    @PostMapping("/save")
    public AjaxResult save(@RequestBody StudyMaterialMjy studyMaterialMjy)
    {
        return toAjax(studyMaterialMjyService.saveOrUpdate(studyMaterialMjy));
    }

    /**
     * 删除试验-物资列表-麻精药信息
     */
    @PostMapping("/delete")
    public AjaxResult delete(@RequestBody Long[] ids)
    {
        return toAjax(studyMaterialMjyService.removeByIds(Arrays.asList(ids)));
    }
}
