jinlin
2025-04-01 a80b4a7eb099390bb53c967126fa97b30568e1a3
src/main/resources/mapper/progressTrack/DjJdgzNetworkLevel3Dao.xml
@@ -33,28 +33,28 @@
        LEFT JOIN dj_jdgz_network_level1_list b on b.NETWORK_ID = c.ID
        LEFT JOIN dj_jdgz_network_level2_list d on d.ID = a.LEVEL2_NODE_ID
        where
            a.is_delete = 0
            and b.is_delete = 0
            and c.is_delete = 0
            and d.is_delete = 0
            <if test="shipId!=null">
                and c.ship_id = ${shipId}
            </if>
            <if test="deptId!=null">
                and a.dept_id = ${deptId}
            </if>
            <if test="teamId!=null">
                and a.TEAMGROUP_ID = ${teamId}
            </if>
            <if test="cabinId!=null">
                and a.cabin_id  LIKE '%${cabinId}%'
            </if>
            <if test="type!=null and type!=''">
                and a.type  = #{type}
            </if>
            <if test="name!=null and name!=''">
                and a.name  LIKE '%${name}%'
            </if>
        a.is_delete = 0
        and b.is_delete = 0
        and c.is_delete = 0
        and d.is_delete = 0
        <if test="shipId!=null">
            and c.ship_id = ${shipId}
        </if>
        <if test="deptId!=null">
            and a.dept_id = ${deptId}
        </if>
        <if test="teamId!=null">
            and a.TEAMGROUP_ID = ${teamId}
        </if>
        <if test="cabinId!=null">
            and a.cabin_id = ${cabinId}
        </if>
        <if test="type!=null and type!=''">
            and a.type = #{type}
        </if>
        <if test="name!=null and name!=''">
            and a.name LIKE '%${name}%'
        </if>
        group by a.id
    </select>
@@ -93,6 +93,92 @@
            and a.TEAMGROUP_ID = ${teamId}
        </if>
    </select>
    <select id="getNodeList" resultType="com.example.server.progressTrack.Dto.TableNodeDto">
        SELECT
        b.name,
        a.NETWORK_ID,
        a.process_name,
        a.ID, a.REQUIRED_COMPLETION_TIME, a.ACTUAL_COMPLETION, a.CURRENT_STATUS
        FROM `dj_jdgz_network_level3_list` a
        LEFT JOIN dj_jdgz_network_level3 b on b.ID = a.NETWORK_ID
        LEFT JOIN dj_jdgz_network_level1 c on c.ID = b.LEVEL1_NETWORK_ID
        where
        a.is_delete = 0
        and b.is_delete = 0
        and c.is_delete = 0
        <if test="shipId!=null">
            and c.ship_id = ${shipId}
        </if>
        <if test="deptId!=null">
            and b.dept_id = ${deptId}
        </if>
        <if test="teamId!=null">
            and b.TEAMGROUP_ID = ${teamId}
        </if>
        <if test="cabinId!=null">
            and b.cabin_id = ${cabinId}
        </if>
        <if test="type!=null and type!=''">
            and b.type = #{type}
        </if>
        <if test="name!=null and name!=''">
            and b.name LIKE '%${name}%'
        </if>
    </select>
    <select id="getStatist" resultType="com.example.server.progressTrack.Dto.StatistProductDto">
        SELECT
            a.id,
            CASE WHEN a.pid = 0 THEN a.NAME ELSE '    ' || a.NAME END AS name,
            CASE WHEN a.pid = 0 THEN '' || a.id ELSE '' || a.pid || a.SORT END AS sort,
            COUNT(DISTINCT CASE WHEN fvp.process_name = '设备拆卸出舱' THEN b.id END) AS cxsl,
            COUNT(DISTINCT CASE WHEN fvp.process_name = '设备分交' THEN b.id END) AS fjsl,
            COUNT(DISTINCT CASE WHEN fvp.process_name = '拆检鉴定' THEN b.id END) AS jdsl,
            COUNT(DISTINCT CASE WHEN fvp.process_name = '设备返厂' THEN b.id END) AS fcsl,
            COUNT(DISTINCT CASE WHEN fvp.process_name = '回装' THEN b.id END) AS hzsl,
            COUNT(DISTINCT CASE WHEN all_complete.network_id IS NOT NULL THEN b.id END) AS wcsl
        FROM
            dj_sys_teamgroup_class a
            left JOIN
            dj_jdgz_network_level3 b ON a.id = b.TEAMGROUP_ID OR a.id = b.DEPT_ID
            LEFT JOIN dj_jdgz_network_level1 d on d.ID = b.LEVEL1_NETWORK_ID
                LEFT JOIN (
                SELECT
                    network_id,
                    process_name
                FROM (
                         SELECT
                             c.network_id,
                             c.process_name,
                             c.CURRENT_STATUS,
                             ROW_NUMBER() OVER (
                                 PARTITION BY c.network_id
                                 ORDER BY c.sort
                                 ) AS rn
                         FROM
                             dj_jdgz_network_level3_list c
                         WHERE
                             (c.CURRENT_STATUS = 0 OR c.CURRENT_STATUS IS NULL) and c.is_delete = 0
                     ) AS ranked_processes
                WHERE
                    ranked_processes.rn = 1
            ) AS fvp ON b.id = fvp.network_id
                LEFT JOIN (
                SELECT
                    network_id
                FROM
                    dj_jdgz_network_level3_list
                GROUP BY
                    network_id
                HAVING
                    COUNT(CASE WHEN CURRENT_STATUS = 1 THEN 1 END) = COUNT(*)
            ) AS all_complete ON b.id = all_complete.network_id
        WHERE
            a.AREA = 'hld' AND a.IS_DELETE = 0 and d.ship_id = ${level1Id} and d.is_delete =0 and b.is_delete =0
        GROUP BY
            a.id, a.name
        ORDER BY
            sort;
    </select>
</mapper>