diff --git a/ebike-operations/src/main/java/com/cdzy/operations/controller/EbikeBikeInfoController.java b/ebike-operations/src/main/java/com/cdzy/operations/controller/EbikeBikeInfoController.java index 98ea931..6954244 100644 --- a/ebike-operations/src/main/java/com/cdzy/operations/controller/EbikeBikeInfoController.java +++ b/ebike-operations/src/main/java/com/cdzy/operations/controller/EbikeBikeInfoController.java @@ -2,7 +2,7 @@ package com.cdzy.operations.controller; import com.cdzy.common.model.request.PageParam; import com.cdzy.common.model.response.JsonResult; -import com.cdzy.operations.model.entity.EbikeBikeInfo; +import com.cdzy.operations.model.dto.EbikeBikeInfoDto; import com.cdzy.operations.model.vo.EbikeBatchLaunchVo; import com.cdzy.operations.model.vo.EbikeBatchUnLaunchVo; import com.cdzy.operations.model.vo.EbikeBikeBindVo; @@ -46,7 +46,7 @@ public class EbikeBikeInfoController { */ @GetMapping("unLaunchPage") public JsonResult unLaunchPage(PageParam pageParam) { - Page page = ebikeBikeInfoService.unLaunchPage(pageParam); + Page page = ebikeBikeInfoService.unLaunchPage(pageParam); return JsonResult.success(page); } @@ -58,7 +58,7 @@ public class EbikeBikeInfoController { */ @GetMapping("launchPage") public JsonResult launchPage(PageParam pageParam) { - Page page = ebikeBikeInfoService.launchPage(pageParam); + Page page = ebikeBikeInfoService.launchPage(pageParam); return JsonResult.success(page); } diff --git a/ebike-operations/src/main/java/com/cdzy/operations/model/dto/EbikeBikeInfoDto.java b/ebike-operations/src/main/java/com/cdzy/operations/model/dto/EbikeBikeInfoDto.java new file mode 100644 index 0000000..31acbea --- /dev/null +++ b/ebike-operations/src/main/java/com/cdzy/operations/model/dto/EbikeBikeInfoDto.java @@ -0,0 +1,133 @@ +package com.cdzy.operations.model.dto; + +import com.cdzy.operations.handler.PGpointDeserializer; +import com.cdzy.operations.handler.PGpointSerializer; +import com.cdzy.operations.handler.PGpointTypeHandler; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.mybatisflex.annotation.Column; +import com.mybatisflex.annotation.Id; +import com.mybatisflex.annotation.Table; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.postgresql.geometric.PGpoint; + +import java.io.Serial; +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * 实体类。 + * + * @author attiya + * @since 2025-10-21 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Table("ebike_bike_info") +public class EbikeBikeInfoDto implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 车辆详情ID + */ + @Id + private Long bikeInfoId; + + /** + * 运营商ID + */ + private Long operatorId; + + /** + * 运营区ID + */ + private Long regionId; + + /** + * 运营区名称 + */ + private String regionName; + + /** + * 车辆编号(与车辆二维码编号相同 + */ + private String bikeCode; + + /** + * 电池ID + */ + private Long batteryId; + + /** + * 中控ID + */ + private Long ecuId; + + /** + * 头盔ID + */ + private Long helmetId; + + /** + * 定位 + */ + @Column(typeHandler = PGpointTypeHandler.class) + @JsonSerialize(using = PGpointSerializer.class) + @JsonDeserialize(using = PGpointDeserializer.class) + private PGpoint location; + + /** + * 备注 + */ + private String remarks; + + /** + * 车辆状态 + */ + private Integer status; + + /** + * 车辆使用状态 + */ + private Integer usageStatus; + + /** + * 创建时间 + */ + @Column(onInsertValue = "now()") + private LocalDateTime createdAt; + + /** + * 创建人 + */ + private Long createdBy; + + /** + * 修改时间 + */ + @Column(onUpdateValue = "now()") + private LocalDateTime updatedAt; + + /** + * 修改人 + */ + private Long updatedBy; + + /** + * 删除与否 + */ + private Boolean isDeleted; + + /** + * 是否包含头盔 + */ + private Boolean hasHelme; + +} diff --git a/ebike-operations/src/main/java/com/cdzy/operations/service/EbikeBikeInfoService.java b/ebike-operations/src/main/java/com/cdzy/operations/service/EbikeBikeInfoService.java index 5f7d77f..fa7b5a4 100644 --- a/ebike-operations/src/main/java/com/cdzy/operations/service/EbikeBikeInfoService.java +++ b/ebike-operations/src/main/java/com/cdzy/operations/service/EbikeBikeInfoService.java @@ -1,6 +1,7 @@ package com.cdzy.operations.service; import com.cdzy.common.model.request.PageParam; +import com.cdzy.operations.model.dto.EbikeBikeInfoDto; import com.cdzy.operations.model.entity.EbikeBikeInfo; import com.cdzy.operations.model.vo.EbikeBatchLaunchVo; import com.cdzy.operations.model.vo.EbikeBatchUnLaunchVo; @@ -37,14 +38,14 @@ public interface EbikeBikeInfoService extends IService { * @param pageParam 分页参数 * @return 结果 */ - Page launchPage(PageParam pageParam); + Page launchPage(PageParam pageParam); /** * 未上架车辆分页查询 * @param pageParam 分页参数 * @return 结果 */ - Page unLaunchPage(PageParam pageParam); + Page unLaunchPage(PageParam pageParam); /** * 批量上架 diff --git a/ebike-operations/src/main/java/com/cdzy/operations/service/impl/EbikeBikeInfoServiceImpl.java b/ebike-operations/src/main/java/com/cdzy/operations/service/impl/EbikeBikeInfoServiceImpl.java index 5c3d3fd..f3746ff 100644 --- a/ebike-operations/src/main/java/com/cdzy/operations/service/impl/EbikeBikeInfoServiceImpl.java +++ b/ebike-operations/src/main/java/com/cdzy/operations/service/impl/EbikeBikeInfoServiceImpl.java @@ -5,6 +5,7 @@ import com.cdzy.common.ex.EbikeException; import com.cdzy.common.model.request.PageParam; import com.cdzy.operations.enums.*; import com.cdzy.operations.mapper.*; +import com.cdzy.operations.model.dto.EbikeBikeInfoDto; import com.cdzy.operations.model.entity.*; import com.cdzy.operations.model.vo.EbikeBatchLaunchVo; import com.cdzy.operations.model.vo.EbikeBatchUnLaunchVo; @@ -31,6 +32,7 @@ import static com.cdzy.operations.model.entity.table.EbikeBatteryInfoTableDef.EB import static com.cdzy.operations.model.entity.table.EbikeBikeInfoTableDef.EBIKE_BIKE_INFO; import static com.cdzy.operations.model.entity.table.EbikeBikeQrTableDef.EBIKE_BIKE_QR; import static com.cdzy.operations.model.entity.table.EbikeEcuInfoTableDef.EBIKE_ECU_INFO; +import static com.cdzy.operations.model.entity.table.EbikeRegionTableDef.EBIKE_REGION; /** * 服务层实现。 @@ -201,21 +203,23 @@ public class EbikeBikeInfoServiceImpl extends ServiceImpl launchPage(PageParam pageParam) { + public Page launchPage(PageParam pageParam) { QueryWrapper query = QueryWrapper.create() - .select(EBIKE_BIKE_INFO.ALL_COLUMNS) + .select(EBIKE_BIKE_INFO.ALL_COLUMNS,EBIKE_REGION.REGION_NAME) .from(EBIKE_BIKE_INFO) + .leftJoin(EBIKE_REGION).on(EBIKE_BIKE_INFO.REGION_ID.eq(EBIKE_REGION.REGION_ID)) .where(EBIKE_BIKE_INFO.STATUS.eq(BikeStatus.LAUNCH)); - return this.mapper.paginate(pageParam.getPage(),query); + return this.mapper.paginateAs(pageParam.getPage(),query, EbikeBikeInfoDto.class); } @Override - public Page unLaunchPage(PageParam pageParam) { + public Page unLaunchPage(PageParam pageParam) { QueryWrapper query = QueryWrapper.create() - .select(EBIKE_BIKE_INFO.ALL_COLUMNS) + .select(EBIKE_BIKE_INFO.ALL_COLUMNS,EBIKE_REGION.REGION_NAME) .from(EBIKE_BIKE_INFO) + .leftJoin(EBIKE_REGION).on(EBIKE_BIKE_INFO.REGION_ID.eq(EBIKE_REGION.REGION_ID)) .where(EBIKE_BIKE_INFO.STATUS.eq(BikeStatus.UN_LAUNCH)); - return this.mapper.paginate(pageParam.getPage(),query); + return this.mapper.paginateAs(pageParam.getPage(),query, EbikeBikeInfoDto.class); } @Override