Browse Source

产品碳足迹报告,bug修复

thing_master
xiachao 1 year ago
parent
commit
7a5501ce06
  1. 5
      application/pom.xml
  2. 2
      modules/carbon-track/src/main/java/com/thing/carbontrack/productionResult/controller/IotCarbonProductionResultController.java
  3. 4
      modules/carbon-track/src/main/java/com/thing/carbontrack/report/controller/IotCarbonProductionReportController.java
  4. 4
      modules/carbon-track/src/main/java/com/thing/carbontrack/report/service/impl/IotCarbonProductionReportServiceImpl.java
  5. 89
      modules/visual-design/src/main/java/com/thing/visual/component/controller/IotVisualComponentController.java
  6. 59
      modules/visual-design/src/main/java/com/thing/visual/component/dto/IotVisualComponentDTO.java
  7. 79
      modules/visual-design/src/main/java/com/thing/visual/component/entity/IotVisualComponentEntity.java
  8. 16
      modules/visual-design/src/main/java/com/thing/visual/component/mapper/IotVisualComponentMapper.java
  9. 14
      modules/visual-design/src/main/java/com/thing/visual/component/service/IotVisualComponentService.java
  10. 28
      modules/visual-design/src/main/java/com/thing/visual/component/service/impl/IotVisualComponentServiceImpl.java
  11. 90
      modules/visual-design/src/main/java/com/thing/visual/group/controller/IotVisualGroupController.java
  12. 14
      modules/visual-design/src/main/java/com/thing/visual/group/dto/GroupSortInfo.java
  13. 55
      modules/visual-design/src/main/java/com/thing/visual/group/dto/IotVisualGroupDTO.java
  14. 71
      modules/visual-design/src/main/java/com/thing/visual/group/entity/IotVisualGroupEntity.java
  15. 16
      modules/visual-design/src/main/java/com/thing/visual/group/mapper/IotVisualGroupMapper.java
  16. 21
      modules/visual-design/src/main/java/com/thing/visual/group/service/IotVisualGroupService.java
  17. 68
      modules/visual-design/src/main/java/com/thing/visual/group/service/impl/IotVisualGroupServiceImpl.java
  18. 6
      modules/visual-design/src/main/resources/IotVisualComponentMapper.xml
  19. 7
      modules/visual-design/src/main/resources/IotVisualGroupMapper.xml
  20. 5
      pom.xml

5
application/pom.xml

@ -141,7 +141,10 @@
<groupId>com.thing.modules</groupId> <groupId>com.thing.modules</groupId>
<artifactId>cqc-service</artifactId> <artifactId>cqc-service</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.thing.modules</groupId>
<artifactId>visual-design</artifactId>
</dependency>
<!-- test --> <!-- test -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>

2
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"); String end = MapUtils.getString(params, "end");
Integer dataType = MapUtils.getInteger(params, "dataType"); Integer dataType = MapUtils.getInteger(params, "dataType");
if (Objects.isNull(productId)) { if (Objects.isNull(productId)) {
return new Result<>();
return new Result<>().ok(new LotCarbonBaseInfoOnYear());
} }
if (Objects.equals(dataType, 0)) { if (Objects.equals(dataType, 0)) {
LotCarbonBaseInfoOnYear res = iotCarbonProductionResultService.getDetailOfBaseInfoOnYear(productId); LotCarbonBaseInfoOnYear res = iotCarbonProductionResultService.getDetailOfBaseInfoOnYear(productId);

4
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.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.HashMap; import java.util.HashMap;
@ -112,6 +113,9 @@ public class IotCarbonProductionReportController {
@LogOperation("生成报告预览") @LogOperation("生成报告预览")
public Result<IotCarbonProductionReportDTO> generateReport(@RequestBody IotCarbonProductionReportConfigDTO config){ public Result<IotCarbonProductionReportDTO> generateReport(@RequestBody IotCarbonProductionReportConfigDTO config){
IotCarbonProductionReportDTO data = iotCarbonProductionReportService.generateReport(config); IotCarbonProductionReportDTO data = iotCarbonProductionReportService.generateReport(config);
if(ObjectUtils.isEmpty(data)){
return new Result<IotCarbonProductionReportDTO>().ok(data);
}
String reportCode = String reportCode =
iotCarbonProductionReportService.generateReportCode( iotCarbonProductionReportService.generateReportCode(
null, data.getBoundaryStart(), data.getBoundaryEnd()); null, data.getBoundaryStart(), data.getBoundaryEnd());

4
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 lombok.RequiredArgsConstructor;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils; import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Pair;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -102,6 +103,9 @@ public class IotCarbonProductionReportServiceImpl extends BaseServiceImpl<IotCar
@Override @Override
public IotCarbonProductionReportDTO generateReport(IotCarbonProductionReportConfigDTO config) { public IotCarbonProductionReportDTO generateReport(IotCarbonProductionReportConfigDTO config) {
Pair<Long, Long> timePair = getBoundary(config); Pair<Long, Long> timePair = getBoundary(config);
if(ObjectUtils.isEmpty(config.getProductId())){
return null;
}
return resultService.generateReport( return resultService.generateReport(
config.getProductId(), config.getProductId(),
config.getBoundaryType(), config.getBoundaryType(),

89
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<PageData<IotVisualComponentDTO>> page(@Parameter(hidden = true) @RequestParam Map<String, Object> params){
PageData<IotVisualComponentDTO> page = iotVisualComponentService.getPageData(params, IotVisualComponentDTO.class);
return new Result<PageData<IotVisualComponentDTO>>().ok(page);
}
@GetMapping("{id}")
@Operation(summary="信息")
public Result<IotVisualComponentDTO> get(@PathVariable("id") Long id){
IotVisualComponentDTO data = iotVisualComponentService.getByIdAs(id, IotVisualComponentDTO.class);
return new Result<IotVisualComponentDTO>().ok(data);
}
@PostMapping
@Operation(summary="保存")
@LogOperation("保存")
public Result<Void> save(@RequestBody IotVisualComponentDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
iotVisualComponentService.saveDto(dto);
return new Result<>();
}
@PutMapping
@Operation(summary="修改")
@LogOperation("修改")
public Result<Void> update(@RequestBody IotVisualComponentDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
iotVisualComponentService.updateDto(dto);
return new Result<>();
}
@DeleteMapping
@Operation(summary="删除")
@LogOperation("删除")
public Result<Void> delete(@RequestBody Long[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
iotVisualComponentService.batchDelete(ids);
return new Result<>();
}
}

59
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;
}

79
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;
}

16
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<IotVisualComponentEntity> {
}

14
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<IotVisualComponentEntity> {
}

28
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<IotVisualComponentMapper, IotVisualComponentEntity> implements IotVisualComponentService {
@Override
public QueryWrapper getWrapper(Map<String, Object> params){
QueryWrapper wrapper = new QueryWrapper();
return wrapper;
}
}

90
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<PageData<IotVisualGroupDTO>> page(@Parameter(hidden = true) @RequestParam Map<String, Object> params){
PageData<IotVisualGroupDTO> page = iotVisualGroupService.getPageData(params, IotVisualGroupDTO.class);
return new Result<PageData<IotVisualGroupDTO>>().ok(page);
}
@GetMapping("{id}")
@Operation(summary="信息")
public Result<IotVisualGroupDTO> get(@PathVariable("id") Long id){
IotVisualGroupDTO data = iotVisualGroupService.getByIdAs(id, IotVisualGroupDTO.class);
return new Result<IotVisualGroupDTO>().ok(data);
}
@PostMapping
@Operation(summary="保存")
public Result<Void> save(@RequestBody IotVisualGroupDTO dto){
iotVisualGroupService.saveIotVisualGroupDTO(dto);
return new Result<>();
}
@PutMapping
@Operation(summary="修改")
public Result<Void> update(@RequestBody IotVisualGroupDTO dto){
iotVisualGroupService.updateIotVisualGroupDTO(dto);
return new Result<>();
}
@DeleteMapping
@Operation(summary="删除")
public Result<Void> delete(@RequestBody Long[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
iotVisualGroupService.batchDelete(ids);
return new Result<>();
}
@GetMapping("groupSortInfo")
@Operation(summary="获取排序信息,可以传入已存在的组名称")
public Result<GroupSortInfo> groupSortInfo(@RequestParam(required = false) String name){
GroupSortInfo data = iotVisualGroupService.groupSortInfo(name);
return new Result<GroupSortInfo>().ok(data);
}
// @GetMapping("adjustGroupSort")
// @Operation(summary="调整组排序")
// public Result<String> adjustGroupSort(){
// String data = iotVisualGroupService.adjustGroupSort();
// return new Result<String>().ok(data);
// }
}

14
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;
}

55
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;
}

71
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;
}

16
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<IotVisualGroupEntity> {
}

21
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<IotVisualGroupEntity> {
void saveIotVisualGroupDTO(IotVisualGroupDTO dto);
void updateIotVisualGroupDTO(IotVisualGroupDTO dto);
GroupSortInfo groupSortInfo(String name);
}

68
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<IotVisualGroupMapper, IotVisualGroupEntity> implements IotVisualGroupService {
@Override
public QueryWrapper getWrapper(Map<String, Object> 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 ;
}
}

6
modules/visual-design/src/main/resources/IotVisualComponentMapper.xml

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.thing.visual.component.mapper.IotVisualComponentMapper">
</mapper>

7
modules/visual-design/src/main/resources/IotVisualGroupMapper.xml

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.thing.visual.group.mapper.IotVisualGroupMapper">
</mapper>

5
pom.xml

@ -626,6 +626,11 @@
<artifactId>cqc-service</artifactId> <artifactId>cqc-service</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency>
<groupId>com.thing.modules</groupId>
<artifactId>visual-design</artifactId>
<version>${project.version}</version>
</dependency>
<!-- =================================== 内部依赖: tools模块 ======================================= --> <!-- =================================== 内部依赖: tools模块 ======================================= -->
<dependency> <dependency>
<groupId>com.thing.tools</groupId> <groupId>com.thing.tools</groupId>

Loading…
Cancel
Save