diff --git a/src/main/java/com/tinyengine/it/controller/BlockController.java b/src/main/java/com/tinyengine/it/controller/BlockController.java
new file mode 100644
index 00000000..203ae844
--- /dev/null
+++ b/src/main/java/com/tinyengine/it/controller/BlockController.java
@@ -0,0 +1,352 @@
+package com.tinyengine.it.controller;
+
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.tinyengine.it.common.base.Result;
+import com.tinyengine.it.config.log.SystemControllerLog;
+import com.tinyengine.it.mapper.BlockMapper;
+import com.tinyengine.it.mapper.TenantMapper;
+import com.tinyengine.it.model.dto.BlockDto;
+import com.tinyengine.it.model.dto.BlockParamDto;
+import com.tinyengine.it.model.entity.*;
+import com.tinyengine.it.service.material.BlockService;
+import com.tinyengine.it.service.material.TaskRecordService;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ *
+ * 区块
+ *
+ *
+ * @author zhangjuncao
+ * @since 2024-10-30
+ */
+@Validated
+@RestController
+@CrossOrigin
+@RequestMapping("/material-center/api")
+public class BlockController {
+
+ @Autowired
+ BlockService blockService;
+ @Autowired
+ TenantMapper tenantMapper;
+ @Autowired
+ BlockMapper blockMapper;
+ @Autowired
+ TaskRecordService taskRecordService;
+
+ /**
+ * 获取block列表信息
+ *
+ * @param blockParamDto blockParamDto
+ * @return block列表信息
+ */
+ @Operation(summary = "获取区块列表信息",
+ description = "获取区块列表信息",
+ parameters = {
+ @Parameter(name = "request", description = "入参对象")
+ },
+ responses = {
+ @ApiResponse(responseCode = "200", description = "返回信息",
+ content = @Content(mediaType = "application/json",
+ schema = @Schema(implementation = Block.class))),
+ @ApiResponse(responseCode = "400", description = "请求失败")}
+ )
+ @SystemControllerLog(description = "获取区块列表api")
+ @GetMapping("/block/list")
+ public Result> getAllBlocks(@RequestBody BlockParamDto blockParamDto) {
+ IPage blocksList = blockService.findBlocksByPagetionList(blockParamDto);
+ List result = blocksList.getRecords();
+ return Result.success(result);
+ }
+
+ /**
+ * 获取区块列表满足查询条件下的条数
+ *
+ * @param nameCn name
+ * @param description description
+ * @return the integer
+ */
+ @Operation(summary = "获取区块列表满足查询条件下的条数",
+ description = "获取区块列表满足查询条件下的条数",
+ parameters = {
+ @Parameter(name = "nameCn", description = "nameCn区块中文名称"),
+ @Parameter(name = "description", description = "区块描述")
+ },
+ responses = {
+ @ApiResponse(responseCode = "200", description = "返回信息",
+ content = @Content(mediaType = "application/json",
+ schema = @Schema())),
+ @ApiResponse(responseCode = "400", description = "请求失败")}
+ )
+ @SystemControllerLog(description = "获取区块列表满足查询条件下的条数")
+ @GetMapping("/block/count")
+ public Result getCountByCondition(@RequestParam(value = "name_cn", required = false) String nameCn,
+ @RequestParam(value = "description", required = false) String description) {
+ // 获取查询条件name_cn、description,若为空查的是全部数据,若不为空按条件查询
+ List blocksList = blockMapper.findBlocksByNameCnAndDes(nameCn, description);
+ return Result.success(blocksList.size());
+ }
+
+ /**
+ * 根据id查询表block信息
+ *
+ * @param id id
+ * @return BlockDto
+ */
+ @Operation(summary = "查询区块详情",
+ description = "根据id查询表t_block信息并返回",
+ parameters = {
+ @Parameter(name = "id", description = "区块Id")
+ },
+ responses = {
+ @ApiResponse(responseCode = "200", description = "返回区块信息",
+ content = @Content(mediaType = "application/json",
+ schema = @Schema(implementation = Block.class))),
+ @ApiResponse(responseCode = "400", description = "请求失败")}
+ )
+ @SystemControllerLog(description = "获取区块详情api")
+ @GetMapping("/block/detail/{id}")
+ public Result getBlocksById(@PathVariable Integer id) {
+ BlockDto blocks = blockMapper.findBlockAndGroupAndHistoByBlockId(id);
+ return Result.success(blocks);
+ }
+
+ /**
+ * 创建block
+ *
+ * @param blockDto the block dto
+ * @return BlockDto
+ */
+ @Operation(summary = "创建block",
+ description = "创建block",
+ parameters = {
+ @Parameter(name = "map", description = "入参对象")
+ },
+ responses = {
+ @ApiResponse(responseCode = "200", description = "返回信息",
+ content = @Content(mediaType = "application/json",
+ schema = @Schema(implementation = Block.class))),
+ @ApiResponse(responseCode = "400", description = "请求失败")}
+ )
+ @SystemControllerLog(description = "区块创建api")
+ @PostMapping("/block/create")
+ public Result createBlocks(@Valid @RequestBody BlockDto blockDto) {
+ return blockService.createBlock(blockDto);
+ }
+
+
+ /**
+ * 删除blocks信息
+ *
+ * @param id id
+ * @return BlockDto
+ */
+ @Operation(summary = "删除blocks信息",
+ description = "删除blocks信息",
+ parameters = {
+ @Parameter(name = "id", description = "区块id")
+ },
+ responses = {
+ @ApiResponse(responseCode = "200", description = "返回信息",
+ content = @Content(mediaType = "application/json",
+ schema = @Schema(implementation = Block.class))),
+ @ApiResponse(responseCode = "400", description = "请求失败")}
+ )
+ @SystemControllerLog(description = "删除blocks信息")
+ @GetMapping("/block/delete/{id}")
+ public Result deleteBlocks(@PathVariable Integer id) {
+ // 页面返回数据
+ BlockDto result = blockMapper.findBlockAndGroupAndHistoByBlockId(id);
+ blockService.deleteBlockById(id);
+ return Result.success(result);
+ }
+
+ /**
+ * 生态中心区块列表分页查询
+ *
+ * @param blockParamDto blockParamDto
+ * @return BlockDto
+ */
+ @Operation(summary = "生态中心区块列表分页查询",
+ description = "生态中心区块列表分页查询",
+ parameters = {
+ @Parameter(name = "request", description = "入参对象")
+ },
+ responses = {
+ @ApiResponse(responseCode = "200", description = "返回信息",
+ content = @Content(mediaType = "application/json",
+ schema = @Schema())),
+ @ApiResponse(responseCode = "400", description = "请求失败")}
+ )
+ @SystemControllerLog(description = "生态中心区块列表分页查询api")
+ @GetMapping("/block")
+ public Result> find(@RequestBody BlockParamDto blockParamDto) {
+ IPage blocksIPage = blockService.findBlocksByPagetionList(blockParamDto);
+ List blocksList = blocksIPage.getRecords();
+ List result = new ArrayList<>();
+ for (Block blocks : blocksList) {
+ List blockDto = blockMapper.findBlockAndHistorByBlockId(blocks.getId());
+ result.addAll(blockDto);
+ }
+ return Result.success(result);
+ }
+
+ /**
+ * 查找表中所有tags
+ *
+ * @return the list
+ */
+ @Operation(summary = "查找表中所有tags",
+ description = "查找表中所有tags",
+ responses = {
+ @ApiResponse(responseCode = "200", description = "返回信息",
+ content = @Content(mediaType = "application/json",
+ schema = @Schema())),
+ @ApiResponse(responseCode = "400", description = "请求失败")}
+ )
+ @SystemControllerLog(description = "查找表中所有tags")
+ @GetMapping("/block/tags")
+ public Result> allTags() {
+ List allTagsList = blockService.allTags();
+ return Result.success(allTagsList);
+ }
+
+
+ /**
+ * 获取区块列表list2
+ *
+ * @param request request
+ * @return the ipage
+ */
+ @Operation(summary = "获取区块列表list2",
+ description = "获取区块列表list2",
+ parameters = {
+ @Parameter(name = "request", description = "入参对象")
+ },
+ responses = {
+ @ApiResponse(responseCode = "200", description = "返回信息",
+ content = @Content(mediaType = "application/json",
+ schema = @Schema())),
+ @ApiResponse(responseCode = "400", description = "请求失败")}
+ )
+ @SystemControllerLog(description = "获取区块列表api")
+ @GetMapping("/block/list2")
+ public Result> getBlocks(@RequestBody Map request) {
+ IPage BlocksList = blockService.findBlocksByConditionPagetion(request);
+ return Result.success(BlocksList);
+ }
+
+
+ /**
+ * 获取所有租户
+ *
+ * @return the list
+ */
+ @Operation(summary = "获取所有租户",
+ description = "获取所有租户",
+ responses = {
+ @ApiResponse(responseCode = "200", description = "返回信息",
+ content = @Content(mediaType = "application/json",
+ schema = @Schema(implementation = Tenant.class))),
+ @ApiResponse(responseCode = "400", description = "请求失败")}
+ )
+ @SystemControllerLog(description = "获取所有租户api")
+ @GetMapping("/block/tenants")
+ public Result> allTenant() {
+ List tenantsList = tenantMapper.queryAllTenant();
+ return Result.success(tenantsList);
+ }
+
+
+ /**
+ * 获取所有用户
+ *
+ * @return the list
+ */
+ @Operation(summary = "获取所有用户",
+ description = "获取所有用户",
+ parameters = {
+ @Parameter(name = "blocks", description = "入参对象")
+ },
+ responses = {
+ @ApiResponse(responseCode = "200", description = "返回信息",
+ content = @Content(mediaType = "application/json",
+ schema = @Schema(implementation = User.class))),
+ @ApiResponse(responseCode = "400", description = "请求失败")}
+ )
+ @SystemControllerLog(description = "获取所有用户api")
+ @GetMapping("/block/users")
+ public Result> allAuthor() {
+
+ List blocksList = blockMapper.queryAllBlock();
+ List userList = blockService.getUsers(blocksList);
+ return Result.success(userList);
+ }
+
+ /**
+ * 获取区块列表
+ *
+ * @param map map
+ * @return the list
+ */
+ @Operation(summary = "获取区块列表",
+ description = "获取区块列表",
+ parameters = {
+ @Parameter(name = "map", description = "入参对象")
+ },
+ responses = {
+ @ApiResponse(responseCode = "200", description = "返回信息",
+ content = @Content(mediaType = "application/json",
+ schema = @Schema(implementation = Block.class))),
+ @ApiResponse(responseCode = "400", description = "请求失败")}
+ )
+ @SystemControllerLog(description = "获取区块列表")
+ @GetMapping("/blocks")
+ public Result> getAllBlockCategories(@Valid @RequestParam Map map) {
+ return blockService.listNew(map);
+ }
+
+
+ /**
+ * 修改block
+ *
+ * @param blockDto blockDto
+ * @return block dto
+ */
+ @Operation(summary = "修改区块",
+ description = "修改区块",
+ parameters = {
+ @Parameter(name = "blockDto", description = "入参对象"),
+ @Parameter(name = "id", description = "区块id"),
+ @Parameter(name = "appId", description = "appId")
+ },
+ responses = {
+ @ApiResponse(responseCode = "200", description = "返回信息",
+ content = @Content(mediaType = "application/json",
+ schema = @Schema(implementation = Block.class))),
+ @ApiResponse(responseCode = "400", description = "请求失败")}
+ )
+ @SystemControllerLog(description = "区块修改api")
+ @PostMapping("/block/update/{id}")
+ public Result updateBlocks(@Valid @RequestBody BlockDto blockDto, @PathVariable Integer id, @RequestParam Integer appId) {
+ blockDto.setId(id);
+ BlockDto blocksResult = blockService.updateBlockById(blockDto);
+ return Result.success(blocksResult);
+ }
+
+
+}
diff --git a/src/main/java/com/tinyengine/it/controller/BlockGroupController.java b/src/main/java/com/tinyengine/it/controller/BlockGroupController.java
new file mode 100644
index 00000000..037291a4
--- /dev/null
+++ b/src/main/java/com/tinyengine/it/controller/BlockGroupController.java
@@ -0,0 +1,151 @@
+package com.tinyengine.it.controller;
+
+
+import com.tinyengine.it.common.base.Result;
+import com.tinyengine.it.common.exception.ExceptionEnum;
+import com.tinyengine.it.common.exception.ServiceException;
+import com.tinyengine.it.config.log.SystemControllerLog;
+import com.tinyengine.it.mapper.BlockGroupMapper;
+import com.tinyengine.it.model.dto.BlockGroupDto;
+import com.tinyengine.it.model.entity.BlockGroup;
+import com.tinyengine.it.service.material.BlockGroupService;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ *
+ * 区块分组
+ *
+ *
+ * @author zhangjuncao
+ * @since 2024-10-30
+ */
+@Validated
+@RestController
+@RequestMapping("/material-center/api")
+public class BlockGroupController {
+ @Autowired
+ BlockGroupService blockGroupService;
+ @Autowired
+ BlockGroupMapper blockGroupMapper;
+
+ /**
+ * 获取区块分组
+ *
+ * @param ids ids
+ * @param appId appid
+ * @return the list
+ */
+ @Operation(summary = "获取区块分组",
+ description = "获取区块分组",
+ parameters = {
+ @Parameter(name = "ids", description = "分组ids"),
+ @Parameter(name = "appId", description = "appId")
+ },
+ responses = {
+ @ApiResponse(responseCode = "200", description = "返回信息",
+ content = @Content(mediaType = "application/json",
+ schema = @Schema())),
+ @ApiResponse(responseCode = "400", description = "请求失败")}
+ )
+ @SystemControllerLog(description = "获取区块分组")
+ @GetMapping("/block-groups")
+ public Result> getAllBlockGroups(@RequestParam(value = "id", required = false) List ids, @RequestParam(value = "app", required = false) Integer appId) {
+ List blockGroupsListResult = blockGroupService.getBlockGroupByIdsOrAppId(ids, appId);
+ return Result.success(blockGroupsListResult);
+ }
+
+
+ /**
+ * 创建区块分组
+ *
+ * @param blockGroup blockGroup
+ * @return the list
+ */
+ @Operation(summary = "创建区块分组",
+ description = "创建区块分组",
+ parameters = {
+ @Parameter(name = "blockGroups", description = "入参对象")
+ },
+ responses = {
+ @ApiResponse(responseCode = "200", description = "返回信息",
+ content = @Content(mediaType = "application/json",
+ schema = @Schema(implementation = BlockGroup.class))),
+ @ApiResponse(responseCode = "400", description = "请求失败")}
+ )
+ @SystemControllerLog(description = "创建区块分组")
+ @PostMapping("/block-groups/create")
+ public Result> createBlockGroups(@Valid @RequestBody BlockGroup blockGroup) {
+ return blockGroupService.createBlockGroup(blockGroup);
+ }
+
+ /**
+ * 修改区块分组
+ *
+ * @param id id
+ * @param blockGroup blockGroup
+ * @return the list
+ */
+ @Operation(summary = "修改区块分组",
+ description = "修改区块分组",
+ parameters = {
+ @Parameter(name = "id", description = "分组id"),
+ @Parameter(name = "blockGroups", description = "入参对象")
+ },
+ responses = {
+ @ApiResponse(responseCode = "200", description = "返回信息",
+ content = @Content(mediaType = "application/json",
+ schema = @Schema(implementation = BlockGroup.class))),
+ @ApiResponse(responseCode = "400", description = "请求失败")}
+ )
+ @SystemControllerLog(description = "修改区块分组")
+ @PostMapping("/block-groups/update/{id}")
+ public Result> updateBlockGroups(@Valid @PathVariable Integer id, @RequestBody BlockGroup blockGroup) {
+ blockGroup.setId(id);
+ blockGroupService.updateBlockGroupById(blockGroup);
+ // 页面返回数据显示
+ List blockGroupsListResult = blockGroupMapper.getBlockGroupsById(blockGroup.getId());
+ return Result.success(blockGroupsListResult);
+ }
+
+ /**
+ * 根据id删除区块分组
+ *
+ * @param id id
+ * @return the list
+ * @throws ServiceException serviceException
+ */
+ @Operation(summary = "根据id删除区块分组",
+ description = "根据id删除区块分组",
+ parameters = {
+ @Parameter(name = "id", description = "分组id")
+ },
+ responses = {
+ @ApiResponse(responseCode = "200", description = "返回信息",
+ content = @Content(mediaType = "application/json",
+ schema = @Schema(implementation = BlockGroup.class))),
+ @ApiResponse(responseCode = "400", description = "请求失败")}
+ )
+ @SystemControllerLog(description = "根据id删除区块分组")
+ @GetMapping("/block-groups/delete/{id}")
+ public Result> deleteBlockGroups(@PathVariable Integer id) throws ServiceException {
+ BlockGroupDto blockGroups = blockGroupService.findBlockGroupById(id);
+ if (blockGroups == null) {
+ return Result.failed(ExceptionEnum.CM009);
+ }
+ // 页面返回数据显示
+ List blockGroupsListResult = blockGroupMapper.getBlockGroupsById(blockGroups.getId());
+ blockGroupService.deleteBlockGroupById(id);
+ return Result.success(blockGroupsListResult);
+ }
+}
diff --git a/src/main/java/com/tinyengine/it/controller/TaskRecordController.java b/src/main/java/com/tinyengine/it/controller/TaskRecordController.java
new file mode 100644
index 00000000..1c4d80a8
--- /dev/null
+++ b/src/main/java/com/tinyengine/it/controller/TaskRecordController.java
@@ -0,0 +1,56 @@
+package com.tinyengine.it.controller;
+
+import com.tinyengine.it.common.base.Result;
+import com.tinyengine.it.config.log.SystemControllerLog;
+import com.tinyengine.it.model.entity.TaskRecord;
+import com.tinyengine.it.service.app.TaskRecordService;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ *
+ * 任务记录
+ *
+ *
+ * @author zhangjuncao
+ * @since 2024-10-30
+ */
+@Validated
+@RestController
+@CrossOrigin
+@RequestMapping("/app-center/api")
+public class TaskRecordController {
+ @Autowired
+ TaskRecordService taskRecordService;
+
+ /**
+ * 根据id查询task信息
+ *
+ * @param id
+ * @return task信息
+ */
+ @Operation(summary = "根据id查询task信息",
+ description = "根据id查询task信息",
+ parameters = {
+ @Parameter(name = "id", description = "task任务主键id")
+ },
+ responses = {
+ @ApiResponse(responseCode = "200", description = "返回信息",
+ content = @Content(mediaType = "application/json",
+ schema = @Schema(implementation = TaskRecord.class))),
+ @ApiResponse(responseCode = "400", description = "请求失败")}
+ )
+ @SystemControllerLog(description = "根据id查询task信息")
+ @GetMapping("/tasks/status/{id}")
+ public Result getTaskRecordById(@PathVariable Integer id) {
+ TaskRecord taskRecord = taskRecordService.queryTaskRecordById(id);
+ return Result.success(taskRecord);
+ }
+
+}
diff --git a/src/main/java/com/tinyengine/it/controller/TaskRecordMaterialController.java b/src/main/java/com/tinyengine/it/controller/TaskRecordMaterialController.java
new file mode 100644
index 00000000..d90de706
--- /dev/null
+++ b/src/main/java/com/tinyengine/it/controller/TaskRecordMaterialController.java
@@ -0,0 +1,86 @@
+package com.tinyengine.it.controller;
+
+
+import com.tinyengine.it.common.enums.Enums;
+import com.tinyengine.it.common.base.Result;
+import com.tinyengine.it.config.log.SystemControllerLog;
+import com.tinyengine.it.model.entity.TaskRecord;
+import com.tinyengine.it.service.material.TaskRecordService;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ *
+ * 任务记录
+ *
+ *
+ * @author zhangjuncao
+ * @since 2024-10-30
+ */
+@Validated
+@RestController
+@RequestMapping("/material-center/api")
+public class TaskRecordMaterialController {
+ @Autowired
+ TaskRecordService taskRecordService;
+
+ /**
+ * 根据id查询task信息
+ *
+ * @param id
+ * @return task信息
+ */
+ @GetMapping("/tasks/{id}")
+ public Result getTaskRecordById(@PathVariable Integer id) {
+ TaskRecord taskRecord = taskRecordService.queryTaskRecordById(id);
+ return Result.success(taskRecord);
+ }
+
+ /**
+ * 获取任务状态
+ *
+ * @param taskTypeId
+ * @param uniqueIds
+ * @return
+ */
+ @Operation(summary = "获取任务状态",
+ description = "获取任务状态",
+ parameters = {
+ @Parameter(name = "taskTypeId", description = "任务类型id"),
+ @Parameter(name = "uniqueIds", description = "uniqueIds")
+ },
+ responses = {
+ @ApiResponse(responseCode = "200", description = "返回信息",
+ content = @Content(mediaType = "application/json",
+ schema = @Schema(implementation = TaskRecord.class))),
+ @ApiResponse(responseCode = "400", description = "请求失败")}
+ )
+ @SystemControllerLog(description = "获取任务状态api")
+ @GetMapping("/tasks/status")
+ public Result> getTasksStatus(@RequestParam String taskTypeId, @RequestParam String uniqueIds) {
+
+ // 使用 queries 上下文支持批量查询。若未指定 taskTypeId,则默认查询物料打包任务状态
+ int taskTpyeIdTemp = Integer.parseInt(taskTypeId);
+ if (taskTpyeIdTemp == 0) {
+ // 若未指定 taskTypeId,则默认查询物料打包任务状态
+ taskTpyeIdTemp = Enums.TaskType.ASSETS_BUILD.getValue();
+
+ }
+ List> taskRecords = taskRecordService.status(taskTpyeIdTemp, uniqueIds);
+ List taskRecordList = taskRecords.stream()
+ .map(items -> items != null && !items.isEmpty() ? items.get(0) : null)
+ .filter(task -> task != null)
+ .collect(Collectors.toList());
+ return Result.success(taskRecordList);
+ }
+
+}
diff --git a/src/main/java/com/tinyengine/it/mapper/BlockGroupMapper.java b/src/main/java/com/tinyengine/it/mapper/BlockGroupMapper.java
index 127017eb..c470ab8b 100644
--- a/src/main/java/com/tinyengine/it/mapper/BlockGroupMapper.java
+++ b/src/main/java/com/tinyengine/it/mapper/BlockGroupMapper.java
@@ -1,9 +1,10 @@
package com.tinyengine.it.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.tinyengine.it.model.dto.BlockGroupDto;
import com.tinyengine.it.model.entity.BlockGroup;
-import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.*;
import java.util.List;
@@ -26,7 +27,7 @@ public interface BlockGroupMapper extends BaseMapper {
* @param id the id
* @return the block group
*/
- BlockGroup queryBlockGroupById(@Param("id") Integer id);
+ BlockGroupDto queryBlockGroupById(@Param("id") Integer id);
/**
* 根据条件查询表t_block_group数据
@@ -34,7 +35,7 @@ public interface BlockGroupMapper extends BaseMapper {
* @param blockGroup the block group
* @return the list
*/
- List queryBlockGroupByCondition(BlockGroup blockGroup);
+ List queryBlockGroupByCondition(BlockGroup blockGroup);
/**
* 根据主键id删除表t_block_group数据
@@ -67,4 +68,87 @@ public interface BlockGroupMapper extends BaseMapper {
* @return the list
*/
List queryBlockGroupByApp(Integer appId);
+
+ /**
+ * 根据blockGroupId获取区块分组信息以及关联的app和block信息
+ *
+ * @param blockGroupId the block group id
+ * @return the list
+ */
+ @Results({
+ @Result(column = "app", property = "appId"),
+ @Result(column = "app", property = "app",
+ one = @One(select = "com.tinyengine.it.mapper.AppMapper.queryAppById")),
+ @Result(column = "block_group_id", javaType = List.class, property = "blocks",
+ many = @Many(select = "com.tinyengine.it.mapper.BlockMapper.findBlocksByBlockGroupId"))
+ })
+ @Select("SELECT bg.*, bs.block_group_id as block_group_id, a.id as app " +
+ "FROM t_block_group bg " +
+ "left join t_app a on bg.app_id = a.id " +
+ "left join t_block bs on bg.id = bs.block_group_id " +
+ "WHERE bg.id = #{blockGroupId} " +
+ "GROUP BY bg.id")
+ List getBlockGroupsById(int blockGroupId);
+
+
+ /**
+ * 根据blockGroupIds获取区块分组信息以及关联的app和block信息
+ *
+ * @param ids the ids
+ * @return the list
+ */
+ @Results({
+ @Result(column = "app", property = "appId"),
+ @Result(column = "app", property = "app",
+ one = @One(select = "com.tinyengine.it.mapper.AppMapper.queryAppById")),
+ @Result(column = "block_group_id", javaType = List.class, property = "blocks",
+ many = @Many(select = "com.tinyengine.it.mapper.BlockMapper.findBlocksByBlockGroupId"))
+ })
+ @Select(""
+ )
+ List getBlockGroupsByIds(List ids);
+
+
+ /**
+ * 根据appId获取区块分组信息以及关联的app和block信息
+ *
+ * @param appId the app id
+ * @return the list
+ */
+ @Results({
+ @Result(column = "app", property = "appId"),
+ @Result(column = "app", property = "app",
+ one = @One(select = "com.tinyengine.it.mapper.AppMapper.queryAppById")),
+ @Result(column = "block_group_id", javaType = List.class, property = "blocks",
+ many = @Many(select = "com.tinyengine.it.mapper.BlockMapper.findBlocksByBlockGroupId"))
+ })
+ @Select("select bg.*, bs.block_group_id as block_group_id " +
+ "from t_block_group bg " +
+ "left join t_app a on bg.app_id = a.id " +
+ "left join t_block bs on bg.id = bs.block_group_id " +
+ "where bg.app_id = #{appId} " +
+ "GROUP BY bg.id")
+ List findGroupByAppId(int appId);
+
+
+ /**
+ * 根据区块id查询区块分组信息
+ *
+ * @param blockId the block id
+ * @return the list
+ */
+ @Select("select * from t_block_group bg " +
+ "left join t_block tb on bg.id = tb.block_group_id " +
+ "where tb.id = #{blockId}")
+ List findBlockGroupByBlockId(Integer blockId);
}
\ No newline at end of file
diff --git a/src/main/java/com/tinyengine/it/mapper/BlockHistoryMapper.java b/src/main/java/com/tinyengine/it/mapper/BlockHistoryMapper.java
index 5a7af846..053d6079 100644
--- a/src/main/java/com/tinyengine/it/mapper/BlockHistoryMapper.java
+++ b/src/main/java/com/tinyengine/it/mapper/BlockHistoryMapper.java
@@ -97,4 +97,14 @@ public interface BlockHistoryMapper extends BaseMapper {
""})
List queryBlockAndVersion(@Param("ids") List ids,
@Param("materialHistoryId") Integer materialHistoryId);
+
+ /**
+ * 根据blockId获取区块历史记录信息
+ *
+ * @param blockId the block id
+ * @return the list
+ */
+ @Select("select * from t_block_history bh " +
+ "where bh.ref_id = #{blockId}")
+ List findBlockHistoriesByBlockId(int blockId);
}
\ No newline at end of file
diff --git a/src/main/java/com/tinyengine/it/mapper/BlockMapper.java b/src/main/java/com/tinyengine/it/mapper/BlockMapper.java
index 50253e7d..6287f92f 100644
--- a/src/main/java/com/tinyengine/it/mapper/BlockMapper.java
+++ b/src/main/java/com/tinyengine/it/mapper/BlockMapper.java
@@ -1,9 +1,10 @@
package com.tinyengine.it.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.tinyengine.it.model.dto.BlockDto;
import com.tinyengine.it.model.entity.Block;
-import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.*;
import java.util.List;
@@ -59,4 +60,78 @@ public interface BlockMapper extends BaseMapper {
* @return the integer
*/
Integer createBlock(Block block);
+
+ /**
+ * 通过区块分组id获取区块信息
+ *
+ * @param blockGroupId the block group id
+ * @return the list
+ */
+ @Select("select b.* from t_block b " +
+ "where b.block_group_id = #{blockGroupId}")
+ List findBlocksByBlockGroupId(int blockGroupId);
+
+ /**
+ * 根据name或者description查询表t_block信息
+ *
+ * @param nameCn name
+ * @param description description
+ * @return the list
+ */
+ List findBlocksByNameCnAndDes(String nameCn, String description);
+
+ /**
+ * 根据区块id查询区块信息、以及关联的分组信息、区块历史信息
+ *
+ * @param blockId the block id
+ * @return block dto
+ */
+ @Results({
+ @Result(column = "occupier_by", property = "occupierId"),
+ @Result(column = "block_id", javaType = List.class, property = "groups",
+ many = @Many(select = "com.tinyengine.it.mapper.BlockGroupMapper.findBlockGroupByBlockId")),
+ @Result(column = "block_id", javaType = List.class, property = "histories",
+ many = @Many(select = "com.tinyengine.it.mapper.BlockHistoryMapper.findBlockHistoriesByBlockId")),
+ @Result(column = "occupier_by", property = "occupier",
+ one = @One(select = "com.tinyengine.it.mapper.UserMapper.queryUserById"))
+ })
+ @Select("select b.*, b.id as block_id " +
+ "from t_block b " +
+ "left join t_block_group bg on b.block_group_id = bg.id " +
+ "left join t_block_history bh on b.latest_history_id = bh.id " +
+ "where b.id = #{blockId} " +
+ "group by b.id")
+ BlockDto findBlockAndGroupAndHistoByBlockId(Integer blockId);
+
+
+ /**
+ * 根据区块id查询区块信息以及关联的历史信息
+ *
+ * @param blockId the block id
+ * @return the list
+ */
+ @Results({
+ @Result(column = "occupier_by", property = "occupierId"),
+ @Result(column = "block_id", javaType = List.class, property = "histories",
+ many = @Many(select = "com.tinyengine.it.mapper.BlockHistoryMapper.findBlockHistoriesByBlockId")),
+ @Result(column = "occupier_by", property = "occupier",
+ one = @One(select = "com.tinyengine.it.mapper.UserMapper.queryUserById"))
+ })
+ @Select("select b.*,bcbcb.block_id as block_categories_blocks_id,bsh.block_id as block_histories_block_id " +
+ "from t_block b " +
+ "left join t_block_history bh on b.latest_history_id = bh.id " +
+ "where b.id = #{blockId} " +
+ "group by b.id")
+ List findBlockAndHistorByBlockId(Integer blockId);
+
+
+ /**
+ * 通过区块分组id获取区块信息
+ *
+ * @param appId the app id
+ * @return the list
+ */
+
+ List findBlocksByBlockGroupIdAppId(int appId);
+
}
\ No newline at end of file
diff --git a/src/main/java/com/tinyengine/it/mapper/TaskRecordMapper.java b/src/main/java/com/tinyengine/it/mapper/TaskRecordMapper.java
index 49c6cc1e..743031c3 100644
--- a/src/main/java/com/tinyengine/it/mapper/TaskRecordMapper.java
+++ b/src/main/java/com/tinyengine/it/mapper/TaskRecordMapper.java
@@ -59,4 +59,22 @@ public interface TaskRecordMapper extends BaseMapper {
* @return the integer
*/
Integer createTaskRecord(TaskRecord taskRecord);
+
+ /**
+ * 根据taskTypeId、uniqueId按照created_at降序查询表task_record信息
+ *
+ * @param taskTypeId the task type id
+ * @param uniqueId the unique id
+ * @return the list
+ */
+ List findTaskRecordByTaskIdAndUniqueid(@Param("taskTypeId") Integer taskTypeId, @Param("uniqueId") Integer uniqueId);
+
+ /**
+ * 根据taskTypeId、uniqueId按照id降序查询表task_record一条信息
+ *
+ * @param taskTypeId the task type id
+ * @param uniqueId the unique id
+ * @return the task record
+ */
+ TaskRecord getUnfinishedTask(@Param("taskTypeId") Integer taskTypeId, @Param("uniqueId") Integer uniqueId);
}
\ No newline at end of file
diff --git a/src/main/java/com/tinyengine/it/mapper/UserMapper.java b/src/main/java/com/tinyengine/it/mapper/UserMapper.java
index 0555b7af..c0a0fe93 100644
--- a/src/main/java/com/tinyengine/it/mapper/UserMapper.java
+++ b/src/main/java/com/tinyengine/it/mapper/UserMapper.java
@@ -59,4 +59,12 @@ public interface UserMapper extends BaseMapper {
* @return the integer
*/
Integer createUser(User user);
+
+ /**
+ * 通过ids获取用户列表信息
+ *
+ * @param ids the ids
+ * @return the list
+ */
+ List selectUsersByIds(List ids);
}
\ No newline at end of file
diff --git a/src/main/java/com/tinyengine/it/model/dto/BlockDto.java b/src/main/java/com/tinyengine/it/model/dto/BlockDto.java
new file mode 100644
index 00000000..13221e73
--- /dev/null
+++ b/src/main/java/com/tinyengine/it/model/dto/BlockDto.java
@@ -0,0 +1,132 @@
+package com.tinyengine.it.model.dto;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.tinyengine.it.common.base.BaseEntity;
+import com.tinyengine.it.model.entity.BlockGroup;
+import com.tinyengine.it.model.entity.BlockHistory;
+import com.tinyengine.it.model.entity.User;
+import com.tinyengine.it.config.handler.ListTypeHandler;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+@Data
+public class BlockDto extends BaseEntity {
+ private static final long serialVersionUID = 1L;
+
+ @Schema(name = "label", description = "区块显示名称,严格大小写格式")
+ private String label;
+
+ @Schema(name = "name", description = "区块名称")
+ @JsonProperty("name_cn")
+ private String name;
+
+ @Schema(name = "framework", description = "技术栈")
+ private String framework;
+
+ @TableField(typeHandler = JacksonTypeHandler.class)
+ @Schema(name = "content", description = "区块内容")
+ private Map content;
+
+ @TableField(typeHandler = JacksonTypeHandler.class)
+ @Schema(name = "assets", description = "构建资源")
+ private Map assets;
+
+ @JsonProperty("last_build_info")
+ @TableField(typeHandler = JacksonTypeHandler.class)
+ @Schema(name = "lastBuildInfo", description = "最新一次构建信息")
+ private Map lastBuildInfo;
+
+ @Schema(name = "description", description = "描述")
+ private String description;
+
+ @Schema(name = "tags", description = "标签")
+ @TableField(typeHandler = ListTypeHandler.class)
+ private List tags;
+
+ @Schema(name = "latestVersion", description = "当前历史记录表最新版本")
+ @JsonProperty("latest_version")
+ private String latestVersion;
+
+ @Schema(name = "latestHistoryId", description = "当前历史记录表ID")
+ @JsonProperty("latest_history_id")
+ private Integer latestHistoryId;
+
+ @Schema(name = "screenshot", description = "截屏")
+ private String screenshot;
+
+ @Schema(name = "path", description = "区块路径")
+ private String path;
+
+ @Schema(name = "occupierId", description = "当前锁定人id")
+ private String occupierId;
+
+ @Schema(name = "isOfficial", description = "是否是官方")
+ @JsonProperty("is_official")
+ private Boolean isOfficial;
+
+ @Schema(name = "public", description = "公开状态:0,1,2")
+ @JsonProperty("public")
+ private Integer publicStatus;
+
+ @Schema(name = "isDefault", description = "是否是默认")
+ @JsonProperty("is_default")
+ private Boolean isDefault;
+
+ @Schema(name = "tinyReserved", description = "是否是tiny专有")
+ @JsonProperty("tiny_reserved")
+ private Boolean tinyReserved;
+
+ @Schema(name = "npmName", description = "npm包名")
+ @JsonProperty("npm_name")
+ private String npmName;
+
+ @Schema(name = "i18n", description = "国际化内容")
+ private String i18n;
+
+ @Schema(name = "platformId", description = "设计器ID")
+ @JsonProperty("platform_id")
+ private Integer platformId;
+
+ @Schema(name = "appId", description = "创建区块时所在appId")
+ @JsonProperty("created_app")
+ private Integer appId;
+
+ @Schema(name = "contentBlocks", description = "*设计预留字段用途*")
+ @JsonProperty("content_blocks")
+ private String contentBlocks;
+
+ @Schema(name = "blockGroupId", description = "区块分组id,关联t_block_group表id")
+ @JsonProperty("block_group_id")
+ private Integer blockGroupId;
+
+ @JsonProperty("occupier")
+ @Schema(name = "occupierBy", description = "当前锁定人")
+ private User occupier;
+
+ @TableField(exist = false)
+ private List