增加门店车辆列表查询接口
This commit is contained in:
@ -0,0 +1,22 @@
|
||||
package com.sczx.car.common.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 门店车辆枚举
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum StoreCarStatusEnum {
|
||||
|
||||
RENTING("RENTING", "正在租用"),
|
||||
FREE("FREE", "空闲"),
|
||||
OVERDUE("OVERDUE", "逾期"),
|
||||
REMOVED("REMOVED", "下架"),
|
||||
NON_PACKAGE("NON_PACKAGE", "未应用套餐"),
|
||||
;
|
||||
|
||||
private final String code;
|
||||
private final String name;
|
||||
}
|
||||
@ -1,10 +1,13 @@
|
||||
package com.sczx.car.controller;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.sczx.car.common.Result;
|
||||
import com.sczx.car.dto.CarDTO;
|
||||
import com.sczx.car.dto.CarDamageReq;
|
||||
import com.sczx.car.dto.StoreCarDTO;
|
||||
import com.sczx.car.dto.req.CarQueryConditionReq;
|
||||
import com.sczx.car.dto.req.StoreCarReq;
|
||||
import com.sczx.car.service.CarService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@ -47,4 +50,12 @@ public class CarController {
|
||||
carService.carDamage(req);
|
||||
return Result.ok(true);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "分页查询门店车量列表")
|
||||
@PostMapping("/pageStoreCarModel")
|
||||
Result<IPage<StoreCarDTO>> pageStoreCar(@RequestParam(name = "pageNo", required = false, defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", required = false, defaultValue = "10") Integer pageSize,
|
||||
@RequestBody StoreCarReq storeCarReq){
|
||||
return Result.ok(carService.pageStoreCar(pageNo, pageSize,storeCarReq));
|
||||
}
|
||||
}
|
||||
|
||||
39
src/main/java/com/sczx/car/dto/StoreCarDTO.java
Normal file
39
src/main/java/com/sczx/car/dto/StoreCarDTO.java
Normal file
@ -0,0 +1,39 @@
|
||||
package com.sczx.car.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@ApiModel(value = "门店车辆信息")
|
||||
@Data
|
||||
public class StoreCarDTO {
|
||||
@ApiModelProperty("主键ID")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("车架号(VIN)")
|
||||
private String vin;
|
||||
|
||||
@ApiModelProperty("车牌号码")
|
||||
private String licensePlate;
|
||||
|
||||
@ApiModelProperty("车辆品牌ID")
|
||||
private Long brandId;
|
||||
|
||||
@ApiModelProperty("车辆品牌名称")
|
||||
private String brandName;
|
||||
|
||||
@ApiModelProperty("车辆型号ID")
|
||||
private Long modelId;
|
||||
|
||||
@ApiModelProperty("车辆型号名称")
|
||||
private String modelName;
|
||||
|
||||
@ApiModelProperty("支持电池类型(48V标准版/100km,48V超长版/200km等)")
|
||||
private String batteryType;
|
||||
|
||||
@ApiModelProperty("门店车辆状态")
|
||||
private String storeCarStatus;
|
||||
|
||||
@ApiModelProperty("逾期天数")
|
||||
private Integer overdueDays;
|
||||
}
|
||||
17
src/main/java/com/sczx/car/dto/req/StoreCarReq.java
Normal file
17
src/main/java/com/sczx/car/dto/req/StoreCarReq.java
Normal file
@ -0,0 +1,17 @@
|
||||
package com.sczx.car.dto.req;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "门店车辆查询请求")
|
||||
public class StoreCarReq {
|
||||
|
||||
@ApiModelProperty("门店id")
|
||||
private Long storeId;
|
||||
|
||||
@ApiModelProperty("车牌号码")
|
||||
private String licensePlate;
|
||||
|
||||
}
|
||||
@ -1,7 +1,12 @@
|
||||
package com.sczx.car.mapper;
|
||||
|
||||
import com.sczx.car.po.CarPO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.sczx.car.dto.StoreCarDTO;
|
||||
import com.sczx.car.dto.req.StoreCarReq;
|
||||
import com.sczx.car.po.CarPO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@ -12,5 +17,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
* @since 2025-07-30 17:05:03
|
||||
*/
|
||||
public interface CarMapper extends BaseMapper<CarPO> {
|
||||
|
||||
IPage<StoreCarDTO> pageStoreCar(Page<StoreCarDTO> page, @Param("storeCarReq") StoreCarReq storeCarReq);
|
||||
}
|
||||
|
||||
@ -1,5 +1,8 @@
|
||||
package com.sczx.car.repository;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.sczx.car.dto.StoreCarDTO;
|
||||
import com.sczx.car.dto.req.StoreCarReq;
|
||||
import com.sczx.car.po.CarPO;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
@ -13,4 +16,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
*/
|
||||
public interface CarRepo extends IService<CarPO> {
|
||||
|
||||
IPage<StoreCarDTO> pageStoreCar(Integer pageNo, Integer pageSize, StoreCarReq storeCarReq);
|
||||
}
|
||||
|
||||
@ -1,9 +1,13 @@
|
||||
package com.sczx.car.repository.impl;
|
||||
|
||||
import com.sczx.car.po.CarPO;
|
||||
import com.sczx.car.mapper.CarMapper;
|
||||
import com.sczx.car.repository.CarRepo;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.sczx.car.dto.StoreCarDTO;
|
||||
import com.sczx.car.dto.req.StoreCarReq;
|
||||
import com.sczx.car.mapper.CarMapper;
|
||||
import com.sczx.car.po.CarPO;
|
||||
import com.sczx.car.repository.CarRepo;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
@ -17,4 +21,9 @@ import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class CarRepoImpl extends ServiceImpl<CarMapper, CarPO> implements CarRepo {
|
||||
|
||||
@Override
|
||||
public IPage<StoreCarDTO> pageStoreCar(Integer pageNo, Integer pageSize, StoreCarReq storeCarReq) {
|
||||
Page<StoreCarDTO> page = new Page<>(pageNo, pageSize);
|
||||
return this.getBaseMapper().pageStoreCar(page, storeCarReq);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,8 +1,11 @@
|
||||
package com.sczx.car.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.sczx.car.dto.CarDTO;
|
||||
import com.sczx.car.dto.CarDamageReq;
|
||||
import com.sczx.car.dto.StoreCarDTO;
|
||||
import com.sczx.car.dto.req.CarQueryConditionReq;
|
||||
import com.sczx.car.dto.req.StoreCarReq;
|
||||
|
||||
/**
|
||||
* @Author: 张黎
|
||||
@ -29,4 +32,13 @@ public interface CarService {
|
||||
* @param req
|
||||
*/
|
||||
void carDamage(CarDamageReq req);
|
||||
|
||||
/**
|
||||
* 分页查询门店车辆信息
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param storeCarReq
|
||||
* @return
|
||||
*/
|
||||
IPage<StoreCarDTO> pageStoreCar(Integer pageNo, Integer pageSize,StoreCarReq storeCarReq);
|
||||
}
|
||||
|
||||
@ -1,11 +1,14 @@
|
||||
package com.sczx.car.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.sczx.car.convert.CarConvert;
|
||||
import com.sczx.car.dto.CarDTO;
|
||||
import com.sczx.car.dto.CarDamageReq;
|
||||
import com.sczx.car.dto.SimpleUserInfoDTO;
|
||||
import com.sczx.car.dto.StoreCarDTO;
|
||||
import com.sczx.car.dto.req.CarQueryConditionReq;
|
||||
import com.sczx.car.dto.req.StoreCarReq;
|
||||
import com.sczx.car.exception.BizException;
|
||||
import com.sczx.car.po.CarDamagePO;
|
||||
import com.sczx.car.po.CarPO;
|
||||
@ -69,4 +72,9 @@ public class CarServiceImpl implements CarService {
|
||||
carDamagePO.setSubmitTime(LocalDateTime.now());
|
||||
carDamageRepo.save(carDamagePO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<StoreCarDTO> pageStoreCar(Integer pageNo, Integer pageSize, StoreCarReq storeCarReq) {
|
||||
return carRepo.pageStoreCar(pageNo, pageSize, storeCarReq);
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,7 +29,12 @@ spring:
|
||||
password: Sczx123@
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
hikari:
|
||||
maximum-pool-size: 10
|
||||
maximum-pool-size: 20 # 最大连接数
|
||||
minimum-idle: 5 # 最小空闲连接数
|
||||
connection-timeout: 30000 # 连接超时时间(毫秒)
|
||||
idle-timeout: 600000 # 空闲连接超时时间(毫秒)
|
||||
max-lifetime: 1800000 # 连接最大存活时间(毫秒)
|
||||
leak-detection-threshold: 60000 # 连接泄漏检测阈值(毫秒)
|
||||
auto-commit: true
|
||||
connection_init_sql: SELECT 1
|
||||
redis:
|
||||
|
||||
@ -2,4 +2,52 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.sczx.car.mapper.CarMapper">
|
||||
|
||||
<select id="pageStoreCar" resultType="com.sczx.car.dto.StoreCarDTO">
|
||||
select
|
||||
zc.id,
|
||||
zc.vin,
|
||||
zc.license_plate,
|
||||
zc.brand_name,
|
||||
zc.model_name,
|
||||
zc.battery_type ,
|
||||
ifnull(zom.overdue_days, 0) overdue_days,
|
||||
(case
|
||||
when ifnull(zc.package_id, 0)>0 then 'NON_PACKAGE'
|
||||
when zc.brs_status = '9'
|
||||
and ifnull(zom.overdue_days, 0) > 0
|
||||
and zom.order_status = 'RENT_OVERDUE' then 'OVERDUE'
|
||||
when zc.brs_status = '9'
|
||||
and ifnull(zom.overdue_days, 0) = 0
|
||||
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
|
||||
from
|
||||
zc_car zc
|
||||
left join (
|
||||
select
|
||||
*
|
||||
from
|
||||
zc_order_main
|
||||
where
|
||||
del_flag = 0
|
||||
AND order_status not in ('AUTO_END', 'MANUAL_END')
|
||||
and vehicle_id in (
|
||||
select
|
||||
id
|
||||
from
|
||||
zc_car
|
||||
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
|
||||
on
|
||||
zc.id = zom.vehicle_id
|
||||
order by
|
||||
zc.update_time desc
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user