运营区车辆列表(仓库外
This commit is contained in:
parent
60c5a12a4b
commit
2e9311f615
@ -2,6 +2,7 @@ package com.cdzy.ebikemaintenance.controller;
|
||||
|
||||
import com.cdzy.common.model.JsonResult;
|
||||
import com.cdzy.common.model.PageParam;
|
||||
import com.cdzy.ebikemaintenance.model.dto.request.ReqReginIdDto;
|
||||
import com.cdzy.ebikemaintenance.model.dto.response.ResEbikeInfoRegionDto;
|
||||
import com.cdzy.ebikemaintenance.model.pojo.EbikeBikeInfo;
|
||||
import com.cdzy.ebikemaintenance.service.EbikeBikeInfoService;
|
||||
@ -10,10 +11,7 @@ import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -58,9 +56,9 @@ public class EbikeOperationController {
|
||||
* 根据运营区id获取运营车辆状态及其位置信息列表
|
||||
* @return 运营车辆列表
|
||||
*/
|
||||
@GetMapping("list")
|
||||
public JsonResult<?> list(@RequestParam("operationRegionId")Long operationRegionId) {
|
||||
List<ResEbikeInfoRegionDto> list = bikeInfoService.getOperationalBikeListWithGpsByRegionId(operationRegionId);
|
||||
@PostMapping("list")
|
||||
public JsonResult<?> list(@RequestBody ReqReginIdDto dto) {
|
||||
List<ResEbikeInfoRegionDto> list = bikeInfoService.getOperationalBikeListWithGpsByRegionId(dto.getOperationRegionIds());
|
||||
return JsonResult.success(list);
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,20 @@
|
||||
package com.cdzy.ebikemaintenance.model.dto.request;
|
||||
|
||||
import com.cdzy.ebikemaintenance.model.pojo.EbikeBatteryInfo;
|
||||
import com.cdzy.ebikemaintenance.model.pojo.EbikeEcuInfo;
|
||||
import com.cdzy.ebikemaintenance.model.pojo.EbikeHelmetInfo;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Data
|
||||
public class ReqReginIdDto {
|
||||
|
||||
|
||||
/**
|
||||
* 运营区id列表
|
||||
*/
|
||||
private List<Long> operationRegionIds;
|
||||
}
|
||||
@ -315,8 +315,8 @@ public interface EbikeBikeInfoService extends IService<EbikeBikeInfo> {
|
||||
|
||||
/**
|
||||
* 根据运营区id获取运营车辆状态及其位置信息列表
|
||||
* @param operationRegionId 运营区id
|
||||
* @param operationRegionIds 运营区id
|
||||
* @return 列表
|
||||
*/
|
||||
List<ResEbikeInfoRegionDto> getOperationalBikeListWithGpsByRegionId(Long operationRegionId);
|
||||
List<ResEbikeInfoRegionDto> getOperationalBikeListWithGpsByRegionId(List<Long> operationRegionIds);
|
||||
}
|
||||
|
||||
@ -1538,13 +1538,16 @@ public class EbikeBikeInfoServiceImpl extends ServiceImpl<EbikeBikeInfoMapper, E
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ResEbikeInfoRegionDto> getOperationalBikeListWithGpsByRegionId(Long operationRegionId) {
|
||||
public List<ResEbikeInfoRegionDto> getOperationalBikeListWithGpsByRegionId(List<Long> operationRegionIds) {
|
||||
if (operationRegionIds == null || operationRegionIds.isEmpty()) {
|
||||
return List.of();
|
||||
}
|
||||
QueryWrapper query = QueryWrapper.create()
|
||||
.select(EBIKE_BIKE_INFO.ALL_COLUMNS,EBIKE_ECU_INFO.ECU_SN)
|
||||
.leftJoin(EBIKE_ECU_INFO).on(EBIKE_BIKE_INFO.ECU_ID.eq(EBIKE_ECU_INFO.ECU_ID))
|
||||
.where(EBIKE_BIKE_INFO.STATE.in(new String[]{"2", "3", "4"}))
|
||||
.where(EBIKE_BIKE_INFO.IS_IN_WAREHOUSE.eq("0"))
|
||||
.where(EBIKE_BIKE_INFO.REGIN_ID.eq(String.valueOf(operationRegionId)));
|
||||
.where(EBIKE_BIKE_INFO.REGIN_ID.in(operationRegionIds));
|
||||
List<ResEbikeInfoRegionDto> list = ebikeBikeInfoMapper.selectListByQueryAs(query, ResEbikeInfoRegionDto.class);
|
||||
if (list == null || list.isEmpty()) {
|
||||
return list;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user