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.web.core.BaseController;
import org.dromara.main.domain.bo.MainStudentExperienceBo;
import org.dromara.main.domain.vo.MainStudentExperienceVo;
import org.dromara.main.service.IMainStudentExperienceService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

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