Commit c31dfcc25f4c984a6c713ab8c1ddb6a67dec17d5
1 parent
eaee4642
feat:物模型列表
Showing
5 changed files
with
62 additions
and
0 deletions
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thingmodel/IotThingModelController.java
| ... | ... | @@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.iot.controller.admin.thingmodel; |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 4 | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | 5 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| 6 | +import cn.iocoder.yudao.module.iot.controller.admin.thingmodel.vo.IotThingModelListReqVO; | |
| 6 | 7 | import cn.iocoder.yudao.module.iot.controller.admin.thingmodel.vo.IotThingModelPageReqVO; |
| 7 | 8 | import cn.iocoder.yudao.module.iot.controller.admin.thingmodel.vo.IotThingModelRespVO; |
| 8 | 9 | import cn.iocoder.yudao.module.iot.controller.admin.thingmodel.vo.IotThingModelSaveReqVO; |
| ... | ... | @@ -73,6 +74,14 @@ public class IotThingModelController { |
| 73 | 74 | return success(IotThingModelConvert.INSTANCE.convertList(list)); |
| 74 | 75 | } |
| 75 | 76 | |
| 77 | + @GetMapping("/list") | |
| 78 | + @Operation(summary = "获得产品物模型列表") | |
| 79 | + @PreAuthorize("@ss.hasPermission('iot:thing-model:query')") | |
| 80 | + public CommonResult<List<IotThingModelRespVO>> getThingModelListByProductId(@Valid IotThingModelListReqVO reqVO) { | |
| 81 | + List<IotThingModelDO> list = thingModelService.getThingModelList(reqVO); | |
| 82 | + return success(IotThingModelConvert.INSTANCE.convertList(list)); | |
| 83 | + } | |
| 84 | + | |
| 76 | 85 | @GetMapping("/page") |
| 77 | 86 | @Operation(summary = "获得产品物模型分页") |
| 78 | 87 | @PreAuthorize("@ss.hasPermission('iot:thing-model:query')") | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thingmodel/vo/IotThingModelListReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.iot.controller.admin.thingmodel.vo; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.validation.InEnum; | |
| 4 | +import cn.iocoder.yudao.module.iot.enums.thingmodel.IotThingModelTypeEnum; | |
| 5 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 6 | +import jakarta.validation.constraints.NotNull; | |
| 7 | +import lombok.Data; | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | +@Schema(description = "管理后台 - IoT 产品物模型List Request VO") | |
| 12 | +@Data | |
| 13 | +public class IotThingModelListReqVO { | |
| 14 | + @Schema(description = "功能标识") | |
| 15 | + private String identifier; | |
| 16 | + | |
| 17 | + @Schema(description = "功能名称", example = "张三") | |
| 18 | + private String name; | |
| 19 | + | |
| 20 | + @Schema(description = "功能类型", example = "1") | |
| 21 | + @InEnum(IotThingModelTypeEnum.class) | |
| 22 | + private Integer type; | |
| 23 | + | |
| 24 | + @Schema(description = "产品ID", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 25 | + @NotNull(message = "产品ID不能为空") | |
| 26 | + private Long productId; | |
| 27 | +} | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/mysql/thingmodel/IotThingModelMapper.java
| ... | ... | @@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.iot.dal.mysql.thingmodel; |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 4 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 5 | 5 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| 6 | +import cn.iocoder.yudao.module.iot.controller.admin.thingmodel.vo.IotThingModelListReqVO; | |
| 6 | 7 | import cn.iocoder.yudao.module.iot.controller.admin.thingmodel.vo.IotThingModelPageReqVO; |
| 7 | 8 | import cn.iocoder.yudao.module.iot.dal.dataobject.thingmodel.IotThingModelDO; |
| 8 | 9 | import org.apache.ibatis.annotations.Mapper; |
| ... | ... | @@ -28,6 +29,17 @@ public interface IotThingModelMapper extends BaseMapperX<IotThingModelDO> { |
| 28 | 29 | .orderByDesc(IotThingModelDO::getId)); |
| 29 | 30 | } |
| 30 | 31 | |
| 32 | + default List<IotThingModelDO> selectList(IotThingModelListReqVO reqVO) { | |
| 33 | + return selectList(new LambdaQueryWrapperX<IotThingModelDO>() | |
| 34 | + .eqIfPresent(IotThingModelDO::getIdentifier, reqVO.getIdentifier()) | |
| 35 | + .likeIfPresent(IotThingModelDO::getName, reqVO.getName()) | |
| 36 | + .eqIfPresent(IotThingModelDO::getType, reqVO.getType()) | |
| 37 | + .eqIfPresent(IotThingModelDO::getProductId, reqVO.getProductId()) | |
| 38 | + // TODO @芋艿:看看要不要加枚举 | |
| 39 | + .notIn(IotThingModelDO::getIdentifier, "get", "set", "post") | |
| 40 | + .orderByDesc(IotThingModelDO::getId)); | |
| 41 | + } | |
| 42 | + | |
| 31 | 43 | default IotThingModelDO selectByProductIdAndIdentifier(Long productId, String identifier) { |
| 32 | 44 | return selectOne(IotThingModelDO::getProductId, productId, |
| 33 | 45 | IotThingModelDO::getIdentifier, identifier); | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/thingmodel/IotThingModelService.java
| 1 | 1 | package cn.iocoder.yudao.module.iot.service.thingmodel; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | +import cn.iocoder.yudao.module.iot.controller.admin.thingmodel.vo.IotThingModelListReqVO; | |
| 4 | 5 | import cn.iocoder.yudao.module.iot.controller.admin.thingmodel.vo.IotThingModelPageReqVO; |
| 5 | 6 | import cn.iocoder.yudao.module.iot.controller.admin.thingmodel.vo.IotThingModelSaveReqVO; |
| 6 | 7 | import cn.iocoder.yudao.module.iot.dal.dataobject.thingmodel.IotThingModelDO; |
| ... | ... | @@ -69,4 +70,11 @@ public interface IotThingModelService { |
| 69 | 70 | */ |
| 70 | 71 | List<IotThingModelDO> getProductThingModelListByProductKey(String productKey); |
| 71 | 72 | |
| 73 | + /** | |
| 74 | + * 获得产品物模型列表 | |
| 75 | + * | |
| 76 | + * @param reqVO 列表查询 | |
| 77 | + * @return 产品物模型列表 | |
| 78 | + */ | |
| 79 | + List<IotThingModelDO> getThingModelList(IotThingModelListReqVO reqVO); | |
| 72 | 80 | } |
| 73 | 81 | \ No newline at end of file | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/thingmodel/IotThingModelServiceImpl.java
| ... | ... | @@ -7,6 +7,7 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| 7 | 7 | import cn.iocoder.yudao.module.iot.controller.admin.thingmodel.model.ThingModelEvent; |
| 8 | 8 | import cn.iocoder.yudao.module.iot.controller.admin.thingmodel.model.ThingModelParam; |
| 9 | 9 | import cn.iocoder.yudao.module.iot.controller.admin.thingmodel.model.ThingModelService; |
| 10 | +import cn.iocoder.yudao.module.iot.controller.admin.thingmodel.vo.IotThingModelListReqVO; | |
| 10 | 11 | import cn.iocoder.yudao.module.iot.controller.admin.thingmodel.vo.IotThingModelPageReqVO; |
| 11 | 12 | import cn.iocoder.yudao.module.iot.controller.admin.thingmodel.vo.IotThingModelSaveReqVO; |
| 12 | 13 | import cn.iocoder.yudao.module.iot.convert.thingmodel.IotThingModelConvert; |
| ... | ... | @@ -134,6 +135,11 @@ public class IotThingModelServiceImpl implements IotThingModelService { |
| 134 | 135 | return thingModelMapper.selectListByProductKey(productKey); |
| 135 | 136 | } |
| 136 | 137 | |
| 138 | + @Override | |
| 139 | + public List<IotThingModelDO> getThingModelList(IotThingModelListReqVO reqVO) { | |
| 140 | + return thingModelMapper.selectList(reqVO); | |
| 141 | + } | |
| 142 | + | |
| 137 | 143 | /** |
| 138 | 144 | * 校验功能是否存在 |
| 139 | 145 | * | ... | ... |