zhaowenyu
2026-01-17 3f957d3cf5d05109867800a2d78ee0bb9ecb4561
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">