工单分页查询

This commit is contained in:
attiya 2025-11-25 17:39:59 +08:00
parent 9ab1fab011
commit 56a7d7955f
2 changed files with 132 additions and 2 deletions

View File

@ -3,7 +3,7 @@ package com.cdzy.operations.controller;
import com.cdzy.common.model.request.PageParam; import com.cdzy.common.model.request.PageParam;
import com.cdzy.common.model.response.JsonResult; import com.cdzy.common.model.response.JsonResult;
import com.cdzy.operations.enums.BikeOrderHandleState; import com.cdzy.operations.enums.BikeOrderHandleState;
import com.cdzy.operations.model.entity.EbikeBikeOrder; import com.cdzy.operations.model.dto.EbikeBikeOrderPageDto;
import com.cdzy.operations.service.EbikeBikeOrderService; import com.cdzy.operations.service.EbikeBikeOrderService;
import com.mybatisflex.core.paginate.Page; import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper; import com.mybatisflex.core.query.QueryWrapper;
@ -17,6 +17,7 @@ import org.springframework.web.bind.annotation.RestController;
import java.util.Objects; import java.util.Objects;
import static com.cdzy.operations.model.entity.table.EbikeBikeInfoTableDef.EBIKE_BIKE_INFO;
import static com.cdzy.operations.model.entity.table.EbikeBikeOrderTableDef.EBIKE_BIKE_ORDER; import static com.cdzy.operations.model.entity.table.EbikeBikeOrderTableDef.EBIKE_BIKE_ORDER;
/** /**
@ -43,10 +44,11 @@ public class EbikeBikeOrderController {
@GetMapping("page") @GetMapping("page")
public JsonResult<?> page(PageParam page, Integer orderType,String bikeCode) { public JsonResult<?> page(PageParam page, Integer orderType,String bikeCode) {
QueryWrapper queryWrapper = QueryWrapper.create() QueryWrapper queryWrapper = QueryWrapper.create()
.select(EBIKE_BIKE_INFO.LOCATION,EBIKE_BIKE_ORDER.ALL_COLUMNS)
.where(EBIKE_BIKE_ORDER.HANDLE_STATE.eq(BikeOrderHandleState.UNPROCESSED)) .where(EBIKE_BIKE_ORDER.HANDLE_STATE.eq(BikeOrderHandleState.UNPROCESSED))
.where(EBIKE_BIKE_ORDER.ORDER_TYPE.eq(orderType, Objects.nonNull(orderType))) .where(EBIKE_BIKE_ORDER.ORDER_TYPE.eq(orderType, Objects.nonNull(orderType)))
.where(EBIKE_BIKE_ORDER.BIKE_CODE.like(bikeCode, StringUtil.hasText(bikeCode))); .where(EBIKE_BIKE_ORDER.BIKE_CODE.like(bikeCode, StringUtil.hasText(bikeCode)));
Page<EbikeBikeOrder> orderPage = ebikeBikeOrderService.page(page.getPage(), queryWrapper); Page<EbikeBikeOrderPageDto> orderPage = ebikeBikeOrderService.pageAs(page.getPage(), queryWrapper, EbikeBikeOrderPageDto.class);
return JsonResult.success(orderPage); return JsonResult.success(orderPage);
} }

View File

@ -0,0 +1,128 @@
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 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-11-24
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class EbikeBikeOrderPageDto implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 工单ID
*/
@Id
private Long orderId;
/**
* 运营商ID
*/
private Long operatorId;
/**
* 车辆编号
*/
private String bikeCode;
/**
* 定位
*/
@Column(typeHandler = PGpointTypeHandler.class)
@JsonSerialize(using = PGpointSerializer.class)
@JsonDeserialize(using = PGpointDeserializer.class)
private PGpoint location;
/**
* 工单编号
*/
private Long orderCode;
/**
* 工单类型1 巡检工单 2 换电工单 3 调度工单 4 维修工单
*/
private Integer orderType;
/**
* 创建时间
*/
@Column(onInsertValue = "now()")
private LocalDateTime createdAt;
/**
* 更新时间
*/
@Column(onUpdateValue = "now()")
private LocalDateTime updatedAt;
/**
* 删除状态
*/
private Boolean isDeleted;
/**
* 删除时间
*/
private LocalDateTime deletedAt;
/**
* 处理人ID
*/
private Long receiverId;
/**
* 处理状态
*/
@Column(onInsertValue = "0")
private Integer handleState;
/**
* 处理时间
*/
private LocalDateTime handleAt;
/**
* 处理结果
*/
private String handleResult;
/**
* 是否有效调度工单
*/
private Boolean isValidDispatch;
/**
* 创建人
*/
private Long createdBy;
/**
* 站点ID
*/
private Long siteId;
}