仓库信息模块优化

This commit is contained in:
2025-10-30 11:01:07 +08:00
parent db8e6c514c
commit 845f2fd59a
10 changed files with 360 additions and 153 deletions

View File

@@ -24,10 +24,11 @@ public class PcdeDetail extends BaseEntity {
private String pcode;
/** 所属场景 */
@Excel(name = "所属场景名称")
@Excel(name = "所属场景编号")
private String scene;
/** 所属场景名称 */
@Excel(name = "所属场景名称")
private String sceneName;
/** 所属仓库 */

View File

@@ -7,7 +7,7 @@ import com.zg.framework.web.domain.BaseEntity;
/**
* 场景编号对象 scene_mapping
*
*
* @author zg
* @date 2025-05-24
*/
@@ -26,42 +26,73 @@ public class SceneMapping extends BaseEntity
@Excel(name = "场景名称")
private String sceneName;
public void setId(Long id)
/** 所属仓库编码 */
@Excel(name = "所属仓库编码")
private String warehouseCode;
/** 所属仓库名称(查询时通过关联 warehouse_info 返回) */
@Excel(name = "所属仓库名称")
private String warehouseName;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
public Long getId()
{
return id;
}
public void setSceneCode(String sceneCode)
public void setSceneCode(String sceneCode)
{
this.sceneCode = sceneCode;
}
public String getSceneCode()
public String getSceneCode()
{
return sceneCode;
}
public void setSceneName(String sceneName)
public void setSceneName(String sceneName)
{
this.sceneName = sceneName;
}
public String getSceneName()
public String getSceneName()
{
return sceneName;
}
public void setWarehouseCode(String warehouseCode)
{
this.warehouseCode = warehouseCode;
}
public String getWarehouseCode()
{
return warehouseCode;
}
public void setWarehouseName(String warehouseName)
{
this.warehouseName = warehouseName;
}
public String getWarehouseName()
{
return warehouseName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("sceneCode", getSceneCode())
.append("sceneName", getSceneName())
.toString();
public String toString()
{
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("sceneCode", getSceneCode())
.append("sceneName", getSceneName())
.append("warehouseCode", getWarehouseCode())
.append("warehouseName", getWarehouseName())
.toString();
}
}

View File

@@ -9,7 +9,7 @@ import com.zg.framework.web.domain.BaseEntity;
/**
* 仓库信息对象 warehouse_info
*
*
* @author zg
* @date 2025-05-24
*/
@@ -32,8 +32,16 @@ public class WarehouseInfo extends BaseEntity
@Excel(name = "仓库地址")
private String address;
/** 所属大仓编码 */
@Excel(name = "所属大仓编码")
private String parentWarehouseCode;
/** 所属大仓名称 */
@Excel(name = "所属大仓名称")
private String parentWarehouseName;
/** 状态1=启用0=禁用) */
@Excel(name = "状态", readConverterExp = "1==启用0=禁用")
@Excel(name = "状态", readConverterExp = "1=启用,0=禁用")
private Long status;
/** 排序值 */
@@ -50,98 +58,123 @@ public class WarehouseInfo extends BaseEntity
@Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date updatedAt;
public void setId(Long id)
// ===================== Getter / Setter =====================
public void setId(Long id)
{
this.id = id;
}
public Long getId()
public Long getId()
{
return id;
}
public void setWarehouseCode(String warehouseCode)
public void setWarehouseCode(String warehouseCode)
{
this.warehouseCode = warehouseCode;
}
public String getWarehouseCode()
public String getWarehouseCode()
{
return warehouseCode;
}
public void setWarehouseName(String warehouseName)
public void setWarehouseName(String warehouseName)
{
this.warehouseName = warehouseName;
}
public String getWarehouseName()
public String getWarehouseName()
{
return warehouseName;
}
public void setAddress(String address)
public void setAddress(String address)
{
this.address = address;
}
public String getAddress()
public String getAddress()
{
return address;
}
public void setStatus(Long status)
public void setParentWarehouseCode(String parentWarehouseCode)
{
this.parentWarehouseCode = parentWarehouseCode;
}
public String getParentWarehouseCode()
{
return parentWarehouseCode;
}
public void setParentWarehouseName(String parentWarehouseName)
{
this.parentWarehouseName = parentWarehouseName;
}
public String getParentWarehouseName()
{
return parentWarehouseName;
}
public void setStatus(Long status)
{
this.status = status;
}
public Long getStatus()
public Long getStatus()
{
return status;
}
public void setSort(Long sort)
public void setSort(Long sort)
{
this.sort = sort;
}
public Long getSort()
public Long getSort()
{
return sort;
}
public void setCreatedAt(Date createdAt)
public void setCreatedAt(Date createdAt)
{
this.createdAt = createdAt;
}
public Date getCreatedAt()
public Date getCreatedAt()
{
return createdAt;
}
public void setUpdatedAt(Date updatedAt)
public void setUpdatedAt(Date updatedAt)
{
this.updatedAt = updatedAt;
}
public Date getUpdatedAt()
public Date getUpdatedAt()
{
return updatedAt;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("warehouseCode", getWarehouseCode())
.append("warehouseName", getWarehouseName())
.append("address", getAddress())
.append("status", getStatus())
.append("sort", getSort())
.append("remark", getRemark())
.append("createdAt", getCreatedAt())
.append("updatedAt", getUpdatedAt())
.toString();
public String toString()
{
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("warehouseCode", getWarehouseCode())
.append("warehouseName", getWarehouseName())
.append("address", getAddress())
.append("parentWarehouseCode", getParentWarehouseCode())
.append("parentWarehouseName", getParentWarehouseName())
.append("status", getStatus())
.append("sort", getSort())
.append("remark", getRemark())
.append("createdAt", getCreatedAt())
.append("updatedAt", getUpdatedAt())
.toString();
}
}

View File

@@ -74,4 +74,11 @@ public interface PcdeDetailMapper
* @return
*/
String selectEncodedIdByPcode(@Param("pcode") String pcode);;
/**
* 批量插入(忽略已存在的)
* @param slice
* @return
*/
int batchInsertIgnore(List<PcdeDetail> slice);
}

View File

@@ -1,15 +1,13 @@
package com.zg.project.information.service.impl;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.TimerTask;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.zg.common.exception.ServiceException;
import com.zg.common.utils.DateUtils;
import com.zg.common.utils.StringUtils;
import com.zg.framework.manager.AsyncManager;
import com.zg.project.wisdom.mapper.RkInfoMapper;
import org.springframework.beans.factory.annotation.Autowired;
@@ -157,55 +155,62 @@ public class PcdeDetailServiceImpl implements IPcdeDetailService
throw new ServiceException("导入数据不能为空!");
}
AtomicInteger successNum = new AtomicInteger(0);
AtomicInteger failureNum = new AtomicInteger(0);
List<String> failureMsgs = Collections.synchronizedList(new ArrayList<>());
final Date now = DateUtils.getNowDate();
for (PcdeDetail detail : pcdeList) {
TimerTask task = new TimerTask() {
@Override
public void run() {
try {
PcdeDetail exist = pcdeDetailMapper.selectByPcode(detail.getPcode());
if (exist == null) {
detail.setCreateBy(operName);
detail.setCreateTime(DateUtils.getNowDate());
pcdeDetailMapper.insertPcdeDetail(detail);
successNum.incrementAndGet();
} else {
failureNum.incrementAndGet();
failureMsgs.add("库位编号 = " + detail.getPcode() + " 已存在");
}
} catch (Exception e) {
failureNum.incrementAndGet();
failureMsgs.add("库位编号 = " + detail.getPcode() + " 导入失败:" + e.getMessage());
}
}
};
// ✅ 使用自定义线程池工具类提交任务
AsyncManager.me().execute(task);
}
// ❗此处无法精确等待全部线程完成,只做简单延时(如需精确等待建议用 CountDownLatch
try {
Thread.sleep(2000); // 根据量级可调,比如 100 条记录等 1~2 秒
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
if (failureNum.get() > 0) {
StringBuilder msg = new StringBuilder();
msg.append("很抱歉,导入失败!共 ").append(failureNum.get()).append(" 条数据有误,错误如下:");
for (String fail : failureMsgs) {
msg.append("<br/>").append(fail);
// 1) 清洗 + 本地生成 encodedId逐字符→Unicode→HEX大写→拼接
List<PcdeDetail> cleaned = new ArrayList<>(pcdeList.size());
for (PcdeDetail d : pcdeList) {
if (d == null) continue;
String p = d.getPcode() == null ? null : d.getPcode().trim();
if (StringUtils.isEmpty(p)) {
// 跳过空 pcode
continue;
}
throw new ServiceException(msg.toString());
} else {
return "恭喜您,数据已全部导入成功!共 " + successNum.get() + " 条。";
d.setPcode(p);
d.setEncodedId(toHexStringFromPcode(p));
// 审计字段与你实体保持一致createdBy/createdAt/updatedBy/updatedAt
d.setCreatedBy(operName);
d.setCreatedAt(now);
d.setUpdatedBy(operName);
d.setUpdatedAt(now);
// 业务兜底
if (d.getIsDelete() == null) d.setIsDelete("0");
cleaned.add(d);
}
if (cleaned.isEmpty()) {
throw new ServiceException("有效的库位编号为空,请检查导入文件!");
}
// 2) 批量写库(分片,避免 SQL 过大;配合 uk_pcode + INSERT IGNORE 实现幂等忽略)
final int batchSize = 1000;
int totalTried = cleaned.size();
int totalInserted = 0;
for (int i = 0; i < cleaned.size(); i += batchSize) {
int end = Math.min(i + batchSize, cleaned.size());
List<PcdeDetail> slice = cleaned.subList(i, end);
int affected = pcdeDetailMapper.batchInsertIgnore(slice);
totalInserted += affected;
}
int skipped = totalTried - totalInserted;
return String.format("导入完成:共读取 %d 条,成功导入 %d 条,跳过(可能重复) %d 条。",
totalTried, totalInserted, skipped);
}
/** 将 pcode 按字符转大写十六进制(与新增接口保持一致) */
private String toHexStringFromPcode(String pcode) {
StringBuilder hex = new StringBuilder(pcode.length() * 2);
for (int i = 0; i < pcode.length(); i++) {
char c = pcode.charAt(i);
hex.append(Integer.toHexString(c).toUpperCase());
}
return hex.toString();
}
/**
* 获取未被入库单据使用的库位列表

View File

@@ -7,9 +7,9 @@ spring:
# 主库数据源
master:
# url: jdbc:mysql://101.132.133.142:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
# url: jdbc:mysql://192.168.1.20:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
url: jdbc:mysql://192.168.1.20:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
# url: jdbc:mysql://192.168.1.192:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
url: jdbc:mysql://192.168.1.251:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
# url: jdbc:mysql://192.168.1.251:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
# url: jdbc:mysql://localhost:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: shzg

View File

@@ -69,8 +69,8 @@ spring:
redis:
# 地址
# host: 101.132.133.142
# host: 192.168.1.20
host: 192.168.1.251
host: 192.168.1.20
# host: 192.168.1.251
# host: localhost
# 端口默认为6379
port: 6379

View File

@@ -131,6 +131,32 @@
where id = #{id}
</update>
<insert id="batchInsertIgnore">
INSERT IGNORE INTO pcde_detail
(pcode, scene, scene_name, warehouse, warehouse_name,
encoded_id, tag, remark, is_delete,
created_by, created_at, updated_by, updated_at)
VALUES
<foreach collection="list" item="item" separator=",">
(
#{item.pcode},
#{item.scene},
#{item.sceneName},
#{item.warehouse},
#{item.warehouseName},
#{item.encodedId},
#{item.tag},
#{item.remark},
#{item.isDelete},
#{item.createdBy},
#{item.createdAt},
#{item.updatedBy},
#{item.updatedAt}
)
</foreach>
</insert>
<delete id="deletePcdeDetailById" parameterType="Long">
delete from pcde_detail where id = #{id}
</delete>

View File

@@ -1,61 +1,103 @@
<?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">
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zg.project.information.mapper.SceneMappingMapper">
<resultMap type="SceneMapping" id="SceneMappingResult">
<result property="id" column="id" />
<result property="sceneCode" column="scene_code" />
<result property="sceneName" column="scene_name" />
<!-- ====== 实体映射 ====== -->
<resultMap id="SceneMappingResult" type="SceneMapping">
<result property="id" column="id"/>
<result property="sceneCode" column="scene_code"/>
<result property="sceneName" column="scene_name"/>
<result property="warehouseCode" column="warehouse_code"/>
<result property="warehouseName" column="warehouse_name"/>
</resultMap>
<!-- ====== 通用查询列(含连表字段) ====== -->
<sql id="selectSceneMappingVo">
select id, scene_code, scene_name from scene_mapping
SELECT
sm.id,
sm.scene_code,
sm.scene_name,
sm.warehouse_code,
wi.warehouse_name AS warehouse_name
FROM scene_mapping sm
LEFT JOIN warehouse_info wi
ON wi.warehouse_code = sm.warehouse_code
</sql>
<!-- ====== 列表查询 ====== -->
<select id="selectSceneMappingList" parameterType="SceneMapping" resultMap="SceneMappingResult">
<include refid="selectSceneMappingVo"/>
<where>
<if test="sceneCode != null and sceneCode != ''"> and scene_code = #{sceneCode}</if>
<if test="sceneName != null and sceneName != ''"> and scene_name like concat('%', #{sceneName}, '%')</if>
<where>
<if test="sceneCode != null and sceneCode != ''">
AND sm.scene_code = #{sceneCode}
</if>
<if test="sceneName != null and sceneName != ''">
AND sm.scene_name LIKE CONCAT('%', #{sceneName}, '%')
</if>
<if test="warehouseCode != null and warehouseCode != ''">
AND sm.warehouse_code = #{warehouseCode}
</if>
<if test="warehouseName != null and warehouseName != ''">
AND wi.warehouse_name LIKE CONCAT('%', #{warehouseName}, '%')
</if>
</where>
</select>
<!-- ====== 主键查询 ====== -->
<select id="selectSceneMappingById" parameterType="Long" resultMap="SceneMappingResult">
<include refid="selectSceneMappingVo"/>
where id = #{id}
WHERE sm.id = #{id}
</select>
<!-- ====== 新增 ====== -->
<insert id="insertSceneMapping" parameterType="SceneMapping" useGeneratedKeys="true" keyProperty="id">
insert into scene_mapping
INSERT INTO scene_mapping
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="sceneCode != null and sceneCode != ''">scene_code,</if>
<if test="sceneName != null and sceneName != ''">scene_name,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="warehouseCode != null and warehouseCode != ''">warehouse_code,</if>
<if test="warehouseName != null and warehouseName != ''">warehouse_name,</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="sceneCode != null and sceneCode != ''">#{sceneCode},</if>
<if test="sceneName != null and sceneName != ''">#{sceneName},</if>
</trim>
<if test="warehouseCode != null and warehouseCode != ''">#{warehouseCode},</if>
<if test="warehouseName != null and warehouseName != ''">#{warehouseName},</if>
</trim>
</insert>
<!-- ====== 更新(可修改所属仓库编码 + 名称) ====== -->
<update id="updateSceneMapping" parameterType="SceneMapping">
update scene_mapping
UPDATE scene_mapping
<trim prefix="SET" suffixOverrides=",">
<if test="sceneCode != null and sceneCode != ''">scene_code = #{sceneCode},</if>
<if test="sceneName != null and sceneName != ''">scene_name = #{sceneName},</if>
<if test="sceneCode != null and sceneCode != ''">
scene_code = #{sceneCode},
</if>
<if test="sceneName != null and sceneName != ''">
scene_name = #{sceneName},
</if>
<if test="warehouseCode != null and warehouseCode != ''">
warehouse_code = #{warehouseCode},
</if>
<if test="warehouseName != null and warehouseName != ''">
warehouse_name = #{warehouseName},
</if>
</trim>
where id = #{id}
WHERE id = #{id}
</update>
<!-- ====== 删除 ====== -->
<delete id="deleteSceneMappingById" parameterType="Long">
delete from scene_mapping where id = #{id}
DELETE FROM scene_mapping WHERE id = #{id}
</delete>
<delete id="deleteSceneMappingByIds" parameterType="String">
delete from scene_mapping where id in
DELETE FROM scene_mapping WHERE id IN
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
</mapper>

View File

@@ -1,90 +1,152 @@
<?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">
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zg.project.information.mapper.WarehouseInfoMapper">
<resultMap type="WarehouseInfo" id="WarehouseInfoResult">
<result property="id" column="id" />
<result property="warehouseCode" column="warehouse_code" />
<result property="warehouseName" column="warehouse_name" />
<result property="address" column="address" />
<result property="status" column="status" />
<result property="sort" column="sort" />
<result property="remark" column="remark" />
<result property="createdAt" column="created_at" />
<result property="updatedAt" column="updated_at" />
<!-- ========= 映射 ========= -->
<resultMap id="WarehouseInfoResult" type="WarehouseInfo">
<result property="id" column="id"/>
<result property="warehouseCode" column="warehouse_code"/>
<result property="warehouseName" column="warehouse_name"/>
<result property="address" column="address"/>
<!-- 新增:所属大仓 -->
<result property="parentWarehouseCode" column="parent_warehouse_code"/>
<result property="parentWarehouseName" column="parent_warehouse_name"/>
<result property="status" column="status"/>
<result property="sort" column="sort"/>
<result property="remark" column="remark"/>
<result property="createdAt" column="created_at"/>
<result property="updatedAt" column="updated_at"/>
</resultMap>
<!-- ========= 通用列 ========= -->
<sql id="selectWarehouseInfoVo">
select id, warehouse_code, warehouse_name, address, status, sort, remark, created_at, updated_at from warehouse_info
SELECT
id,
warehouse_code,
warehouse_name,
address,
parent_warehouse_code,
parent_warehouse_name,
status,
sort,
remark,
created_at,
updated_at
FROM warehouse_info
</sql>
<!-- ========= 列表查询 ========= -->
<select id="selectWarehouseInfoList" parameterType="WarehouseInfo" resultMap="WarehouseInfoResult">
<include refid="selectWarehouseInfoVo"/>
<where>
<if test="warehouseCode != null and warehouseCode != ''"> and warehouse_code = #{warehouseCode}</if>
<if test="warehouseName != null and warehouseName != ''"> and warehouse_name like concat('%', #{warehouseName}, '%')</if>
<if test="address != null and address != ''"> and address = #{address}</if>
<if test="status != null "> and status = #{status}</if>
<if test="sort != null "> and sort = #{sort}</if>
<if test="createdAt != null "> and created_at = #{createdAt}</if>
<if test="updatedAt != null "> and updated_at = #{updatedAt}</if>
<where>
<if test="warehouseCode != null and warehouseCode != ''">
AND warehouse_code = #{warehouseCode}
</if>
<if test="warehouseName != null and warehouseName != ''">
AND warehouse_name LIKE concat('%', #{warehouseName}, '%')
</if>
<if test="address != null and address != ''">
AND address = #{address}
</if>
<!-- 新增:按所属大仓筛选 -->
<if test="parentWarehouseCode != null and parentWarehouseCode != ''">
AND parent_warehouse_code = #{parentWarehouseCode}
</if>
<if test="parentWarehouseName != null and parentWarehouseName != ''">
AND parent_warehouse_name LIKE concat('%', #{parentWarehouseName}, '%')
</if>
<if test="status != null">
AND status = #{status}
</if>
<if test="sort != null">
AND sort = #{sort}
</if>
<if test="createdAt != null">
AND created_at = #{createdAt}
</if>
<if test="updatedAt != null">
AND updated_at = #{updatedAt}
</if>
</where>
</select>
<!-- ========= 主键查询 ========= -->
<select id="selectWarehouseInfoById" parameterType="Long" resultMap="WarehouseInfoResult">
<include refid="selectWarehouseInfoVo"/>
where id = #{id}
WHERE id = #{id}
</select>
<!-- ========= 新增 ========= -->
<insert id="insertWarehouseInfo" parameterType="WarehouseInfo" useGeneratedKeys="true" keyProperty="id">
insert into warehouse_info
INSERT INTO warehouse_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="warehouseCode != null and warehouseCode != ''">warehouse_code,</if>
<if test="warehouseName != null and warehouseName != ''">warehouse_name,</if>
<if test="address != null">address,</if>
<!-- 新增:所属大仓 -->
<if test="parentWarehouseCode != null and parentWarehouseCode != ''">parent_warehouse_code,</if>
<if test="parentWarehouseName != null and parentWarehouseName != ''">parent_warehouse_name,</if>
<if test="status != null">status,</if>
<if test="sort != null">sort,</if>
<if test="remark != null">remark,</if>
<if test="createdAt != null">created_at,</if>
<if test="updatedAt != null">updated_at,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="warehouseCode != null and warehouseCode != ''">#{warehouseCode},</if>
<if test="warehouseName != null and warehouseName != ''">#{warehouseName},</if>
<if test="address != null">#{address},</if>
<!-- 新增:所属大仓 -->
<if test="parentWarehouseCode != null and parentWarehouseCode != ''">#{parentWarehouseCode},</if>
<if test="parentWarehouseName != null and parentWarehouseName != ''">#{parentWarehouseName},</if>
<if test="status != null">#{status},</if>
<if test="sort != null">#{sort},</if>
<if test="remark != null">#{remark},</if>
<if test="createdAt != null">#{createdAt},</if>
<if test="updatedAt != null">#{updatedAt},</if>
</trim>
</trim>
</insert>
<!-- ========= 更新 ========= -->
<update id="updateWarehouseInfo" parameterType="WarehouseInfo">
update warehouse_info
UPDATE warehouse_info
<trim prefix="SET" suffixOverrides=",">
<if test="warehouseCode != null and warehouseCode != ''">warehouse_code = #{warehouseCode},</if>
<if test="warehouseName != null and warehouseName != ''">warehouse_name = #{warehouseName},</if>
<if test="address != null">address = #{address},</if>
<!-- 新增:所属大仓 -->
<if test="parentWarehouseCode != null and parentWarehouseCode != ''">parent_warehouse_code = #{parentWarehouseCode},</if>
<if test="parentWarehouseName != null and parentWarehouseName != ''">parent_warehouse_name = #{parentWarehouseName},</if>
<if test="status != null">status = #{status},</if>
<if test="sort != null">sort = #{sort},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createdAt != null">created_at = #{createdAt},</if>
<if test="updatedAt != null">updated_at = #{updatedAt},</if>
</trim>
where id = #{id}
WHERE id = #{id}
</update>
<!-- ========= 删除 ========= -->
<delete id="deleteWarehouseInfoById" parameterType="Long">
delete from warehouse_info where id = #{id}
DELETE FROM warehouse_info WHERE id = #{id}
</delete>
<delete id="deleteWarehouseInfoByIds" parameterType="String">
delete from warehouse_info where id in
DELETE FROM warehouse_info WHERE id IN
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
</mapper>