zss
2024-12-27 ebede85283906f52dd45d0755d22140538038ac3
cnas-server/src/main/resources/mapper/DataConfigMapper.xml
@@ -5,9 +5,6 @@
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.yuanchu.mom.pojo.DataConfig">
        <id column="id" property="id" />
        <result column="file_type" property="fileType" />
        <result column="collect_url" property="collectUrl" />
        <result column="storage_url" property="storageUrl" />
        <result column="formula" property="formula" />
        <result column="referx" property="referx" />
        <result column="refery" property="refery" />
@@ -15,4 +12,36 @@
        <result column="y" property="y" />
    </resultMap>
    <select id="selectDataConfigList" resultType="com.yuanchu.mom.dto.DeviceConfigDtoPage">
        SELECT d.device_name,
               d.file_type,
               d.collect_url,
               d.storage_url,
               d.ip,
               d.entrust_code,
               d.sample_code,
               d.db_file_name,
               ip.inspection_item,
               if(ip.inspection_item_subclass is not null and ip.inspection_item_subclass != '',
                  ip.inspection_item_subclass, ip.inspection_item)                            inspection_item_subclass,
               TRIM(BOTH '["]' FROM SUBSTRING_INDEX(REPLACE(ip.sample, '[["', ''), '"]]', 1)) sample,
               ddc.formula,
               ddc.referx,
               ddc.refery,
               ddc.x,
               ddc.y,
               ddc.id,
               ip.id                                                                          structureItemParameterId
        FROM device d
                 left join structure_item_parameter ip on FIND_IN_SET(ip.id, d.ins_product_ids)
                 left join device_data_config ddc on ddc.device_id = d.id and ddc.structure_item_parameter_id = ip.id
        where d.id = #{deviceId}
    </select>
    <select id="deleteDataConfig" resultType="integer">
        SELECT ddc.id
        FROM device d
                 left join structure_item_parameter ip on not FIND_IN_SET(ip.id, d.ins_product_ids)
                 inner join device_data_config ddc on ddc.device_id = d.id and ddc.structure_item_parameter_id = ip.id
    </select>
</mapper>