🐛 司机与车辆导出支持「未分配组织」筛选

This commit is contained in:
2026-10-25 20:20:59 +08:00
parent 5bcb908cbd
commit c03a5fdf47
5 changed files with 28 additions and 8 deletions
@@ -61,6 +61,14 @@ public final class TransportBusiConstant {
/** 审批状态:已作废(终态)。 */ /** 审批状态:已作废(终态)。 */
public static final String VOIDED = "voided"; public static final String VOIDED = "voided";
/**
* 「未分配组织」筛选项的哨兵值,不是真实组织名。
* <p>
* 前端 organization-search 混入、DriverMapper.xml 与 TransportVehicleMapper.xml 的
* organizationName 分支、以及两个导出查询都按这个字面量判定,四处必须同步修改。
*/
public static final String UNASSIGNED_ORG_FILTER = "__UNASSIGNED_ORG__";
private TransportBusiConstant() { private TransportBusiConstant() {
} }
} }
@@ -43,6 +43,7 @@ import org.springblade.core.secure.annotation.PreAuth;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springblade.transport.constant.TransportBusiConstant;
import org.springblade.transport.excel.DriverExcel; import org.springblade.transport.excel.DriverExcel;
import org.springblade.transport.pojo.entity.Driver; import org.springblade.transport.pojo.entity.Driver;
import org.springblade.transport.pojo.vo.DriverExpiryStatVO; import org.springblade.transport.pojo.vo.DriverExpiryStatVO;
@@ -233,7 +234,11 @@ public class DriverController extends BladeController {
if (Func.isNotEmpty(driver.getDriverType())) { if (Func.isNotEmpty(driver.getDriverType())) {
queryWrapper.eq(Driver::getDriverType, driver.getDriverType()); queryWrapper.eq(Driver::getDriverType, driver.getDriverType());
} }
if (Func.isNotEmpty(driver.getOrganizationName())) { // 「未分配组织」哨兵改判组织为空串:组织列 NOT NULL,无组织存空串。
// 哨兵字面量由 TransportBusiConstant.UNASSIGNED_ORG_FILTER 定义,前端与两个 Mapper XML 同步。
if (TransportBusiConstant.UNASSIGNED_ORG_FILTER.equals(driver.getOrganizationName())) {
queryWrapper.eq(Driver::getOrganizationName, "");
} else if (Func.isNotEmpty(driver.getOrganizationName())) {
queryWrapper.like(Driver::getOrganizationName, driver.getOrganizationName()); queryWrapper.like(Driver::getOrganizationName, driver.getOrganizationName());
} }
if (Func.isNotEmpty(driver.getStatus())) { if (Func.isNotEmpty(driver.getStatus())) {
@@ -44,6 +44,7 @@ import org.springblade.core.secure.annotation.PreAuth;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springblade.transport.constant.TransportBusiConstant;
import org.springblade.transport.excel.TransportVehicleExcel; import org.springblade.transport.excel.TransportVehicleExcel;
import org.springblade.transport.pojo.entity.TransportVehicle; import org.springblade.transport.pojo.entity.TransportVehicle;
import org.springblade.transport.pojo.vo.TransportVehicleExpiryStatVO; import org.springblade.transport.pojo.vo.TransportVehicleExpiryStatVO;
@@ -226,7 +227,11 @@ public class TransportVehicleController extends BladeController {
if (Func.isNotEmpty(ids)) { if (Func.isNotEmpty(ids)) {
queryWrapper.in(TransportVehicle::getId, Func.toLongList(ids)); queryWrapper.in(TransportVehicle::getId, Func.toLongList(ids));
} }
if (Func.isNotEmpty(vehicle.getOrganizationName())) { // 「未分配组织」哨兵改判组织为空串:组织列 NOT NULL,无组织存空串。
// 哨兵字面量由 TransportBusiConstant.UNASSIGNED_ORG_FILTER 定义,前端与两个 Mapper XML 同步。
if (TransportBusiConstant.UNASSIGNED_ORG_FILTER.equals(vehicle.getOrganizationName())) {
queryWrapper.eq(TransportVehicle::getOrganizationName, "");
} else if (Func.isNotEmpty(vehicle.getOrganizationName())) {
queryWrapper.like(TransportVehicle::getOrganizationName, vehicle.getOrganizationName()); queryWrapper.like(TransportVehicle::getOrganizationName, vehicle.getOrganizationName());
} }
if (Func.isNotEmpty(vehicle.getPlateNo())) { if (Func.isNotEmpty(vehicle.getPlateNo())) {
@@ -170,11 +170,12 @@
AND driver_type = #{driver.driverType} AND driver_type = #{driver.driverType}
</if> </if>
<if test="driver.organizationName != null and driver.organizationName != ''"> <if test="driver.organizationName != null and driver.organizationName != ''">
<!-- 哨兵值来自前端 tms-erp-web/src/mixins/organization-search.js 的 UNASSIGNED_ORG_FILTER; <!-- 「未分配组织」哨兵值定义在 TransportBusiConstant.UNASSIGNED_ORG_FILTER 与前端
改这里必须同步该常量与 TransportVehicleMapper.xml 的同名分支 --> tms-erp-web/src/mixins/organization-search.js,改这里必须同步常量与 TransportVehicleMapper.xml 的同名分支。
组织列 NOT NULL,无组织存空串。 -->
<choose> <choose>
<when test="'__UNASSIGNED_ORG__'.equals(driver.organizationName)"> <when test="'__UNASSIGNED_ORG__'.equals(driver.organizationName)">
AND (organization_name IS NULL OR organization_name = '') AND organization_name = ''
</when> </when>
<otherwise> <otherwise>
<bind name="organizationNameLike" value="'%' + driver.organizationName + '%'"/> <bind name="organizationNameLike" value="'%' + driver.organizationName + '%'"/>
@@ -117,11 +117,12 @@
<sql id="QueryCondition"> <sql id="QueryCondition">
is_deleted = 0 is_deleted = 0
<if test="vehicle.organizationName != null and vehicle.organizationName != ''"> <if test="vehicle.organizationName != null and vehicle.organizationName != ''">
<!-- 哨兵值来自前端 tms-erp-web/src/mixins/organization-search.js 的 UNASSIGNED_ORG_FILTER; <!-- 「未分配组织」哨兵值定义在 TransportBusiConstant.UNASSIGNED_ORG_FILTER 与前端
改这里必须同步该常量与 DriverMapper.xml 的同名分支 --> tms-erp-web/src/mixins/organization-search.js,改这里必须同步常量与 DriverMapper.xml 的同名分支。
组织列 NOT NULL,无组织存空串。 -->
<choose> <choose>
<when test="'__UNASSIGNED_ORG__'.equals(vehicle.organizationName)"> <when test="'__UNASSIGNED_ORG__'.equals(vehicle.organizationName)">
AND (organization_name IS NULL OR organization_name = '') AND organization_name = ''
</when> </when>
<otherwise> <otherwise>
<bind name="organizationNameLike" value="'%' + vehicle.organizationName + '%'"/> <bind name="organizationNameLike" value="'%' + vehicle.organizationName + '%'"/>