From 260dd6fe156265832544715192ce1491e9c2afd6 Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期五, 26 六月 2026 13:41:13 +0800
Subject: [PATCH] fix(stock): 解决库存管理中的重复键异常问题 - 在采购台账服务中添加净合同金额字段设置 - 在销售台账服务中添加净合同金额字段设置 - 在入库记录服务中为库存插入操作添加重复键异常处理 - 在入库记录服务中为非库存插入操作添加重复键异常处理 - 在库存服务中为库存插入操作添加重复键异常处理 - 统一处理数据库唯一键约束冲突,避免系统错误

---
 src/main/resources/mapper/system/SysDeptMapper.xml |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/src/main/resources/mapper/system/SysDeptMapper.xml b/src/main/resources/mapper/system/SysDeptMapper.xml
index c71cd19..de46729 100644
--- a/src/main/resources/mapper/system/SysDeptMapper.xml
+++ b/src/main/resources/mapper/system/SysDeptMapper.xml
@@ -26,7 +26,6 @@
 	<sql id="selectDeptVo">
         select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time
         from sys_dept d
-        order by d.create_time desc
     </sql>
 
 	<select id="selectDeptList" parameterType="com.ruoyi.project.system.domain.SysDept" resultMap="SysDeptResult">
@@ -92,7 +91,7 @@
 
 	<select id="checkDeptNameUnique" resultMap="SysDeptResult">
 	    <include refid="selectDeptVo"/>
-		where dept_name=#{deptName} and parent_id = #{parentId} and del_flag = '0' limit 1
+		where dept_name=#{deptName} and parent_id = #{parentId} and del_flag = '0' order by d.create_time desc limit 1
 	</select>
 
     <insert id="insertDept" parameterType="com.ruoyi.project.system.domain.SysDept">

--
Gitblit v1.9.3