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.StudyMaterialGyzj;
import com.hxhq.business.service.IStudyMaterialGyzjService;
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/studyMaterialGyzj")
public class StudyMaterialGyzjController extends BaseController
{
    @Autowired
    private IStudyMaterialGyzjService studyMaterialGyzjService;

    /**
     * 查询试验-物资列表-给药制剂列表
     */
    @GetMapping("/list")
    public TableDataInfo list(StudyMaterialGyzj studyMaterialGyzj)
    {
        startPage();
        List<StudyMaterialGyzj> list = studyMaterialGyzjService.queryList(studyMaterialGyzj);
        return getDataTable(list);
    }

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

    /**
     * 新增试验-物资列表-给药制剂信息
     */
    @PostMapping("/save")
    public AjaxResult save(@RequestBody StudyMaterialGyzj studyMaterialGyzj)
    {
        return toAjax(studyMaterialGyzjService.saveOrUpdate(studyMaterialGyzj));
    }

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