package org.dromara.main.controller;


import cn.dev33.satoken.annotation.SaIgnore;
import lombok.RequiredArgsConstructor;
import org.dromara.common.core.domain.R;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.web.core.BaseController;
import org.dromara.main.domain.MainStudentEducation;
import org.dromara.main.domain.bo.MainStudentBo;
import org.dromara.main.domain.bo.MainStudentEducationBo;
import org.dromara.main.domain.vo.MainStudentEducationVo;
import org.dromara.main.mapper.MainStudentEducationMapper;
import org.dromara.main.service.IMainStudentEducationService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/main/studentEducation")
public class MainStudentEducationController extends BaseController {
    private final IMainStudentEducationService mainStudentEducationService;
    @SaIgnore
    @GetMapping("/list")
    public R<List<MainStudentEducationVo>> list(MainStudentEducationBo bo) {
        return R.ok(mainStudentEducationService.queryList(bo));
    }
    @SaIgnore
    @GetMapping("/{id}")
    public R<MainStudentEducationVo> getInfo(@PathVariable Long id) {
        return R.ok(mainStudentEducationService.queryById(id));
    }
    @SaIgnore
    @PostMapping()
    public R<Void> add(@RequestBody MainStudentEducationBo bo) {
        return toAjax(mainStudentEducationService.insertByBo(bo));
    }
    @SaIgnore
    @PutMapping()
    public R<Void> edit(@RequestBody MainStudentEducationBo bo) {
        return toAjax(mainStudentEducationService.updateByBo(bo));
    }
    @SaIgnore
    @DeleteMapping("/{ids}")
    public R<Void> remove(@PathVariable Long[] ids) {
        return toAjax(mainStudentEducationService.deleteWithValidByIds(List.of(ids), true));
    }
}
