|
@@ -0,0 +1,141 @@
|
|
|
+package com.platform.rest.controller.custom;
|
|
|
+
|
|
|
+import com.platform.common.util.R;
|
|
|
+import com.platform.dao.dto.custom.CustomClassNameDTO;
|
|
|
+import com.platform.dao.entity.custom.CustomClassName;
|
|
|
+import com.platform.service.custom.CustomClassNameService;
|
|
|
+import com.platform.dao.util.ExcelUtil;
|
|
|
+import com.platform.dao.vo.export.custom.ExportCustomClassNameVO;
|
|
|
+import com.platform.dao.vo.query.custom.CustomClassNameVO;
|
|
|
+import com.platform.common.util.BeanConverterUtil;
|
|
|
+import com.platform.common.validation.group.AddGroup;
|
|
|
+import com.platform.common.validation.group.UpdateGroup;
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+import lombok.AllArgsConstructor;
|
|
|
+import com.platform.common.bean.AbstractPageResultBean;
|
|
|
+import com.platform.rest.log.annotation.SysLog;
|
|
|
+import java.util.List;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @Description 自定义配置类 控制器
|
|
|
+ * @Author lsq
|
|
|
+ * @Date 2024-08-01 16:41:47
|
|
|
+ * @Version Copyright (c) 2020,北京乾元坤和科技有限公司 All rights reserved.
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@AllArgsConstructor
|
|
|
+@RequestMapping("/custom/className")
|
|
|
+public class CustomClassNameController {
|
|
|
+
|
|
|
+ private final CustomClassNameService customClassNameService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 通过id查询单条记录
|
|
|
+ *
|
|
|
+ * @param id 主键
|
|
|
+ * @return R
|
|
|
+ */
|
|
|
+ @GetMapping("/{id}")
|
|
|
+ public R<CustomClassName> getById(@PathVariable("id") String id){
|
|
|
+ return new R<>(customClassNameService.getModelById(id));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增记录
|
|
|
+ *
|
|
|
+ * @param customClassNameDTO 自定义配置类DTO
|
|
|
+ * @return R
|
|
|
+ */
|
|
|
+ @SysLog("新增自定义配置类")
|
|
|
+ @PostMapping
|
|
|
+ @PreAuthorize("@pms.hasPermission('custom-className-add')")
|
|
|
+ public R save(@Validated({AddGroup.class}) @RequestBody CustomClassNameDTO customClassNameDTO) {
|
|
|
+ return new R<>(customClassNameService.saveModelByDTO(customClassNameDTO));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改记录
|
|
|
+ *
|
|
|
+ * @param customClassNameDTO 自定义配置类DTO
|
|
|
+ * @return R
|
|
|
+ */
|
|
|
+ @SysLog("修改自定义配置类")
|
|
|
+ @PutMapping("/{id}")
|
|
|
+ @PreAuthorize("@pms.hasPermission('custom-className-edit')")
|
|
|
+ public R update(@PathVariable("id") String id, @Validated({UpdateGroup.class}) @RequestBody CustomClassNameDTO customClassNameDTO) {
|
|
|
+ customClassNameService.modModelByDTO(customClassNameDTO);
|
|
|
+ return new R<>();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 通过id删除一条记录
|
|
|
+ *
|
|
|
+ * @param id 主键
|
|
|
+ * @return R
|
|
|
+ */
|
|
|
+ @SysLog("删除自定义配置类")
|
|
|
+ @DeleteMapping("/{id}")
|
|
|
+ @PreAuthorize("@pms.hasPermission('custom-className-del')")
|
|
|
+ public R removeById(@PathVariable String id){
|
|
|
+ customClassNameService.deleteByPrimaryKey(id);
|
|
|
+ return new R<>();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量记录
|
|
|
+ *
|
|
|
+ * @param ids 主键
|
|
|
+ * @return R
|
|
|
+ */
|
|
|
+ @SysLog("批量删除自定义配置类")
|
|
|
+ @DeleteMapping("")
|
|
|
+ @PreAuthorize("@pms.hasPermission('custom-className-del')")
|
|
|
+ public R removeIds(@RequestBody List<String> ids){
|
|
|
+ customClassNameService.batchDelete(ids);
|
|
|
+ return new R<>();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取分页
|
|
|
+ *
|
|
|
+ * @param pageNum 当前页码
|
|
|
+ * @param pageSize 每页条数
|
|
|
+ * @param customClassNameDTO 自定义配置类DTO
|
|
|
+ * @return R
|
|
|
+ */
|
|
|
+ @GetMapping("/page")
|
|
|
+ public R<AbstractPageResultBean<CustomClassNameVO>> query(CustomClassNameDTO customClassNameDTO, @RequestParam(defaultValue = "1") int pageNum, @RequestParam(defaultValue = "20") int pageSize) {
|
|
|
+ return new R<>(customClassNameService.selectPageList(customClassNameDTO, pageNum, pageSize));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取列表
|
|
|
+ *
|
|
|
+ * @param customClassNameDTO 自定义配置类DTO
|
|
|
+ * @return R
|
|
|
+ */
|
|
|
+ @GetMapping("")
|
|
|
+ public R query(CustomClassNameDTO customClassNameDTO) {
|
|
|
+ return new R<>(customClassNameService.getModelListByDTO(customClassNameDTO));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 自定义配置类导出
|
|
|
+ *
|
|
|
+ * @param customClassNameDTO 自定义配置类DTO
|
|
|
+ * @return R
|
|
|
+ */
|
|
|
+ @GetMapping("/export")
|
|
|
+ @SysLog("自定义配置类导出")
|
|
|
+ @PreAuthorize("@pms.hasPermission('custom-className-export')")
|
|
|
+ public void export(HttpServletResponse response, CustomClassNameDTO customClassNameDTO) {
|
|
|
+ List<CustomClassName> list = customClassNameService.getModelListByDTO(customClassNameDTO);
|
|
|
+ ExcelUtil.exportResponseDict(response, ExportCustomClassNameVO.class, BeanConverterUtil.copyListProperties(list, ExportCustomClassNameVO.class), "自定义配置类");
|
|
|
+ }
|
|
|
+
|
|
|
+}
|