From 7a5501ce0698f7780cae0ca492d621db5c1f9c47 Mon Sep 17 00:00:00 2001 From: xiachao Date: Fri, 23 Aug 2024 09:45:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=A7=E5=93=81=E7=A2=B3=E8=B6=B3=E8=BF=B9?= =?UTF-8?q?=E6=8A=A5=E5=91=8A=EF=BC=8Cbug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/pom.xml | 5 +- .../IotCarbonProductionResultController.java | 2 +- .../IotCarbonProductionReportController.java | 4 + .../IotCarbonProductionReportServiceImpl.java | 4 + .../IotVisualComponentController.java | 89 ++++++++++++++++++ .../component/dto/IotVisualComponentDTO.java | 59 ++++++++++++ .../entity/IotVisualComponentEntity.java | 79 ++++++++++++++++ .../mapper/IotVisualComponentMapper.java | 16 ++++ .../service/IotVisualComponentService.java | 14 +++ .../impl/IotVisualComponentServiceImpl.java | 28 ++++++ .../controller/IotVisualGroupController.java | 90 +++++++++++++++++++ .../thing/visual/group/dto/GroupSortInfo.java | 14 +++ .../visual/group/dto/IotVisualGroupDTO.java | 55 ++++++++++++ .../group/entity/IotVisualGroupEntity.java | 71 +++++++++++++++ .../group/mapper/IotVisualGroupMapper.java | 16 ++++ .../group/service/IotVisualGroupService.java | 21 +++++ .../impl/IotVisualGroupServiceImpl.java | 68 ++++++++++++++ .../resources/IotVisualComponentMapper.xml | 6 ++ .../main/resources/IotVisualGroupMapper.xml | 7 ++ pom.xml | 5 ++ 20 files changed, 651 insertions(+), 2 deletions(-) create mode 100644 modules/visual-design/src/main/java/com/thing/visual/component/controller/IotVisualComponentController.java create mode 100644 modules/visual-design/src/main/java/com/thing/visual/component/dto/IotVisualComponentDTO.java create mode 100644 modules/visual-design/src/main/java/com/thing/visual/component/entity/IotVisualComponentEntity.java create mode 100644 modules/visual-design/src/main/java/com/thing/visual/component/mapper/IotVisualComponentMapper.java create mode 100644 modules/visual-design/src/main/java/com/thing/visual/component/service/IotVisualComponentService.java create mode 100644 modules/visual-design/src/main/java/com/thing/visual/component/service/impl/IotVisualComponentServiceImpl.java create mode 100644 modules/visual-design/src/main/java/com/thing/visual/group/controller/IotVisualGroupController.java create mode 100644 modules/visual-design/src/main/java/com/thing/visual/group/dto/GroupSortInfo.java create mode 100644 modules/visual-design/src/main/java/com/thing/visual/group/dto/IotVisualGroupDTO.java create mode 100644 modules/visual-design/src/main/java/com/thing/visual/group/entity/IotVisualGroupEntity.java create mode 100644 modules/visual-design/src/main/java/com/thing/visual/group/mapper/IotVisualGroupMapper.java create mode 100644 modules/visual-design/src/main/java/com/thing/visual/group/service/IotVisualGroupService.java create mode 100644 modules/visual-design/src/main/java/com/thing/visual/group/service/impl/IotVisualGroupServiceImpl.java create mode 100644 modules/visual-design/src/main/resources/IotVisualComponentMapper.xml create mode 100644 modules/visual-design/src/main/resources/IotVisualGroupMapper.xml diff --git a/application/pom.xml b/application/pom.xml index fe426e3..d45a2d4 100644 --- a/application/pom.xml +++ b/application/pom.xml @@ -141,7 +141,10 @@ com.thing.modules cqc-service - + + com.thing.modules + visual-design + org.springframework.boot diff --git a/modules/carbon-track/src/main/java/com/thing/carbontrack/productionResult/controller/IotCarbonProductionResultController.java b/modules/carbon-track/src/main/java/com/thing/carbontrack/productionResult/controller/IotCarbonProductionResultController.java index 2899aba..fec92de 100644 --- a/modules/carbon-track/src/main/java/com/thing/carbontrack/productionResult/controller/IotCarbonProductionResultController.java +++ b/modules/carbon-track/src/main/java/com/thing/carbontrack/productionResult/controller/IotCarbonProductionResultController.java @@ -115,7 +115,7 @@ public class IotCarbonProductionResultController { String end = MapUtils.getString(params, "end"); Integer dataType = MapUtils.getInteger(params, "dataType"); if (Objects.isNull(productId)) { - return new Result<>(); + return new Result<>().ok(new LotCarbonBaseInfoOnYear()); } if (Objects.equals(dataType, 0)) { LotCarbonBaseInfoOnYear res = iotCarbonProductionResultService.getDetailOfBaseInfoOnYear(productId); diff --git a/modules/carbon-track/src/main/java/com/thing/carbontrack/report/controller/IotCarbonProductionReportController.java b/modules/carbon-track/src/main/java/com/thing/carbontrack/report/controller/IotCarbonProductionReportController.java index 6399d13..4c48e10 100644 --- a/modules/carbon-track/src/main/java/com/thing/carbontrack/report/controller/IotCarbonProductionReportController.java +++ b/modules/carbon-track/src/main/java/com/thing/carbontrack/report/controller/IotCarbonProductionReportController.java @@ -17,6 +17,7 @@ import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameters; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; +import org.apache.commons.lang3.ObjectUtils; import org.springframework.web.bind.annotation.*; import java.util.HashMap; @@ -112,6 +113,9 @@ public class IotCarbonProductionReportController { @LogOperation("生成报告预览") public Result generateReport(@RequestBody IotCarbonProductionReportConfigDTO config){ IotCarbonProductionReportDTO data = iotCarbonProductionReportService.generateReport(config); + if(ObjectUtils.isEmpty(data)){ + return new Result().ok(data); + } String reportCode = iotCarbonProductionReportService.generateReportCode( null, data.getBoundaryStart(), data.getBoundaryEnd()); diff --git a/modules/carbon-track/src/main/java/com/thing/carbontrack/report/service/impl/IotCarbonProductionReportServiceImpl.java b/modules/carbon-track/src/main/java/com/thing/carbontrack/report/service/impl/IotCarbonProductionReportServiceImpl.java index c48eb75..4e86991 100644 --- a/modules/carbon-track/src/main/java/com/thing/carbontrack/report/service/impl/IotCarbonProductionReportServiceImpl.java +++ b/modules/carbon-track/src/main/java/com/thing/carbontrack/report/service/impl/IotCarbonProductionReportServiceImpl.java @@ -12,6 +12,7 @@ import com.thing.common.orm.service.impl.BaseServiceImpl; import lombok.RequiredArgsConstructor; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.MapUtils; +import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.Pair; import org.springframework.stereotype.Service; @@ -102,6 +103,9 @@ public class IotCarbonProductionReportServiceImpl extends BaseServiceImpl timePair = getBoundary(config); + if(ObjectUtils.isEmpty(config.getProductId())){ + return null; + } return resultService.generateReport( config.getProductId(), config.getBoundaryType(), diff --git a/modules/visual-design/src/main/java/com/thing/visual/component/controller/IotVisualComponentController.java b/modules/visual-design/src/main/java/com/thing/visual/component/controller/IotVisualComponentController.java new file mode 100644 index 0000000..ac1fe86 --- /dev/null +++ b/modules/visual-design/src/main/java/com/thing/visual/component/controller/IotVisualComponentController.java @@ -0,0 +1,89 @@ +package com.thing.visual.component.controller; + +import com.thing.common.core.annotation.LogOperation; +import com.thing.common.core.constants.Constant; +import com.thing.common.core.validator.AssertUtils; +import com.thing.common.core.validator.ValidatorUtils; +import com.thing.common.core.validator.group.AddGroup; +import com.thing.common.core.validator.group.DefaultGroup; +import com.thing.common.core.validator.group.UpdateGroup; +import com.thing.common.core.web.response.PageData; +import com.thing.common.core.web.response.Result; +import com.thing.visual.component.dto.IotVisualComponentDTO; +import com.thing.visual.component.service.IotVisualComponentService; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.*; + +import java.util.Map; + +/** +* 部件设计信息 +* +* @author xc +* @since 3.0 2024-08-21 +*/ +@RestController +@RequestMapping("v2/visual/component") +@Tag(name="部件设计信息") +@RequiredArgsConstructor +public class IotVisualComponentController { + + private final IotVisualComponentService iotVisualComponentService; + + @GetMapping("page") + @Operation(summary="分页") + @Parameters({ + @Parameter(name = Constant.PAGE, description = "当前页码,从1开始", required = true) , + @Parameter(name = Constant.LIMIT, description = "每页显示记录数", required = true) , + @Parameter(name = Constant.ORDER_FIELD, description = "排序字段") , + @Parameter(name = Constant.ORDER, description = "排序方式,可选值(asc、desc)") + }) + public Result> page(@Parameter(hidden = true) @RequestParam Map params){ + PageData page = iotVisualComponentService.getPageData(params, IotVisualComponentDTO.class); + return new Result>().ok(page); + } + + @GetMapping("{id}") + @Operation(summary="信息") + public Result get(@PathVariable("id") Long id){ + IotVisualComponentDTO data = iotVisualComponentService.getByIdAs(id, IotVisualComponentDTO.class); + return new Result().ok(data); + } + + @PostMapping + @Operation(summary="保存") + @LogOperation("保存") + public Result save(@RequestBody IotVisualComponentDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + iotVisualComponentService.saveDto(dto); + return new Result<>(); + } + + @PutMapping + @Operation(summary="修改") + @LogOperation("修改") + public Result update(@RequestBody IotVisualComponentDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + iotVisualComponentService.updateDto(dto); + return new Result<>(); + } + + @DeleteMapping + @Operation(summary="删除") + @LogOperation("删除") + public Result delete(@RequestBody Long[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + iotVisualComponentService.batchDelete(ids); + return new Result<>(); + } + + +} \ No newline at end of file diff --git a/modules/visual-design/src/main/java/com/thing/visual/component/dto/IotVisualComponentDTO.java b/modules/visual-design/src/main/java/com/thing/visual/component/dto/IotVisualComponentDTO.java new file mode 100644 index 0000000..cb63093 --- /dev/null +++ b/modules/visual-design/src/main/java/com/thing/visual/component/dto/IotVisualComponentDTO.java @@ -0,0 +1,59 @@ +package com.thing.visual.component.dto; + +import io.swagger.v3.oas.annotations.media.Schema; + +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; + +/** +* 部件设计信息 +* +* @author xc +* @since 3.0 2024-08-21 +*/ +@Data +@Schema(description = "部件设计信息") +public class IotVisualComponentDTO implements Serializable { + @Serial + private static final long serialVersionUID = 1L; + + @Schema(description = "部件id") + private Long id; + @Schema(description = "部件名称") + private String name; + @Schema(description = "部件组id") + private Integer groupId; + @Schema(description = "部件类型") + private String type; + @Schema(description = "部件备注描述") + private String desc; + @Schema(description = "0 是 1否") + private String isDefault; + @Schema(description = "部件缩略图url") + private String thumbnailUrl; + @Schema(description = "preview_options") + private String previewOptions; + @Schema(description = "部件json") + private String hash; + @Schema(description = "备注说明") + private String remarks; + @Schema(description = "所属企业(租户code)") + private Long tenantCode; + @Schema(description = "企业详情id") + private Long companyId; + @Schema(description = "部门id") + private Long deptId; + @Schema(description = "创建者") + private Long creator; + @Schema(description = "创建时间") + private Long createDate; + @Schema(description = "更新者") + private Long updater; + @Schema(description = "更新时间") + private Long updateDate; + @Schema(description = "部件排序序号") + private Integer sort; + +} \ No newline at end of file diff --git a/modules/visual-design/src/main/java/com/thing/visual/component/entity/IotVisualComponentEntity.java b/modules/visual-design/src/main/java/com/thing/visual/component/entity/IotVisualComponentEntity.java new file mode 100644 index 0000000..a6f8435 --- /dev/null +++ b/modules/visual-design/src/main/java/com/thing/visual/component/entity/IotVisualComponentEntity.java @@ -0,0 +1,79 @@ +package com.thing.visual.component.entity; + +import com.mybatisflex.annotation.Table; +import com.thing.common.orm.entity.BaseInfoEntity; + +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serial; +import java.io.Serializable; + +/** + * 部件设计信息 + * + * @author xc + * @since 3.0 2024-08-21 + */ +@Data +@Accessors(chain = true) +@EqualsAndHashCode(callSuper=false) +@Table("iot_visual_component") +public class IotVisualComponentEntity extends BaseInfoEntity implements Serializable { + @Serial + private static final long serialVersionUID = 1L; + + /** + * 部件名称 + */ + private String name; + /** + * 部件组id + */ + private Integer groupId; + /** + * 部件类型 + */ + private String type; + /** + * 部件备注描述 + */ + private String desc; + /** + * 0 是 1否 + */ + private String isDefault; + /** + * 部件缩略图url + */ + private String thumbnailUrl; + /** + * preview_options + */ + private String previewOptions; + /** + * 部件json + */ + private String hash; + /** + * 备注说明 + */ + private String remarks; + /** + * 所属企业(租户code) + */ + private Long tenantCode; + /** + * 企业详情id + */ + private Long companyId; + /** + * 部门id + */ + private Long deptId; + /** + * 部件排序序号 + */ + private Integer sort; +} \ No newline at end of file diff --git a/modules/visual-design/src/main/java/com/thing/visual/component/mapper/IotVisualComponentMapper.java b/modules/visual-design/src/main/java/com/thing/visual/component/mapper/IotVisualComponentMapper.java new file mode 100644 index 0000000..da58825 --- /dev/null +++ b/modules/visual-design/src/main/java/com/thing/visual/component/mapper/IotVisualComponentMapper.java @@ -0,0 +1,16 @@ +package com.thing.visual.component.mapper; + +import com.thing.common.orm.mapper.PowerBaseMapper; +import com.thing.visual.component.entity.IotVisualComponentEntity; +import org.apache.ibatis.annotations.Mapper; + +/** +* 部件设计信息 +* +* @author xc +* @since 3.0 2024-08-21 +*/ +@Mapper +public interface IotVisualComponentMapper extends PowerBaseMapper { + +} \ No newline at end of file diff --git a/modules/visual-design/src/main/java/com/thing/visual/component/service/IotVisualComponentService.java b/modules/visual-design/src/main/java/com/thing/visual/component/service/IotVisualComponentService.java new file mode 100644 index 0000000..7d9aff9 --- /dev/null +++ b/modules/visual-design/src/main/java/com/thing/visual/component/service/IotVisualComponentService.java @@ -0,0 +1,14 @@ +package com.thing.visual.component.service; + +import com.thing.common.orm.service.IBaseService; +import com.thing.visual.component.entity.IotVisualComponentEntity; + +/** + * 部件设计信息 + * + * @author xc + * @since 3.0 2024-08-21 + */ +public interface IotVisualComponentService extends IBaseService { + +} \ No newline at end of file diff --git a/modules/visual-design/src/main/java/com/thing/visual/component/service/impl/IotVisualComponentServiceImpl.java b/modules/visual-design/src/main/java/com/thing/visual/component/service/impl/IotVisualComponentServiceImpl.java new file mode 100644 index 0000000..eb9ab1b --- /dev/null +++ b/modules/visual-design/src/main/java/com/thing/visual/component/service/impl/IotVisualComponentServiceImpl.java @@ -0,0 +1,28 @@ +package com.thing.visual.component.service.impl; + +import com.mybatisflex.core.query.QueryWrapper; +import com.thing.common.orm.service.impl.BaseServiceImpl; +import com.thing.visual.component.entity.IotVisualComponentEntity; +import com.thing.visual.component.mapper.IotVisualComponentMapper; +import com.thing.visual.component.service.IotVisualComponentService; +import org.springframework.stereotype.Service; + +import java.util.Map; + +/** + * 部件设计信息 + * + * @author xc + * @since 3.0 2024-08-21 + */ +@Service +public class IotVisualComponentServiceImpl extends BaseServiceImpl implements IotVisualComponentService { + + @Override + public QueryWrapper getWrapper(Map params){ + QueryWrapper wrapper = new QueryWrapper(); + return wrapper; + } + + +} \ No newline at end of file diff --git a/modules/visual-design/src/main/java/com/thing/visual/group/controller/IotVisualGroupController.java b/modules/visual-design/src/main/java/com/thing/visual/group/controller/IotVisualGroupController.java new file mode 100644 index 0000000..1815410 --- /dev/null +++ b/modules/visual-design/src/main/java/com/thing/visual/group/controller/IotVisualGroupController.java @@ -0,0 +1,90 @@ +package com.thing.visual.group.controller; + +import com.thing.common.core.constants.Constant; +import com.thing.common.core.validator.AssertUtils; +import com.thing.common.core.web.response.PageData; +import com.thing.common.core.web.response.Result; +import com.thing.visual.group.dto.GroupSortInfo; +import com.thing.visual.group.dto.IotVisualGroupDTO; +import com.thing.visual.group.service.IotVisualGroupService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.*; + +import java.util.Map; + +/** +* 素材部件组管理 +* +* @author xc +* @since 3.0 2024-08-21 +*/ +@RestController +@RequestMapping("v2/visual/group") +@Tag(name="素材部件组管理") +@RequiredArgsConstructor +public class IotVisualGroupController { + + private final IotVisualGroupService iotVisualGroupService; + + @GetMapping("page") + @Operation(summary="分页") + @Parameters({ + @Parameter(name = Constant.PAGE, description = "当前页码,从1开始", required = true) , + @Parameter(name = Constant.LIMIT, description = "每页显示记录数", required = true) , + @Parameter(name = Constant.ORDER_FIELD, description = "排序字段") , + @Parameter(name = Constant.ORDER, description = "排序方式,可选值(asc、desc)") + }) + public Result> page(@Parameter(hidden = true) @RequestParam Map params){ + PageData page = iotVisualGroupService.getPageData(params, IotVisualGroupDTO.class); + return new Result>().ok(page); + } + + @GetMapping("{id}") + @Operation(summary="信息") + public Result get(@PathVariable("id") Long id){ + IotVisualGroupDTO data = iotVisualGroupService.getByIdAs(id, IotVisualGroupDTO.class); + return new Result().ok(data); + } + + @PostMapping + @Operation(summary="保存") + public Result save(@RequestBody IotVisualGroupDTO dto){ + iotVisualGroupService.saveIotVisualGroupDTO(dto); + return new Result<>(); + } + + @PutMapping + @Operation(summary="修改") + public Result update(@RequestBody IotVisualGroupDTO dto){ + iotVisualGroupService.updateIotVisualGroupDTO(dto); + return new Result<>(); + } + + @DeleteMapping + @Operation(summary="删除") + public Result delete(@RequestBody Long[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + iotVisualGroupService.batchDelete(ids); + return new Result<>(); + } + + + @GetMapping("groupSortInfo") + @Operation(summary="获取排序信息,可以传入已存在的组名称") + public Result groupSortInfo(@RequestParam(required = false) String name){ + GroupSortInfo data = iotVisualGroupService.groupSortInfo(name); + return new Result().ok(data); + } + +// @GetMapping("adjustGroupSort") +// @Operation(summary="调整组排序") +// public Result adjustGroupSort(){ +// String data = iotVisualGroupService.adjustGroupSort(); +// return new Result().ok(data); +// } +} \ No newline at end of file diff --git a/modules/visual-design/src/main/java/com/thing/visual/group/dto/GroupSortInfo.java b/modules/visual-design/src/main/java/com/thing/visual/group/dto/GroupSortInfo.java new file mode 100644 index 0000000..aa3c9cd --- /dev/null +++ b/modules/visual-design/src/main/java/com/thing/visual/group/dto/GroupSortInfo.java @@ -0,0 +1,14 @@ +package com.thing.visual.group.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +@Schema(description = "组排序信息") +public class GroupSortInfo { + + private Long sort; + + private Long bsSort; + +} diff --git a/modules/visual-design/src/main/java/com/thing/visual/group/dto/IotVisualGroupDTO.java b/modules/visual-design/src/main/java/com/thing/visual/group/dto/IotVisualGroupDTO.java new file mode 100644 index 0000000..4a0d7c9 --- /dev/null +++ b/modules/visual-design/src/main/java/com/thing/visual/group/dto/IotVisualGroupDTO.java @@ -0,0 +1,55 @@ +package com.thing.visual.group.dto; + +import io.swagger.v3.oas.annotations.media.Schema; + +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; + +/** +* 素材部件组管理 +* +* @author xc +* @since 3.0 2024-08-21 +*/ +@Data +@Schema(description = "素材部件组管理") +public class IotVisualGroupDTO implements Serializable { + @Serial + private static final long serialVersionUID = 1L; + + @Schema(description = "主键id") + private Long id; + @Schema(description = "素材/部件组名称") + private String name; + @Schema(description = "素材/部件组业务二级名称") + private String businessName; + @Schema(description = "1 素材,2部件") + private String type; + @Schema(description = "是否默认,0默认,1自定义") + private String isDefault; + @Schema(description = "缩略图url/这里放text,也可以是svg或base64") + private String thumbnailUrl; + @Schema(description = "组排序") + private Long sort; + @Schema(description = "二级业务排序") + private Long bsSort; + @Schema(description = "备注说明") + private String remark; + @Schema(description = "所属企业(租户code)") + private Long tenantCode; + @Schema(description = "企业详情id") + private Long companyId; + @Schema(description = "部门id") + private Long deptId; + @Schema(description = "创建者") + private Long creator; + @Schema(description = "创建时间") + private Long createDate; + @Schema(description = "更新者") + private Long updater; + @Schema(description = "更新时间") + private Long updateDate; + +} \ No newline at end of file diff --git a/modules/visual-design/src/main/java/com/thing/visual/group/entity/IotVisualGroupEntity.java b/modules/visual-design/src/main/java/com/thing/visual/group/entity/IotVisualGroupEntity.java new file mode 100644 index 0000000..7f1d211 --- /dev/null +++ b/modules/visual-design/src/main/java/com/thing/visual/group/entity/IotVisualGroupEntity.java @@ -0,0 +1,71 @@ +package com.thing.visual.group.entity; + +import com.mybatisflex.annotation.Table; +import com.thing.common.orm.entity.BaseInfoEntity; + +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serial; +import java.io.Serializable; + +/** + * 素材部件组管理 + * + * @author xc + * @since 3.0 2024-08-21 + */ +@Data +@Accessors(chain = true) +@EqualsAndHashCode(callSuper=false) +@Table("iot_visual_group") +public class IotVisualGroupEntity extends BaseInfoEntity implements Serializable { + @Serial + private static final long serialVersionUID = 1L; + + /** + * 素材/部件组名称 + */ + private String name; + /** + * 素材/部件组业务二级名称 + */ + private String businessName; + /** + * 1 素材,2部件 + */ + private String type; + /** + * 是否默认,0默认,1自定义 + */ + private String isDefault; + /** + * 缩略图url/这里放text,也可以是svg或base64 + */ + private String thumbnailUrl; + /** + * 组排序 + */ + private Long sort; + /** + * 二级业务排序 + */ + private Long bsSort; + /** + * 备注说明 + */ + private String remark; + /** + * 所属企业(租户code) + */ + private Long tenantCode; + /** + * 企业详情id + */ + private Long companyId; + /** + * 部门id + */ + private Long deptId; +} \ No newline at end of file diff --git a/modules/visual-design/src/main/java/com/thing/visual/group/mapper/IotVisualGroupMapper.java b/modules/visual-design/src/main/java/com/thing/visual/group/mapper/IotVisualGroupMapper.java new file mode 100644 index 0000000..fd61840 --- /dev/null +++ b/modules/visual-design/src/main/java/com/thing/visual/group/mapper/IotVisualGroupMapper.java @@ -0,0 +1,16 @@ +package com.thing.visual.group.mapper; + +import com.thing.common.orm.mapper.PowerBaseMapper; +import com.thing.visual.group.entity.IotVisualGroupEntity; +import org.apache.ibatis.annotations.Mapper; + +/** +* 素材部件组管理 +* +* @author xc +* @since 3.0 2024-08-21 +*/ +@Mapper +public interface IotVisualGroupMapper extends PowerBaseMapper { + +} \ No newline at end of file diff --git a/modules/visual-design/src/main/java/com/thing/visual/group/service/IotVisualGroupService.java b/modules/visual-design/src/main/java/com/thing/visual/group/service/IotVisualGroupService.java new file mode 100644 index 0000000..431caec --- /dev/null +++ b/modules/visual-design/src/main/java/com/thing/visual/group/service/IotVisualGroupService.java @@ -0,0 +1,21 @@ +package com.thing.visual.group.service; + +import com.thing.common.orm.service.IBaseService; +import com.thing.visual.group.dto.GroupSortInfo; +import com.thing.visual.group.dto.IotVisualGroupDTO; +import com.thing.visual.group.entity.IotVisualGroupEntity; + +/** + * 素材部件组管理 + * + * @author xc + * @since 3.0 2024-08-21 + */ +public interface IotVisualGroupService extends IBaseService { + + void saveIotVisualGroupDTO(IotVisualGroupDTO dto); + + void updateIotVisualGroupDTO(IotVisualGroupDTO dto); + + GroupSortInfo groupSortInfo(String name); +} \ No newline at end of file diff --git a/modules/visual-design/src/main/java/com/thing/visual/group/service/impl/IotVisualGroupServiceImpl.java b/modules/visual-design/src/main/java/com/thing/visual/group/service/impl/IotVisualGroupServiceImpl.java new file mode 100644 index 0000000..456f866 --- /dev/null +++ b/modules/visual-design/src/main/java/com/thing/visual/group/service/impl/IotVisualGroupServiceImpl.java @@ -0,0 +1,68 @@ +package com.thing.visual.group.service.impl; + +import com.mybatisflex.core.query.QueryWrapper; +import com.thing.common.orm.service.impl.BaseServiceImpl; +import com.thing.visual.group.dto.GroupSortInfo; +import com.thing.visual.group.dto.IotVisualGroupDTO; +import com.thing.visual.group.mapper.IotVisualGroupMapper; +import com.thing.visual.group.entity.IotVisualGroupEntity; +import com.thing.visual.group.service.IotVisualGroupService; +import org.apache.commons.lang3.ObjectUtils; +import org.springframework.stereotype.Service; + +import java.util.Map; + +import static com.mybatisflex.core.query.QueryMethods.max; +import static com.mybatisflex.core.query.QueryMethods.max; +import static com.thing.visual.group.entity.table.IotVisualGroupEntityTableDef.IOT_VISUAL_GROUP_ENTITY; + +/** + * 素材部件组管理 + * + * @author xc + * @since 3.0 2024-08-21 + */ +@Service +public class IotVisualGroupServiceImpl extends BaseServiceImpl implements IotVisualGroupService { + + @Override + public QueryWrapper getWrapper(Map params){ + QueryWrapper wrapper = new QueryWrapper(); + return wrapper; + } + + + @Override + public void saveIotVisualGroupDTO(IotVisualGroupDTO dto) { + + } + + @Override + public void updateIotVisualGroupDTO(IotVisualGroupDTO dto) { + + } + + @Override + public GroupSortInfo groupSortInfo(String name) { + QueryWrapper wrapper = new QueryWrapper(); + wrapper.select(max(IOT_VISUAL_GROUP_ENTITY.SORT).as("sort"), max(IOT_VISUAL_GROUP_ENTITY.BS_SORT).as("bs_sort")) + .from(IOT_VISUAL_GROUP_ENTITY); + if(ObjectUtils.isNotEmpty(name)){ + wrapper.eq(IotVisualGroupEntity::getName,name); + } + GroupSortInfo sortInfo = this.mapper.selectOneByQueryAs(wrapper,GroupSortInfo.class); + if(ObjectUtils.isEmpty(sortInfo)){ + sortInfo = new GroupSortInfo(); + sortInfo.setBsSort(1L); + sortInfo.setSort(1L); + return sortInfo; + } + if(ObjectUtils.isNotEmpty(name)){ + sortInfo.setSort(sortInfo.getSort()==null?1L:sortInfo.getSort()); + }else { + sortInfo.setSort(sortInfo.getSort()==null?1L:sortInfo.getSort()+1); + } + sortInfo.setBsSort(sortInfo.getBsSort()==null?1L:sortInfo.getBsSort()+1); + return sortInfo ; + } +} \ No newline at end of file diff --git a/modules/visual-design/src/main/resources/IotVisualComponentMapper.xml b/modules/visual-design/src/main/resources/IotVisualComponentMapper.xml new file mode 100644 index 0000000..a557501 --- /dev/null +++ b/modules/visual-design/src/main/resources/IotVisualComponentMapper.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/modules/visual-design/src/main/resources/IotVisualGroupMapper.xml b/modules/visual-design/src/main/resources/IotVisualGroupMapper.xml new file mode 100644 index 0000000..56650fc --- /dev/null +++ b/modules/visual-design/src/main/resources/IotVisualGroupMapper.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index ae0aa28..6a64631 100644 --- a/pom.xml +++ b/pom.xml @@ -626,6 +626,11 @@ cqc-service ${project.version} + + com.thing.modules + visual-design + ${project.version} + com.thing.tools