|
|
@@ -0,0 +1,106 @@
|
|
|
+package org.dromara.backstage.basics.controller;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
+import jakarta.servlet.http.HttpServletResponse;
|
|
|
+import jakarta.validation.constraints.*;
|
|
|
+import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
|
|
+import org.dromara.common.log.annotation.Log;
|
|
|
+import org.dromara.common.web.core.BaseController;
|
|
|
+import org.dromara.common.mybatis.core.page.PageQuery;
|
|
|
+import org.dromara.common.core.domain.R;
|
|
|
+import org.dromara.common.core.validate.AddGroup;
|
|
|
+import org.dromara.common.core.validate.EditGroup;
|
|
|
+import org.dromara.common.log.enums.BusinessType;
|
|
|
+import org.dromara.common.excel.utils.ExcelUtil;
|
|
|
+import org.dromara.backstage.basics.domain.vo.PtCampusVo;
|
|
|
+import org.dromara.backstage.basics.domain.bo.PtCampusBo;
|
|
|
+import org.dromara.backstage.basics.service.IPtCampusService;
|
|
|
+import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 校区信息
|
|
|
+ * 前端访问路由地址为:/customer/ptCampus
|
|
|
+ *
|
|
|
+ * @author Yz
|
|
|
+ * @date 2024-08-07
|
|
|
+ */
|
|
|
+@Validated
|
|
|
+@RequiredArgsConstructor
|
|
|
+@RestController
|
|
|
+@RequestMapping("/customer/ptCampus")
|
|
|
+public class PtCampusController extends BaseController {
|
|
|
+
|
|
|
+ private final IPtCampusService ptCampusService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询校区信息列表
|
|
|
+ */
|
|
|
+ @SaCheckPermission("customer:ptCampus:list")
|
|
|
+ @GetMapping("/list")
|
|
|
+ public TableDataInfo<PtCampusVo> list(PtCampusBo bo, PageQuery pageQuery) {
|
|
|
+ return ptCampusService.queryPageList(bo, pageQuery);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 导出校区信息列表
|
|
|
+ */
|
|
|
+ @SaCheckPermission("customer:ptCampus:export")
|
|
|
+ @Log(title = "校区信息", businessType = BusinessType.EXPORT)
|
|
|
+ @PostMapping("/export")
|
|
|
+ public void export(PtCampusBo bo, HttpServletResponse response) {
|
|
|
+ List<PtCampusVo> list = ptCampusService.queryList(bo);
|
|
|
+ ExcelUtil.exportExcel(list, "校区信息", PtCampusVo.class, response);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取校区信息详细信息
|
|
|
+ *
|
|
|
+ * @param campusId 主键
|
|
|
+ */
|
|
|
+ @SaCheckPermission("customer:ptCampus:query")
|
|
|
+ @GetMapping("/{campusId}")
|
|
|
+ public R<PtCampusVo> getInfo(@NotNull(message = "主键不能为空")
|
|
|
+ @PathVariable Long campusId) {
|
|
|
+ return R.ok(ptCampusService.queryById(campusId));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增校区信息
|
|
|
+ */
|
|
|
+ @SaCheckPermission("customer:ptCampus:add")
|
|
|
+ @Log(title = "校区信息", businessType = BusinessType.INSERT)
|
|
|
+ @RepeatSubmit()
|
|
|
+ @PostMapping()
|
|
|
+ public R<Void> add(@Validated(AddGroup.class) @RequestBody PtCampusBo bo) {
|
|
|
+ return toAjax(ptCampusService.insertByBo(bo));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改校区信息
|
|
|
+ */
|
|
|
+ @SaCheckPermission("customer:ptCampus:edit")
|
|
|
+ @Log(title = "校区信息", businessType = BusinessType.UPDATE)
|
|
|
+ @RepeatSubmit()
|
|
|
+ @PutMapping()
|
|
|
+ public R<Void> edit(@Validated(EditGroup.class) @RequestBody PtCampusBo bo) {
|
|
|
+ return toAjax(ptCampusService.updateByBo(bo));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除校区信息
|
|
|
+ *
|
|
|
+ * @param campusIds 主键串
|
|
|
+ */
|
|
|
+ @SaCheckPermission("customer:ptCampus:remove")
|
|
|
+ @Log(title = "校区信息", businessType = BusinessType.DELETE)
|
|
|
+ @DeleteMapping("/{campusIds}")
|
|
|
+ public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
|
|
+ @PathVariable Long[] campusIds) {
|
|
|
+ return toAjax(ptCampusService.deleteWithValidByIds(List.of(campusIds), true));
|
|
|
+ }
|
|
|
+}
|