zn-cloud-wcs/src/main/resources/mapper/WareHouseLocationDao.xml
2025-01-08 10:46:50 +08:00

426 lines
21 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace=".dao.WareHouseLocationDao">
<resultMap id="BaseResultMap" type=".entity.WareHouseLocation">
<!--@Table ware_house_location-->
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="laneId" column="lane_id" jdbcType="INTEGER"/>
<result property="laneName" column="lane_name" jdbcType="VARCHAR"/>
<result property="areaId" column="area_id" jdbcType="INTEGER"/>
<result property="areaName" column="area_name" jdbcType="VARCHAR"/>
<result property="locationNo" column="location_no" jdbcType="VARCHAR"/>
<result property="locationYaw" column="location_yaw" jdbcType="VARCHAR"/>
<result property="groupName" column="group_name" jdbcType="VARCHAR"/>
<result property="skuInfo" column="sku_info" jdbcType="VARCHAR"/>
<result property="skuBatch" column="sku_batch" jdbcType="VARCHAR"/>
<result property="skuNumber" column="sku_number" jdbcType="INTEGER"/>
<result property="trayInfo" column="tray_info" jdbcType="VARCHAR"/>
<result property="locationEnable" column="location_enable" jdbcType="INTEGER"/>
<result property="locationLock" column="location_lock" jdbcType="INTEGER"/>
<result property="locationUseStatus" column="location_use_status" jdbcType="INTEGER"/>
<result property="locationX" column="location_x" jdbcType="VARCHAR"/>
<result property="locationY" column="location_y" jdbcType="VARCHAR"/>
<result property="locationWide" column="location_wide" jdbcType="NUMERIC"/>
<result property="locationDeep" column="location_deep" jdbcType="NUMERIC"/>
<result property="locationHeight" column="location_height" jdbcType="NUMERIC"/>
<result property="locationDefaultHeight" column="location_default_height" jdbcType="NUMERIC"/>
<result property="locationTotalHeight" column="location_total_height" jdbcType="NUMERIC"/>
<result property="locationTrayHeight" column="location_tray_height" jdbcType="NUMERIC"/>
<result property="locationStorey" column="location_storey" jdbcType="INTEGER"/>
<result property="locationType" column="location_type" jdbcType="INTEGER"/>
<result property="locationNumber" column="location_number" jdbcType="INTEGER"/>
<result property="creator" column="creator" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updater" column="updater" jdbcType="VARCHAR"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
<result property="deleted" column="deleted" jdbcType="INTEGER"/>
<result property="tenantId" column="tenant_id" jdbcType="INTEGER"/>
</resultMap>
<!--查询单个-->
<select id="queryById" resultMap="BaseResultMap">
select
id, lane_id, lane_name, area_id, area_name, location_no, location_yaw, group_name, sku_info, sku_batch, sku_number, tray_info, location_enable, location_lock, location_use_status, location_x, location_y, location_wide, location_deep, location_height, location_default_height, location_total_height, location_tray_height, location_storey, location_type, location_number, creator, create_time, updater, update_time, deleted, tenant_id
from ware_house_location
where id = #{id}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="BaseResultMap">
select
id, lane_id, lane_name, area_id, area_name, location_no, location_yaw, group_name, sku_info, sku_batch, sku_number, tray_info, location_enable, location_lock, location_use_status, location_x, location_y, location_wide, location_deep, location_height, location_default_height, location_total_height, location_tray_height, location_storey, location_type, location_number, creator, create_time, updater, update_time, deleted, tenant_id
from ware_house_location
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="laneId != null">
and lane_id = #{laneId}
</if>
<if test="laneName != null and laneName != ''">
and lane_name = #{laneName}
</if>
<if test="areaId != null">
and area_id = #{areaId}
</if>
<if test="areaName != null and areaName != ''">
and area_name = #{areaName}
</if>
<if test="locationNo != null and locationNo != ''">
and location_no = #{locationNo}
</if>
<if test="locationYaw != null and locationYaw != ''">
and location_yaw = #{locationYaw}
</if>
<if test="groupName != null and groupName != ''">
and group_name = #{groupName}
</if>
<if test="skuInfo != null and skuInfo != ''">
and sku_info = #{skuInfo}
</if>
<if test="skuBatch != null and skuBatch != ''">
and sku_batch = #{skuBatch}
</if>
<if test="skuNumber != null">
and sku_number = #{skuNumber}
</if>
<if test="trayInfo != null and trayInfo != ''">
and tray_info = #{trayInfo}
</if>
<if test="locationEnable != null">
and location_enable = #{locationEnable}
</if>
<if test="locationLock != null">
and location_lock = #{locationLock}
</if>
<if test="locationUseStatus != null">
and location_use_status = #{locationUseStatus}
</if>
<if test="locationX != null and locationX != ''">
and location_x = #{locationX}
</if>
<if test="locationY != null and locationY != ''">
and location_y = #{locationY}
</if>
<if test="locationWide != null">
and location_wide = #{locationWide}
</if>
<if test="locationDeep != null">
and location_deep = #{locationDeep}
</if>
<if test="locationHeight != null">
and location_height = #{locationHeight}
</if>
<if test="locationDefaultHeight != null">
and location_default_height = #{locationDefaultHeight}
</if>
<if test="locationTotalHeight != null">
and location_total_height = #{locationTotalHeight}
</if>
<if test="locationTrayHeight != null">
and location_tray_height = #{locationTrayHeight}
</if>
<if test="locationStorey != null">
and location_storey = #{locationStorey}
</if>
<if test="locationType != null">
and location_type = #{locationType}
</if>
<if test="locationNumber != null">
and location_number = #{locationNumber}
</if>
<if test="creator != null and creator != ''">
and creator = #{creator}
</if>
<if test="createTime != null">
and create_time = #{createTime}
</if>
<if test="updater != null and updater != ''">
and updater = #{updater}
</if>
<if test="updateTime != null">
and update_time = #{updateTime}
</if>
<if test="deleted != null">
and deleted = #{deleted}
</if>
<if test="tenantId != null">
and tenant_id = #{tenantId}
</if>
</where>
limit #{pageable.offset}, #{pageable.pageSize}
</select>
<!--通过实体作为筛选条件查询-->
<select id="queryAll" resultMap="BaseResultMap">
select
id, lane_id, lane_name, area_id, area_name, location_no, location_yaw, group_name, sku_info, sku_batch, sku_number, tray_info, location_enable, location_lock, location_use_status, location_x, location_y, location_wide, location_deep, location_height, location_default_height, location_total_height, location_tray_height, location_storey, location_type, location_number, creator, create_time, updater, update_time, deleted, tenant_id
from zn_wcs.ware_house_location
<!--统计总行数-->
<select id="count" resultType="java.lang.Long">
select count(1)
from ware_house_location
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="laneId != null">
and lane_id = #{laneId}
</if>
<if test="laneName != null and laneName != ''">
and lane_name = #{laneName}
</if>
<if test="areaId != null">
and area_id = #{areaId}
</if>
<if test="areaName != null and areaName != ''">
and area_name = #{areaName}
</if>
<if test="locationNo != null and locationNo != ''">
and location_no = #{locationNo}
</if>
<if test="locationYaw != null and locationYaw != ''">
and location_yaw = #{locationYaw}
</if>
<if test="groupName != null and groupName != ''">
and group_name = #{groupName}
</if>
<if test="skuInfo != null and skuInfo != ''">
and sku_info = #{skuInfo}
</if>
<if test="skuBatch != null and skuBatch != ''">
and sku_batch = #{skuBatch}
</if>
<if test="skuNumber != null">
and sku_number = #{skuNumber}
</if>
<if test="trayInfo != null and trayInfo != ''">
and tray_info = #{trayInfo}
</if>
<if test="locationEnable != null">
and location_enable = #{locationEnable}
</if>
<if test="locationLock != null">
and location_lock = #{locationLock}
</if>
<if test="locationUseStatus != null">
and location_use_status = #{locationUseStatus}
</if>
<if test="locationX != null and locationX != ''">
and location_x = #{locationX}
</if>
<if test="locationY != null and locationY != ''">
and location_y = #{locationY}
</if>
<if test="locationWide != null">
and location_wide = #{locationWide}
</if>
<if test="locationDeep != null">
and location_deep = #{locationDeep}
</if>
<if test="locationHeight != null">
and location_height = #{locationHeight}
</if>
<if test="locationDefaultHeight != null">
and location_default_height = #{locationDefaultHeight}
</if>
<if test="locationTotalHeight != null">
and location_total_height = #{locationTotalHeight}
</if>
<if test="locationTrayHeight != null">
and location_tray_height = #{locationTrayHeight}
</if>
<if test="locationStorey != null">
and location_storey = #{locationStorey}
</if>
<if test="locationType != null">
and location_type = #{locationType}
</if>
<if test="locationNumber != null">
and location_number = #{locationNumber}
</if>
<if test="creator != null and creator != ''">
and creator = #{creator}
</if>
<if test="createTime != null">
and create_time = #{createTime}
</if>
<if test="updater != null and updater != ''">
and updater = #{updater}
</if>
<if test="updateTime != null">
and update_time = #{updateTime}
</if>
<if test="deleted != null">
and deleted = #{deleted}
</if>
<if test="tenantId != null">
and tenant_id = #{tenantId}
</if>
</where>
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into ware_house_location(lane_id, lane_name, area_id, area_name, location_no, location_yaw, group_name, sku_info, sku_batch, sku_number, tray_info, location_enable, location_lock, location_use_status, location_x, location_y, location_wide, location_deep, location_height, location_default_height, location_total_height, location_tray_height, location_storey, location_type, location_number, creator, create_time, updater, update_time, deleted, tenant_id)
values (#{laneId}, #{laneName}, #{areaId}, #{areaName}, #{locationNo}, #{locationYaw}, #{groupName}, #{skuInfo}, #{skuBatch}, #{skuNumber}, #{trayInfo}, #{locationEnable}, #{locationLock}, #{locationUseStatus}, #{locationX}, #{locationY}, #{locationWide}, #{locationDeep}, #{locationHeight}, #{locationDefaultHeight}, #{locationTotalHeight}, #{locationTrayHeight}, #{locationStorey}, #{locationType}, #{locationNumber}, #{creator}, #{createTime}, #{updater}, #{updateTime}, #{deleted}, #{tenantId})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into ware_house_location(lane_id, lane_name, area_id, area_name, location_no, location_yaw, group_name, sku_info, sku_batch, sku_number, tray_info, location_enable, location_lock, location_use_status, location_x, location_y, location_wide, location_deep, location_height, location_default_height, location_total_height, location_tray_height, location_storey, location_type, location_number, creator, create_time, updater, update_time, deleted, tenant_id)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.laneId}, #{entity.laneName}, #{entity.areaId}, #{entity.areaName}, #{entity.locationNo}, #{entity.locationYaw}, #{entity.groupName}, #{entity.skuInfo}, #{entity.skuBatch}, #{entity.skuNumber}, #{entity.trayInfo}, #{entity.locationEnable}, #{entity.locationLock}, #{entity.locationUseStatus}, #{entity.locationX}, #{entity.locationY}, #{entity.locationWide}, #{entity.locationDeep}, #{entity.locationHeight}, #{entity.locationDefaultHeight}, #{entity.locationTotalHeight}, #{entity.locationTrayHeight}, #{entity.locationStorey}, #{entity.locationType}, #{entity.locationNumber}, #{entity.creator}, #{entity.createTime}, #{entity.updater}, #{entity.updateTime}, #{entity.deleted}, #{entity.tenantId})
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into ware_house_location(lane_id, lane_name, area_id, area_name, location_no, location_yaw, group_name, sku_info, sku_batch, sku_number, tray_info, location_enable, location_lock, location_use_status, location_x, location_y, location_wide, location_deep, location_height, location_default_height, location_total_height, location_tray_height, location_storey, location_type, location_number, creator, create_time, updater, update_time, deleted, tenant_id)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.laneId}, #{entity.laneName}, #{entity.areaId}, #{entity.areaName}, #{entity.locationNo}, #{entity.locationYaw}, #{entity.groupName}, #{entity.skuInfo}, #{entity.skuBatch}, #{entity.skuNumber}, #{entity.trayInfo}, #{entity.locationEnable}, #{entity.locationLock}, #{entity.locationUseStatus}, #{entity.locationX}, #{entity.locationY}, #{entity.locationWide}, #{entity.locationDeep}, #{entity.locationHeight}, #{entity.locationDefaultHeight}, #{entity.locationTotalHeight}, #{entity.locationTrayHeight}, #{entity.locationStorey}, #{entity.locationType}, #{entity.locationNumber}, #{entity.creator}, #{entity.createTime}, #{entity.updater}, #{entity.updateTime}, #{entity.deleted}, #{entity.tenantId})
</foreach>
on duplicate key update
lane_id = values(lane_id),
lane_name = values(lane_name),
area_id = values(area_id),
area_name = values(area_name),
location_no = values(location_no),
location_yaw = values(location_yaw),
group_name = values(group_name),
sku_info = values(sku_info),
sku_batch = values(sku_batch),
sku_number = values(sku_number),
tray_info = values(tray_info),
location_enable = values(location_enable),
location_lock = values(location_lock),
location_use_status = values(location_use_status),
location_x = values(location_x),
location_y = values(location_y),
location_wide = values(location_wide),
location_deep = values(location_deep),
location_height = values(location_height),
location_default_height = values(location_default_height),
location_total_height = values(location_total_height),
location_tray_height = values(location_tray_height),
location_storey = values(location_storey),
location_type = values(location_type),
location_number = values(location_number),
creator = values(creator),
create_time = values(create_time),
updater = values(updater),
update_time = values(update_time),
deleted = values(deleted),
tenant_id = values(tenant_id)
</insert>
<!--通过主键修改数据-->
<update id="update">
update ware_house_location
<set>
<if test="laneId != null">
lane_id = #{laneId},
</if>
<if test="laneName != null and laneName != ''">
lane_name = #{laneName},
</if>
<if test="areaId != null">
area_id = #{areaId},
</if>
<if test="areaName != null and areaName != ''">
area_name = #{areaName},
</if>
<if test="locationNo != null and locationNo != ''">
location_no = #{locationNo},
</if>
<if test="locationYaw != null and locationYaw != ''">
location_yaw = #{locationYaw},
</if>
<if test="groupName != null and groupName != ''">
group_name = #{groupName},
</if>
<if test="skuInfo != null and skuInfo != ''">
sku_info = #{skuInfo},
</if>
<if test="skuBatch != null and skuBatch != ''">
sku_batch = #{skuBatch},
</if>
<if test="skuNumber != null">
sku_number = #{skuNumber},
</if>
<if test="trayInfo != null and trayInfo != ''">
tray_info = #{trayInfo},
</if>
<if test="locationEnable != null">
location_enable = #{locationEnable},
</if>
<if test="locationLock != null">
location_lock = #{locationLock},
</if>
<if test="locationUseStatus != null">
location_use_status = #{locationUseStatus},
</if>
<if test="locationX != null and locationX != ''">
location_x = #{locationX},
</if>
<if test="locationY != null and locationY != ''">
location_y = #{locationY},
</if>
<if test="locationWide != null">
location_wide = #{locationWide},
</if>
<if test="locationDeep != null">
location_deep = #{locationDeep},
</if>
<if test="locationHeight != null">
location_height = #{locationHeight},
</if>
<if test="locationDefaultHeight != null">
location_default_height = #{locationDefaultHeight},
</if>
<if test="locationTotalHeight != null">
location_total_height = #{locationTotalHeight},
</if>
<if test="locationTrayHeight != null">
location_tray_height = #{locationTrayHeight},
</if>
<if test="locationStorey != null">
location_storey = #{locationStorey},
</if>
<if test="locationType != null">
location_type = #{locationType},
</if>
<if test="locationNumber != null">
location_number = #{locationNumber},
</if>
<if test="creator != null and creator != ''">
creator = #{creator},
</if>
<if test="createTime != null">
create_time = #{createTime},
</if>
<if test="updater != null and updater != ''">
updater = #{updater},
</if>
<if test="updateTime != null">
update_time = #{updateTime},
</if>
<if test="deleted != null">
deleted = #{deleted},
</if>
<if test="tenantId != null">
tenant_id = #{tenantId},
</if>
</set>
where id = #{id}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete from ware_house_location where id = #{id}
</delete>
</mapper>