|
|
@@ -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.PtCardtypeVo;
|
|
|
+import org.dromara.backstage.basics.domain.bo.PtCardtypeBo;
|
|
|
+import org.dromara.backstage.basics.service.IPtCardtypeService;
|
|
|
+import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 卡片类别
|
|
|
+ * 前端访问路由地址为:/basicParameter/ptCardtype
|
|
|
+ *
|
|
|
+ * @author YZ
|
|
|
+ * @date 2024-08-02
|
|
|
+ */
|
|
|
+@Validated
|
|
|
+@RequiredArgsConstructor
|
|
|
+@RestController
|
|
|
+@RequestMapping("/basicParameter/ptCardtype")
|
|
|
+public class PtCardtypeController extends BaseController {
|
|
|
+
|
|
|
+ private final IPtCardtypeService ptCardtypeService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询卡片类别列表
|
|
|
+ */
|
|
|
+ @SaCheckPermission("basicParameter:ptCardtype:list")
|
|
|
+ @GetMapping("/list")
|
|
|
+ public TableDataInfo<PtCardtypeVo> list(PtCardtypeBo bo, PageQuery pageQuery) {
|
|
|
+ return ptCardtypeService.queryPageList(bo, pageQuery);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 导出卡片类别列表
|
|
|
+ */
|
|
|
+ @SaCheckPermission("basicParameter:ptCardtype:export")
|
|
|
+ @Log(title = "卡片类别", businessType = BusinessType.EXPORT)
|
|
|
+ @PostMapping("/export")
|
|
|
+ public void export(PtCardtypeBo bo, HttpServletResponse response) {
|
|
|
+ List<PtCardtypeVo> list = ptCardtypeService.queryList(bo);
|
|
|
+ ExcelUtil.exportExcel(list, "卡片类别", PtCardtypeVo.class, response);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取卡片类别详细信息
|
|
|
+ *
|
|
|
+ * @param typeId 主键
|
|
|
+ */
|
|
|
+ @SaCheckPermission("basicParameter:ptCardtype:query")
|
|
|
+ @GetMapping("/{typeId}")
|
|
|
+ public R<PtCardtypeVo> getInfo(@NotNull(message = "主键不能为空")
|
|
|
+ @PathVariable Long typeId) {
|
|
|
+ return R.ok(ptCardtypeService.queryById(typeId));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增卡片类别
|
|
|
+ */
|
|
|
+ @SaCheckPermission("basicParameter:ptCardtype:add")
|
|
|
+ @Log(title = "卡片类别", businessType = BusinessType.INSERT)
|
|
|
+ @RepeatSubmit()
|
|
|
+ @PostMapping()
|
|
|
+ public R<Void> add(@Validated(AddGroup.class) @RequestBody PtCardtypeBo bo) {
|
|
|
+ return toAjax(ptCardtypeService.insertByBo(bo));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改卡片类别
|
|
|
+ */
|
|
|
+ @SaCheckPermission("basicParameter:ptCardtype:edit")
|
|
|
+ @Log(title = "卡片类别", businessType = BusinessType.UPDATE)
|
|
|
+ @RepeatSubmit()
|
|
|
+ @PutMapping()
|
|
|
+ public R<Void> edit(@Validated(EditGroup.class) @RequestBody PtCardtypeBo bo) {
|
|
|
+ return toAjax(ptCardtypeService.updateByBo(bo));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除卡片类别
|
|
|
+ *
|
|
|
+ * @param typeIds 主键串
|
|
|
+ */
|
|
|
+ @SaCheckPermission("basicParameter:ptCardtype:remove")
|
|
|
+ @Log(title = "卡片类别", businessType = BusinessType.DELETE)
|
|
|
+ @DeleteMapping("/{typeIds}")
|
|
|
+ public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
|
|
+ @PathVariable Long[] typeIds) {
|
|
|
+ return toAjax(ptCardtypeService.deleteWithValidByIds(List.of(typeIds), true));
|
|
|
+ }
|
|
|
+}
|