Commit 43a68560b6d75364cd1a16bdfe04887bd9c9ba84
1 parent
df20c5d5
机械费用增加开始时间和结束时间筛选
Showing
4 changed files
with
8 additions
and
44 deletions
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/mechanicalcost/vo/MechanicalCostPageReqVO.java
| ... | ... | @@ -51,7 +51,7 @@ public class MechanicalCostPageReqVO extends PageParam { |
| 51 | 51 | @Schema(description = "开始使用时间") |
| 52 | 52 | @JsonFormat(pattern = "yyyy-MM-dd", shape = JsonFormat.Shape.STRING) |
| 53 | 53 | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| 54 | - private LocalDate startUseTime; | |
| 54 | + private LocalDate[] startUseTime; | |
| 55 | 55 | |
| 56 | 56 | @Schema(description = "使用年限") |
| 57 | 57 | private Long serviceLife; |
| ... | ... | @@ -59,7 +59,7 @@ public class MechanicalCostPageReqVO extends PageParam { |
| 59 | 59 | @Schema(description = "结束使用时间") |
| 60 | 60 | @JsonFormat(pattern = "yyyy-MM-dd", shape = JsonFormat.Shape.STRING) |
| 61 | 61 | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| 62 | - private LocalDate endUseTime; | |
| 62 | + private LocalDate[] endUseTime; | |
| 63 | 63 | |
| 64 | 64 | @Schema(description = "归属公司", example = "张三") |
| 65 | 65 | private String companyName; |
| ... | ... | @@ -86,22 +86,4 @@ public class MechanicalCostPageReqVO extends PageParam { |
| 86 | 86 | "endUseTime" , MechanicalCostDO::getEndUseTime |
| 87 | 87 | ); |
| 88 | 88 | |
| 89 | - @AssertTrue(message = "结束时间不能小于开始时间") | |
| 90 | - @Schema(hidden = true) | |
| 91 | - public boolean isStartTimeNotAfterEndTime() { | |
| 92 | - // 1. 两个时间都为空:校验通过(分页查询条件可选) | |
| 93 | - if (startUseTime == null && endUseTime == null) { | |
| 94 | - return true; | |
| 95 | - } | |
| 96 | - // 2. 仅开始时间为空:校验通过(可根据业务调整为false强制要求) | |
| 97 | - if (startUseTime == null) { | |
| 98 | - return true; | |
| 99 | - } | |
| 100 | - // 3. 仅结束时间为空:校验通过(分页查询条件可选) | |
| 101 | - if (endUseTime == null) { | |
| 102 | - return true; | |
| 103 | - } | |
| 104 | - // 4. 两个时间都不为空:核心判断 - 开始时间 <= 结束时间 | |
| 105 | - return !startUseTime.isAfter(endUseTime); | |
| 106 | - } | |
| 107 | 89 | } | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/rentalmechanicalcost/vo/RentalMechanicalCostPageReqVO.java
| ... | ... | @@ -29,7 +29,7 @@ public class RentalMechanicalCostPageReqVO extends PageParam { |
| 29 | 29 | @Schema(description = "开始使用时间") |
| 30 | 30 | @JsonFormat(pattern = "yyyy-MM-dd", shape = JsonFormat.Shape.STRING) |
| 31 | 31 | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| 32 | - private LocalDate startUseTime; | |
| 32 | + private LocalDate[] startUseTime; | |
| 33 | 33 | |
| 34 | 34 | @Schema(description = "使用时长(天)") |
| 35 | 35 | private Integer useDuration; |
| ... | ... | @@ -37,7 +37,7 @@ public class RentalMechanicalCostPageReqVO extends PageParam { |
| 37 | 37 | @Schema(description = "结束日期") |
| 38 | 38 | @JsonFormat(pattern = "yyyy-MM-dd", shape = JsonFormat.Shape.STRING) |
| 39 | 39 | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| 40 | - private LocalDate endUseTime; | |
| 40 | + private LocalDate[] endUseTime; | |
| 41 | 41 | |
| 42 | 42 | @Schema(description = "数量") |
| 43 | 43 | private Integer quantity; |
| ... | ... | @@ -54,22 +54,4 @@ public class RentalMechanicalCostPageReqVO extends PageParam { |
| 54 | 54 | "endUseTime", RentalMechanicalCostDO::getEndUseTime |
| 55 | 55 | ); |
| 56 | 56 | |
| 57 | - @AssertTrue(message = "结束时间不能小于开始时间") | |
| 58 | - @Schema(hidden = true) | |
| 59 | - public boolean isStartTimeNotAfterEndTime() { | |
| 60 | - // 1. 两个时间都为空:校验通过(分页查询条件可选) | |
| 61 | - if (startUseTime == null && endUseTime == null) { | |
| 62 | - return true; | |
| 63 | - } | |
| 64 | - // 2. 仅开始时间为空:校验通过(可根据业务调整为false强制要求) | |
| 65 | - if (startUseTime == null) { | |
| 66 | - return true; | |
| 67 | - } | |
| 68 | - // 3. 仅结束时间为空:校验通过(分页查询条件可选) | |
| 69 | - if (endUseTime == null) { | |
| 70 | - return true; | |
| 71 | - } | |
| 72 | - // 4. 两个时间都不为空:核心判断 - 开始时间 <= 结束时间 | |
| 73 | - return !startUseTime.isAfter(endUseTime); | |
| 74 | - } | |
| 75 | 57 | } | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/mysql/mechanicalcost/MechanicalCostMapper.java
| ... | ... | @@ -29,9 +29,9 @@ public interface MechanicalCostMapper extends BaseMapperX<MechanicalCostDO> { |
| 29 | 29 | .eqIfPresent(MechanicalCostDO::getLicensePlate, reqVO.getLicensePlate()) |
| 30 | 30 | .eqIfPresent(MechanicalCostDO::getVehicleCategory, reqVO.getVehicleCategory()) |
| 31 | 31 | .eqIfPresent(MechanicalCostDO::getVehicleType, reqVO.getVehicleType()) |
| 32 | - .geIfPresent(MechanicalCostDO::getStartUseTime, reqVO.getStartUseTime()) | |
| 32 | + .betweenIfPresent(MechanicalCostDO::getStartUseTime, reqVO.getStartUseTime()) | |
| 33 | 33 | .eqIfPresent(MechanicalCostDO::getServiceLife, reqVO.getServiceLife()) |
| 34 | - .leIfPresent(MechanicalCostDO::getEndUseTime, reqVO.getEndUseTime()) | |
| 34 | + .betweenIfPresent(MechanicalCostDO::getEndUseTime, reqVO.getEndUseTime()) | |
| 35 | 35 | .likeIfPresent(MechanicalCostDO::getCompanyName, reqVO.getCompanyName()) |
| 36 | 36 | .eqIfPresent(MechanicalCostDO::getCompanyId, reqVO.getCompanyId()) |
| 37 | 37 | .eqIfPresent(MechanicalCostDO::getDeptId, reqVO.getDeptId()) | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/mysql/rentalmechanicalcost/RentalMechanicalCostMapper.java
| ... | ... | @@ -28,9 +28,9 @@ public interface RentalMechanicalCostMapper extends BaseMapperX<RentalMechanical |
| 28 | 28 | //.eqIfPresent(RentalMechanicalCostDO::getVehicleCategory, reqVO.getVehicleCategory()) |
| 29 | 29 | // .eqIfPresent(RentalMechanicalCostDO::getVehicleType, reqVO.getVehicleType()) |
| 30 | 30 | //.betweenIfPresent(RentalMechanicalCostDO::getStartUseTime, reqVO.getStartUseTime()) |
| 31 | - .geIfPresent(RentalMechanicalCostDO::getStartUseTime, reqVO.getStartUseTime()) | |
| 31 | + .betweenIfPresent(RentalMechanicalCostDO::getStartUseTime, reqVO.getStartUseTime()) | |
| 32 | 32 | .eqIfPresent(RentalMechanicalCostDO::getUseDuration, reqVO.getUseDuration()) |
| 33 | - .leIfPresent(RentalMechanicalCostDO::getEndUseTime, reqVO.getEndUseTime()) | |
| 33 | + .betweenIfPresent(RentalMechanicalCostDO::getEndUseTime, reqVO.getEndUseTime()) | |
| 34 | 34 | //.likeIfPresent(RentalMechanicalCostDO::getCompanyName, reqVO.getCompanyName()) |
| 35 | 35 | .eqIfPresent(RentalMechanicalCostDO::getCompanyId, reqVO.getCompanyId()) |
| 36 | 36 | //.eqIfPresent(RentalMechanicalCostDO::getDeptId, reqVO.getDeptId()) | ... | ... |