chenrui
2025-04-08 0c7662223279a3d18197c47180bbd132d6020906
basic-server/src/main/resources/mapper/StructureItemParameterMapper.xml
@@ -92,7 +92,8 @@
        inspection_item_class_en,
        code,
        radius_list,
        rates
        rates,
        delegate_request_flag
        FROM
        temp_sample A
        LEFT JOIN
@@ -145,28 +146,46 @@
        <result property="name" column="subclass"/>
    </resultMap>
    <select id="getInsProduction" resultMap="getInsProductions">
        select distinct id,
                        CASE
                            WHEN INSTR(sample, ',') > 0 THEN
                                SUBSTRING_INDEX(SUBSTRING_INDEX(sample, '","', 1), '"', -1)
                            when sample = '[""]' then '*'
                            ELSE
                                TRIM(BOTH '["]' FROM SUBSTRING_INDEX(REPLACE(sample, '[["', ''), '"]]', 1))
                            END
                                                              as sample,
                        inspection_item,
                        case
                            when inspection_item_subclass is null or inspection_item_subclass = '' then inspection_item
                            else inspection_item_subclass end as subclass,
                        case
                            when inspection_item_class is null or inspection_item_class = '' then inspection_item
                            else inspection_item_class end as item_class
        from structure_item_parameter
        SELECT DISTINCT
            id,
            CASE
                WHEN INSTR(sample, ',') > 0 THEN
                    TRIM(BOTH '"' FROM SUBSTRING_INDEX(SUBSTRING_INDEX(sample, '","', - 1), '"]]', 1))
                WHEN sample = '[""]' THEN
                    '*'
                ELSE
                    TRIM(BOTH '["]' FROM SUBSTRING_INDEX(REPLACE(sample, '[["', ''), '"]]', 1))
                END AS sample,
            inspection_item,
            CASE
                WHEN inspection_item_subclass IS NULL
                    OR TRIM(inspection_item_subclass) = '' THEN
                    inspection_item
                ELSE
                    inspection_item_subclass
                END AS subclass,
            CASE
                WHEN inspection_item_class IS NULL
                    OR TRIM(inspection_item_class) = '' THEN
                    inspection_item
                ELSE
                    inspection_item_class
                END AS item_class
        FROM
            structure_item_parameter;
    </select>
    <select id="getItemTree" resultMap="itemDto">
        select sto.id sId, sto.specimen_name sName, p.id pId, p.name pName
        from structure_test_object sto
                 left join product p on p.object_id = sto.id
        SELECT
            sto.id AS sId,
            CONCAT(sto.specimen_name, ' (', sto.object_type, ')') AS sName,
            p.id AS pId,
            p.name AS pName,
            sto.object_type
        FROM
            structure_test_object sto
                LEFT JOIN
            product p
            ON p.object_id = sto.id;
    </select>
    <resultMap id="itemDto" type="com.ruoyi.basic.dto.TestItemDto">
@@ -186,8 +205,11 @@
        sample is NULL
        OR sample = ''
        or sample = '[]'
        OR sample LIKE CONCAT('%', #{sample}, '%')
        OR sample LIKE CONCAT('%', #{structureItemParameterDto.tree}, '%')
        )
        <if test="structureItemParameterDto.delegateRequestFlag != null and structureItemParameterDto.delegateRequestFlag  !='' and structureItemParameterDto.delegateRequestFlag == '1' ">
            AND delegate_request_flag = #{structureItemParameterDto.delegateRequestFlag}
        </if>
        order by id asc
    </select>