| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.model.TMajor; |
| | | import com.ruoyi.system.query.TMajorQuery; |
| | | import com.ruoyi.system.service.TMajorService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @author xiaochen |
| | | * @since 2025-09-28 |
| | | */ |
| | | @Api(tags = "专业管理") |
| | | @RestController |
| | | @RequestMapping("/t-major") |
| | | @RequestMapping("") |
| | | public class TMajorController { |
| | | |
| | | private final TMajorService tMajorService; |
| | | private final TokenService tokenService; |
| | | @Autowired |
| | | public TMajorController(TMajorService tMajorService, TokenService tokenService) { |
| | | this.tMajorService = tMajorService; |
| | | this.tokenService = tokenService; |
| | | } |
| | | |
| | | /** |
| | | * 专业管理列表 |
| | | */ |
| | | //@PreAuthorize("@ss.hasPermi('system:major:list')") |
| | | @ApiOperation(value = "专业管理分页列表", response = TMajorQuery.class) |
| | | @PostMapping(value = "/api/t-major/pageList") |
| | | public R<PageInfo<TMajor>> pageList(@RequestBody String param) { |
| | | TMajorQuery query = JSON.parseObject(param, TMajorQuery.class); |
| | | return R.ok(tMajorService.pageList(query)); |
| | | } |
| | | |
| | | /** |
| | | * 添加专业管理管理 |
| | | */ |
| | | //@PreAuthorize("@ss.hasPermi('system:major:add')") |
| | | @Log(title = "专业管理信息-新增专业管理", businessType = BusinessType.INSERT) |
| | | @ApiOperation(value = "添加专业管理",response = TMajor.class) |
| | | @PostMapping(value = "/api/t-major/add") |
| | | public R<Boolean> add(@RequestBody String param) { |
| | | TMajor dto = JSON.parseObject(param,TMajor.class); |
| | | if(tMajorService.isExit(dto)){ |
| | | return R.fail("该专业已存在"); |
| | | } |
| | | tMajorService.save(dto); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 修改专业管理 |
| | | */ |
| | | //@PreAuthorize("@ss.hasPermi('system:major:edit')") |
| | | @Log(title = "专业管理信息-修改专业管理", businessType = BusinessType.UPDATE) |
| | | @ApiOperation(value = "修改专业管理") |
| | | @PostMapping(value = "/api/t-major/update") |
| | | public R<Boolean> update(@RequestBody String param) { |
| | | TMajor dto = JSON.parseObject(param,TMajor.class); |
| | | if(tMajorService.isExit(dto)){ |
| | | return R.fail("该专业已存在"); |
| | | } |
| | | tMajorService.updateById(dto); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 查看专业管理详情 |
| | | */ |
| | | //@PreAuthorize("@ss.hasPermi('system:major:detail')") |
| | | @ApiOperation(value = "查看专业管理详情") |
| | | @GetMapping(value = "/open/t-major/getDetailById") |
| | | public R<TMajor> getDetailById(@RequestParam String id) { |
| | | TMajor equipment = tMajorService.getById(id); |
| | | return R.ok(equipment); |
| | | } |
| | | |
| | | /** |
| | | * 删除专业管理 |
| | | */ |
| | | //@PreAuthorize("@ss.hasPermi('system:major:delete')") |
| | | @Log(title = "专业管理信息-删除专业管理", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "删除专业管理") |
| | | @DeleteMapping(value = "/open/t-major/deleteById/{id}") |
| | | public R<Boolean> deleteById(@PathVariable String id) { |
| | | return R.ok(tMajorService.removeById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 批量删除专业管理 |
| | | */ |
| | | //@PreAuthorize("@ss.hasPermi('system:major:delete')") |
| | | @Log(title = "专业管理信息-删除专业管理", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "批量删除专业管理") |
| | | @DeleteMapping(value = "/open/t-major/deleteByIds") |
| | | public R<Boolean> deleteByIds(@RequestBody List<String> ids) { |
| | | return R.ok(tMajorService.removeByIds(ids)); |
| | | } |
| | | |
| | | } |
| | | |