解决门店车辆查询语句的问题
This commit is contained in:
		| @ -28,6 +28,9 @@ public class StoreCarDTO { | ||||
|     @ApiModelProperty("车辆型号名称") | ||||
|     private String modelName; | ||||
|  | ||||
|     @ApiModelProperty("车辆图片,多图片逗号分隔") | ||||
|     private String images; | ||||
|  | ||||
|     @ApiModelProperty("支持电池类型(48V标准版/100km,48V超长版/200km等)") | ||||
|     private String batteryType; | ||||
|  | ||||
|  | ||||
| @ -4,6 +4,8 @@ import io.swagger.annotations.ApiModel; | ||||
| import io.swagger.annotations.ApiModelProperty; | ||||
| import lombok.Data; | ||||
|  | ||||
| import java.util.List; | ||||
|  | ||||
| @Data | ||||
| @ApiModel(value = "门店车辆查询请求") | ||||
| public class StoreCarReq { | ||||
| @ -14,4 +16,7 @@ public class StoreCarReq { | ||||
|     @ApiModelProperty("车牌号码") | ||||
|     private String licensePlate; | ||||
|  | ||||
|     @ApiModelProperty("门店车辆状态") | ||||
|     private List<String> storeCarStatusList; | ||||
|  | ||||
| } | ||||
|  | ||||
| @ -54,7 +54,7 @@ public class CarServiceImpl implements CarService { | ||||
|  | ||||
|     @Override | ||||
|     public Long countCarByStoreId(Long storeId) { | ||||
|         return carRepo.count(new LambdaQueryWrapper<CarPO>().eq(CarPO::getStoreId, storeId)); | ||||
|         return carRepo.count(new LambdaQueryWrapper<CarPO>().eq(CarPO::getStoreId, storeId).eq(CarPO::getDelFlag, "0").eq(CarPO::getStatus, "0")); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|  | ||||
| @ -3,6 +3,10 @@ | ||||
| <mapper namespace="com.sczx.car.mapper.CarMapper"> | ||||
|  | ||||
|     <select id="pageStoreCar" resultType="com.sczx.car.dto.StoreCarDTO"> | ||||
|         select | ||||
|         * | ||||
|         from | ||||
|         ( | ||||
|         select | ||||
|         zc.id, | ||||
|         zc.vin, | ||||
| @ -21,7 +25,13 @@ | ||||
|         and zom.order_status = 'RENT_ING' then 'RENTING' | ||||
|         when zc.brs_status = '0' then 'FREE' | ||||
|         when zc.brs_status = '1' then 'REMOVED' | ||||
|         END ) store_car_status | ||||
|         END ) store_car_status, | ||||
|         zc.brs_status, | ||||
|         zc.images, | ||||
|         zom.order_status, | ||||
|         zom.order_no, | ||||
|         zc.update_time, | ||||
|         zc.store_id | ||||
|         from | ||||
|         zc_car zc | ||||
|         left join ( | ||||
| @ -40,14 +50,22 @@ | ||||
|         where | ||||
|         del_flag = 0 | ||||
|         and status = 0 | ||||
|         and store_id = #{storeCarReq.storeId} | ||||
|         <if test="storeCarReq.licensePlate != null and storeCarReq.licensePlate != ''"> | ||||
|             and license_plate like concat('%', #{storeCarReq.licensePlate}, '%') | ||||
|         </if> | ||||
|         ) )zom | ||||
|         and store_id = #{storeCarReq.storeId}) )zom | ||||
|         on | ||||
|         zc.id = zom.vehicle_id | ||||
|         ) a | ||||
|         where | ||||
|         a.store_id = #{storeCarReq.storeId} | ||||
|         <if test="storeCarReq.storeCarStatusList != null and storeCarReq.storeCarStatusList.size() > 0"> | ||||
|             and a.store_car_status | ||||
|             in <foreach collection="storeCarReq.storeCarStatusList" item="carStatus" open="(" separator="," close=")"> | ||||
|                 #{carStatus} | ||||
|             </foreach> | ||||
|         </if> | ||||
|         <if test="storeCarReq.licensePlate != null and storeCarReq.licensePlate != ''"> | ||||
|             and a.license_plate like concat('%', #{storeCarReq.licensePlate}, '%') | ||||
|         </if> | ||||
|         order by | ||||
|         zc.update_time desc | ||||
|         a.update_time desc | ||||
|     </select> | ||||
| </mapper> | ||||
|  | ||||
		Reference in New Issue
	
	Block a user