技术数据仓库查询修改

This commit is contained in:
秦鸿展
2026-02-07 13:52:49 +08:00
parent fe1aadd8ac
commit 52a34779ec
4 changed files with 153 additions and 117 deletions
@@ -31,59 +31,69 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectStorageSectionPo">
select storage_section_id, organization_id, organization_name, top_organization_id, warehouse_id, warehouse_code, warehouse_name, storage_code, storage_name, storage_type, storage_type_name, storage_region, remark, opening_up, nullify, create_time, create_by, create_by_name, update_time, update_by, update_by_name, del_flag from storage_section
select a.storage_section_id, a.organization_id, a.organization_name, a.top_organization_id, a.warehouse_id,
COALESCE(w.warehouse_code, a.warehouse_code) as warehouse_code,
COALESCE(w.warehouse_name, a.warehouse_name) as warehouse_name,
a.storage_code, a.storage_name, a.storage_type, a.storage_type_name, a.storage_region, a.remark, a.opening_up, a.nullify,
a.create_time, a.create_by, a.create_by_name, a.update_time, a.update_by, a.update_by_name, a.del_flag
from storage_section a
LEFT JOIN warehouse w ON a.warehouse_id = w.warehouse_id AND w.del_flag = 1
</sql>
<sql id="selectStorageSectionPo1">
<where>
<if test="organizationId != null ">
and organization_id = #{organizationId}
and a.organization_id = #{organizationId}
</if>
<if test="organizationName != null and organizationName != ''">
and organization_name like concat('%', #{organizationName}, '%')
and a.organization_name like concat('%', #{organizationName}, '%')
</if>
<if test="topOrganizationId != null ">
and top_organization_id = #{topOrganizationId}
and a.top_organization_id = #{topOrganizationId}
</if>
<if test="warehouseId != null ">
and warehouse_id = #{warehouseId}
and a.warehouse_id = #{warehouseId}
</if>
<if test="warehouseCode != null and warehouseCode != ''">
and warehouse_code = #{warehouseCode}
and (w.warehouse_code like concat('%', #{warehouseCode}, '%') or a.warehouse_code like concat('%', #{warehouseCode}, '%'))
</if>
<if test="warehouseName != null and warehouseName != ''">
and warehouse_name like concat('%', #{warehouseName}, '%')
and (w.warehouse_name like concat('%', #{warehouseName}, '%') or a.warehouse_name like concat('%', #{warehouseName}, '%'))
</if>
<if test="storageCode != null and storageCode != ''">
and storage_code = #{storageCode}
and a.storage_code = #{storageCode}
</if>
<if test="storageName != null and storageName != ''">
and storage_name like concat('%', #{storageName}, '%')
and a.storage_name like concat('%', #{storageName}, '%')
</if>
<if test="storageType != null and storageType != ''">
and storage_type = #{storageType}
and a.storage_type = #{storageType}
</if>
<if test="storageTypeName != null and storageTypeName != ''">
and storage_type_name like concat('%', #{storageTypeName}, '%')
and a.storage_type_name like concat('%', #{storageTypeName}, '%')
</if>
<if test="storageRegion != null ">
and storage_region = #{storageRegion}
and a.storage_region = #{storageRegion}
</if>
<if test="openingUp != null ">
and opening_up = #{openingUp}
and a.opening_up = #{openingUp}
</if>
<if test="nullify != null ">
and nullify = #{nullify}
and a.nullify = #{nullify}
</if>
<if test="createByName != null and createByName != ''">
and create_by_name like concat('%', #{createByName}, '%')
and a.create_by_name like concat('%', #{createByName}, '%')
</if>
<if test="updateByName != null and updateByName != ''">
and update_by_name like concat('%', #{updateByName}, '%')
and a.update_by_name like concat('%', #{updateByName}, '%')
</if>
<if test="remark != null and remark != ''">
and remark like concat('%',#{remark},'%')
and a.remark like concat('%',#{remark},'%')
</if>
<choose>
<when test="delFlag != null"> and a.del_flag = #{delFlag} </when>
<otherwise> and a.del_flag = 1 </otherwise>
</choose>
</where>
</sql>