qushaowei
2023-08-19 49ce2da196e1c18c9961ec214eb822b205e3d12b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.eam.mapper.EquipmentSparesMapper">
 
    <select id="getEquipmentSparesList"  parameterType="Map" resultType="Map">
        SELECT
            t1.id,
            t1.equipment_id as equipmentId,
            t1.equipment_structure_id as equipmentStructureId,
            t1.spare_part_id as sparePartId,
            t2.num,
            t2.name,
            t2.model,
            t2.specification,
            t3.name as constructorName,
            t4.name as mainUnitName,
            t1.mating_quantity as matingQuantity,
            t1.life_span as lifeSpan,
            t1.change_cycle as changeCycle,
            t1.unit_id as unitId,
            t5.name as unitName,
            t1.lase_change_time as laseChangeTime,
            t1.next_change_time AS nextChangeTime,
            t1.create_by as createBy,
            t1.create_time as createTime
        FROM
            mom_eam_equipment_spares t1
        LEFT JOIN mom_eam_spare_part t2 ON t1.spare_part_id = t2.id
        left join mom_base_constructor t3 on t2.constructor_id = t3.id
        left join mom_base_unit t4 on t2.main_unit_id = t4.id
        left join mom_base_unit t5 on t1.unit_id = t5.id
        WHERE t1.del_flag = '0'
        <if test="params.equipmentStructureId != null and params.equipmentStructureId != ''">
            and t1.equipment_structure_id = #{params.equipmentStructureId}
        </if>
        <if test="params.equipmentId != null and params.equipmentId != ''">
            and t1.equipment_id = #{params.equipmentId}
        </if>
        <if test="params.num != null and params.num != ''">
            and t2.num like concat('%',#{params.num},'%')
        </if>
        <if test="params.name != null and params.name != ''">
            and t2.name like concat('%',#{params.name},'%')
        </if>
        ORDER BY t1.create_time desc
    </select>
</mapper>