20 changed files with 651 additions and 2 deletions
-
5application/pom.xml
-
2modules/carbon-track/src/main/java/com/thing/carbontrack/productionResult/controller/IotCarbonProductionResultController.java
-
4modules/carbon-track/src/main/java/com/thing/carbontrack/report/controller/IotCarbonProductionReportController.java
-
4modules/carbon-track/src/main/java/com/thing/carbontrack/report/service/impl/IotCarbonProductionReportServiceImpl.java
-
89modules/visual-design/src/main/java/com/thing/visual/component/controller/IotVisualComponentController.java
-
59modules/visual-design/src/main/java/com/thing/visual/component/dto/IotVisualComponentDTO.java
-
79modules/visual-design/src/main/java/com/thing/visual/component/entity/IotVisualComponentEntity.java
-
16modules/visual-design/src/main/java/com/thing/visual/component/mapper/IotVisualComponentMapper.java
-
14modules/visual-design/src/main/java/com/thing/visual/component/service/IotVisualComponentService.java
-
28modules/visual-design/src/main/java/com/thing/visual/component/service/impl/IotVisualComponentServiceImpl.java
-
90modules/visual-design/src/main/java/com/thing/visual/group/controller/IotVisualGroupController.java
-
14modules/visual-design/src/main/java/com/thing/visual/group/dto/GroupSortInfo.java
-
55modules/visual-design/src/main/java/com/thing/visual/group/dto/IotVisualGroupDTO.java
-
71modules/visual-design/src/main/java/com/thing/visual/group/entity/IotVisualGroupEntity.java
-
16modules/visual-design/src/main/java/com/thing/visual/group/mapper/IotVisualGroupMapper.java
-
21modules/visual-design/src/main/java/com/thing/visual/group/service/IotVisualGroupService.java
-
68modules/visual-design/src/main/java/com/thing/visual/group/service/impl/IotVisualGroupServiceImpl.java
-
6modules/visual-design/src/main/resources/IotVisualComponentMapper.xml
-
7modules/visual-design/src/main/resources/IotVisualGroupMapper.xml
-
5pom.xml
@ -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<>(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
@ -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; |
||||
|
|
||||
|
} |
||||
@ -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; |
||||
|
} |
||||
@ -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> { |
||||
|
|
||||
|
} |
||||
@ -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> { |
||||
|
|
||||
|
} |
||||
@ -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; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
@ -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); |
||||
|
// } |
||||
|
} |
||||
@ -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; |
||||
|
|
||||
|
} |
||||
@ -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; |
||||
|
|
||||
|
} |
||||
@ -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; |
||||
|
} |
||||
@ -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> { |
||||
|
|
||||
|
} |
||||
@ -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); |
||||
|
} |
||||
@ -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 ; |
||||
|
} |
||||
|
} |
||||
@ -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> |
||||
@ -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> |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue