| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- package com.ruoyi.web.controller.dz;
- import java.util.List;
- import javax.servlet.http.HttpServletResponse;
- import com.ruoyi.common.utils.SecurityUtils;
- import com.ruoyi.dz.service.IDzTeacherClassService;
- import com.ruoyi.enums.UserTypeEnum;
- import org.springframework.security.access.prepost.PreAuthorize;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.GetMapping;
- import org.springframework.web.bind.annotation.PostMapping;
- import org.springframework.web.bind.annotation.PutMapping;
- import org.springframework.web.bind.annotation.DeleteMapping;
- import org.springframework.web.bind.annotation.PathVariable;
- import org.springframework.web.bind.annotation.RequestBody;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RestController;
- import com.ruoyi.common.annotation.Log;
- import com.ruoyi.common.core.controller.BaseController;
- import com.ruoyi.common.core.domain.AjaxResult;
- import com.ruoyi.common.enums.BusinessType;
- import com.ruoyi.dz.domain.DzTeacher;
- import com.ruoyi.dz.service.IDzTeacherService;
- import com.ruoyi.common.utils.poi.ExcelUtil;
- import com.ruoyi.common.core.page.TableDataInfo;
- /**
- * 老师Controller
- *
- * @author ruoyi
- * @date 2025-09-12
- */
- @RestController
- @RequestMapping("/dz/teacher")
- public class DzTeacherController extends BaseController
- {
- @Autowired
- private IDzTeacherService dzTeacherService;
- @Autowired
- private IDzTeacherClassService teacherClassService;
- /**
- * 查询老师列表
- */
- @PreAuthorize("@ss.hasPermi('dz:teacher:list')")
- @GetMapping("/list")
- public TableDataInfo list(DzTeacher dzTeacher)
- {
- if(!UserTypeEnum.isSys(SecurityUtils.getLoginUser().getUser().getUserType())){
- dzTeacher.setDeptId(SecurityUtils.getLoginUser().getUser().getDeptId());
- }
- startPage();
- List<DzTeacher> list = dzTeacherService.selectDzTeacherList(dzTeacher);
- return getDataTable(list);
- }
- /**
- * 导出老师列表
- */
- @PreAuthorize("@ss.hasPermi('dz:teacher:export')")
- @Log(title = "老师", businessType = BusinessType.EXPORT)
- @PostMapping("/export")
- public void export(HttpServletResponse response, DzTeacher dzTeacher)
- {
- List<DzTeacher> list = dzTeacherService.selectDzTeacherList(dzTeacher);
- ExcelUtil<DzTeacher> util = new ExcelUtil<DzTeacher>(DzTeacher.class);
- util.exportExcel(response, list, "老师数据");
- }
- /**
- * 获取老师详细信息
- */
- @PreAuthorize("@ss.hasPermi('dz:teacher:query')")
- @GetMapping(value = "/{teacherId}")
- public AjaxResult getInfo(@PathVariable("teacherId") Long teacherId)
- {
- return success(dzTeacherService.selectDzTeacherByTeacherId(teacherId));
- }
- /**
- * 新增老师
- */
- @PreAuthorize("@ss.hasPermi('dz:teacher:add')")
- @Log(title = "老师", businessType = BusinessType.INSERT)
- @PostMapping
- public AjaxResult add(@RequestBody DzTeacher dzTeacher)
- {
- return AjaxResult.success(dzTeacherService.insertDzTeacher(dzTeacher));
- }
- /**
- * 修改老师
- */
- @PreAuthorize("@ss.hasPermi('dz:teacher:edit')")
- @Log(title = "老师", businessType = BusinessType.UPDATE)
- @PutMapping
- public AjaxResult edit(@RequestBody DzTeacher dzTeacher)
- {
- return toAjax(dzTeacherService.updateDzTeacher(dzTeacher));
- }
- /**
- * 删除老师
- */
- @PreAuthorize("@ss.hasPermi('dz:teacher:remove')")
- @Log(title = "老师", businessType = BusinessType.DELETE)
- @DeleteMapping("/{teacherIds}")
- public AjaxResult remove(@PathVariable Long[] teacherIds)
- {
- return toAjax(dzTeacherService.deleteDzTeacherByTeacherIds(teacherIds));
- }
- }
|