package com.hxhq.business.controller;

import java.util.Arrays;
import java.util.List;

import com.hxhq.business.form.study.StudySubjectUserSaveForm;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.hxhq.business.domain.StudySubjectUser;
import com.hxhq.business.service.IStudySubjectUserService;
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 2025-12-29
 */
@RestController
@RequestMapping("/business/studySubjectUser")
public class StudySubjectUserController extends BaseController
{
    @Autowired
    private IStudySubjectUserService studySubjectUserService;

    /**
     * 查询试验-学科-成员列表
     */
    @GetMapping("/getListByStudySubjectId")
    public AjaxResult getListByStudySubjectId(Long studySubjectId)
    {
        return AjaxResult.success(studySubjectUserService.getListByStudySubjectId(studySubjectId));
    }

    /**
     * 新增试验-学科-成员信息
     * @param form
     * @return
     */
    @PostMapping("/save")
    public AjaxResult save(@RequestBody StudySubjectUserSaveForm form)
    {
        if(form.getStudySubjectId()==null || form.getStudySubjectId().longValue()<=0 || form.getSubjectUserList()==null ||form.getSign()==null){
            return AjaxResult.error("参数有误");
        }
        studySubjectUserService.saveInfo(form);
        return AjaxResult.success();
    }
}
