|
@@ -0,0 +1,81 @@
|
|
|
+package com.wtkj.controller;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
|
+import com.wtkj.entity.TypeAndStage;
|
|
|
+import com.wtkj.service.ITypeAndStageService;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import lombok.AllArgsConstructor;
|
|
|
+import org.springblade.core.mp.support.Condition;
|
|
|
+import org.springblade.core.mp.support.Query;
|
|
|
+import org.springblade.core.tool.api.R;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @author Jimi Zhang
|
|
|
+ * @create at 2023-09-13 14:14
|
|
|
+ * @describe
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@AllArgsConstructor
|
|
|
+@RequestMapping("/typeAndStage")
|
|
|
+@Api(value = "项目类和项目阶段模块", tags = "项目类型和项目阶段")
|
|
|
+public class TypeAndStageController {
|
|
|
+
|
|
|
+ private final ITypeAndStageService typeAndStageService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 分页
|
|
|
+ */
|
|
|
+ @GetMapping("/page")
|
|
|
+ @ApiOperationSupport(order = 1)
|
|
|
+ @ApiOperation(value = "项目类型分页", notes = " ")
|
|
|
+ public R<IPage<TypeAndStage>> page(Query query) {
|
|
|
+ LambdaQueryWrapper<TypeAndStage> lqw = Wrappers.lambdaQuery();
|
|
|
+ lqw.eq(TypeAndStage::getParentId, 0);
|
|
|
+ lqw.orderByDesc(TypeAndStage::getCreateTime);
|
|
|
+ IPage<TypeAndStage> page = typeAndStageService.page(Condition.getPage(query), lqw);
|
|
|
+ return R.data(page);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 类型下的阶段
|
|
|
+ */
|
|
|
+ @GetMapping("/v2/stage-list")
|
|
|
+ @ApiOperationSupport(order = 2)
|
|
|
+ @ApiOperation(value = "阶段列表", notes = "传入parentId")
|
|
|
+ public R<List<TypeAndStage>> list(@RequestParam(value = "parentId") Long parentId) {
|
|
|
+ List<TypeAndStage> list = typeAndStageService.list(new LambdaQueryWrapper<TypeAndStage>().eq(TypeAndStage::getParentId, parentId)
|
|
|
+ .orderByAsc(TypeAndStage::getSort));
|
|
|
+ return R.data(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增或者修改
|
|
|
+ */
|
|
|
+ @GetMapping("/submit")
|
|
|
+ @ApiOperationSupport(order = 3)
|
|
|
+ @ApiOperation(value = "新增或者修改", notes = "传入typeAndStage")
|
|
|
+ public R submit(@RequestBody TypeAndStage typeAndStage) {
|
|
|
+ return R.status(typeAndStageService.submit(typeAndStage));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 详情
|
|
|
+ */
|
|
|
+ @ApiOperationSupport(order = 4)
|
|
|
+ @ApiOperation(value = "查看类型或阶段详情", notes = "传入id")
|
|
|
+ @GetMapping("/v2/detail")
|
|
|
+ public R detail(Long id) {
|
|
|
+ TypeAndStage detail = typeAndStageService.getById(id);
|
|
|
+ return R.data(detail);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}
|