From 3f957d3cf5d05109867800a2d78ee0bb9ecb4561 Mon Sep 17 00:00:00 2001
From: zhaowenyu <35589726@qq.com>
Date: Sat, 17 Jan 2026 16:18:59 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev' into dev

---
 ard-inspection/src/main/resources/mapper/ArdInspectionGroupMapper.xml |   43 +++++++++++++++++++++++++++++++++----------
 1 files changed, 33 insertions(+), 10 deletions(-)

diff --git a/ard-inspection/src/main/resources/mapper/ArdInspectionGroupMapper.xml b/ard-inspection/src/main/resources/mapper/ArdInspectionGroupMapper.xml
index 754ef85..a2b0da0 100644
--- a/ard-inspection/src/main/resources/mapper/ArdInspectionGroupMapper.xml
+++ b/ard-inspection/src/main/resources/mapper/ArdInspectionGroupMapper.xml
@@ -14,6 +14,7 @@
         <result property="createTime"    column="create_time"    />
         <result property="updateBy"    column="update_by"    />
         <result property="updateTime"    column="update_time"    />
+        <result property="parentName" column="parent_name" />
     </resultMap>
 
     <sql id="selectArdInspectionGroupVo">
@@ -31,22 +32,44 @@
 
     <select id="selectArdInspectionGroupList" parameterType="ArdInspectionGroup" resultMap="ArdInspectionGroupResult">
         <include refid="selectArdInspectionGroupVo"/>
-        <where>  
-            <if test="groupParentId != null "> and group_parent_id = #{groupParentId}</if>
-            <if test="ancestors != null  and ancestors != ''"> and ancestors = #{ancestors}</if>
-            <if test="groupName != null  and groupName != ''"> and group_name like concat('%', #{groupName}, '%')</if>
-            <if test="orderNum != null "> and order_num = #{orderNum}</if>
+        <where>
+            <if test="groupId != null ">
+                and group_id = #{groupId}
+            </if>
+            <if test="groupParentId != null ">
+                and group_parent_id = #{groupParentId}
+            </if>
+            <if test="ancestors != null  and ancestors != ''">
+                and ancestors = #{ancestors}
+            </if>
+            <if test="groupName != null  and groupName != ''">
+                and group_name like concat('%', #{groupName}, '%')
+            </if>
+            <if test="orderNum != null ">
+                and order_num = #{orderNum}
+            </if>
         </where>
+        order by group_parent_id, order_num
     </select>
     
     <select id="selectArdInspectionGroupByGroupId" parameterType="Long" resultMap="ArdInspectionGroupResult">
-        <include refid="selectArdInspectionGroupVo"/>
-        where group_id = #{groupId}
+        SELECT
+            g.group_id,
+            g.group_parent_id,
+            g.ancestors,
+            g.group_name,
+            g.order_num,
+            ( SELECT group_name FROM ard_inspection_group WHERE group_id = g.group_parent_id) parent_name
+        FROM
+            ard_inspection_group g
+        WHERE
+            g.group_id = #{groupId}
     </select>
 
-    <insert id="insertArdInspectionGroup" parameterType="ArdInspectionGroup" useGeneratedKeys="true" keyProperty="groupId">
+    <insert id="insertArdInspectionGroup" parameterType="ArdInspectionGroup">
         insert into ard_inspection_group
         <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="groupId != null">group_id,</if>
             <if test="groupParentId != null">group_parent_id,</if>
             <if test="ancestors != null">ancestors,</if>
             <if test="groupName != null">group_name,</if>
@@ -57,6 +80,7 @@
             <if test="updateTime != null">update_time,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="groupId != null">#{groupId},</if>
             <if test="groupParentId != null">#{groupParentId},</if>
             <if test="ancestors != null">#{ancestors},</if>
             <if test="groupName != null">#{groupName},</if>
@@ -97,8 +121,7 @@
     <select id="checkInspectionGroupNameUnique" resultMap="ArdInspectionGroupResult">
         <include refid="selectArdInspectionGroupVo"/>
         where group_name=#{groupName}
-        and group_parent_id = #{groupParentId}
-        and del_flag = '0' limit 1
+        and group_parent_id = #{groupParentId} limit 1
     </select>
 
     <select id="selectChildrenInspectionGroupById" parameterType="Long" resultMap="ArdInspectionGroupResult">

--
Gitblit v1.9.3