| | |
| | | <resultMap id="treeDeviceDto" type="map"> |
| | | <result property="label" column="laboratory_name"/> |
| | | <result property="value" column="value" /> |
| | | <collection property="children" resultMap="storagePointMap" javaType="List"/> |
| | | </resultMap> |
| | | |
| | | <resultMap id="storagePointMap" type="map"> |
| | | <result property="value" column="value"/> |
| | | <result property="label" column="storage_point"/> |
| | | <collection property="children" resultMap="deviceNameMap" javaType="List"/> |
| | | <collection property="children" resultMap="deviceNameMap" javaType="List" notNullColumn="id"/> |
| | | </resultMap> |
| | | |
| | | <resultMap id="deviceNameMap" type="map"> |
| | |
| | | <result property="label" column="device_name"/> |
| | | <result property="activationDate" column="activation_date"/> |
| | | <result property="managementNumber" column="management_number"/> |
| | | <result property="storagePoint" column="storage_point"/> |
| | | </resultMap> |
| | | |
| | | <select id="treeDevice" resultMap="treeDeviceDto"> |
| | | select |
| | | c.laboratory_name, |
| | | d.id, |
| | | case when sd.dept_name is null || sd.dept_name ='' then '其他' else sd.dept_name end as laboratory_name, |
| | | case when d.storage_point is null || d.storage_point ='' then '其他' else d.storage_point end as storage_point, |
| | | d.device_name, |
| | | d.management_number, |
| | | null as value, |
| | | d.activation_date |
| | | from device d |
| | | LEFT JOIN sys_dept sd ON sd.dept_id = d.subordinate_departments_id AND sd.del_flag = '0' |
| | | d.storage_point, |
| | | d.activation_date, |
| | | null as value |
| | | from ( |
| | | select 1 as sort_no, '全部' as laboratory_name |
| | | union all |
| | | select 2 as sort_no, '设备' as laboratory_name |
| | | union all |
| | | select 3 as sort_no, '计量器具' as laboratory_name |
| | | ) c |
| | | left join device d on c.sort_no = 1 or d.large_category = c.laboratory_name |
| | | <where> |
| | | <if test="deviceName!=null and deviceName!=''"> |
| | | and device_name like concat('%',#{deviceName},'%') |
| | | and d.device_name like concat('%',#{deviceName},'%') |
| | | </if> |
| | | </where> |
| | | order by c.sort_no, d.id |
| | | </select> |
| | | |
| | | <select id="selectDeviceByCode" resultType="com.ruoyi.device.dto.DeviceDto"> |