| | |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.measuringinstrumentledger.mapper.SparePartsMapper"> |
| | | <select id="listPage" resultType="com.ruoyi.measuringinstrumentledger.dto.SparePartsDto"> |
| | | select sp.*,sp1.name as parentName |
| | | select sp.*, sp1.name as parentName, |
| | | <!-- 2026-10-12 修复:前端列表第一列取的是 deviceNameStr,但 DTO 和 SQL 都没有这个字段, |
| | | 导致「设备名称」列永远空白(看起来像"没绑定设备")。 |
| | | 这里按 spare_parts.device_ids(逗号分隔)反查 device_ledger 拼出设备名。 --> |
| | | (select group_concat(d.device_name order by d.id separator ',') |
| | | from device_ledger d |
| | | where sp.device_ids is not null and sp.device_ids <> '' |
| | | and find_in_set(d.id, sp.device_ids)) as deviceNameStr |
| | | from spare_parts sp |
| | | left join spare_parts sp1 on sp1.id = sp.parent_id |
| | | <where> |