<?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>
|
<select id="getPagesByEquipmentId" resultType="org.jeecg.modules.eam.entity.EquipmentSpares">
|
select
|
t1.id id,
|
t2.id sparePartId,
|
t2.name name,
|
t2.num num,
|
t2.model model,
|
t2.specification specification,
|
t2.main_unit_id unitId,
|
t3.name unitName,
|
t1.equipment_id equipmentId
|
from mom_eam_equipment_spares t1
|
left join mom_eam_spare_part t2
|
on t1.spare_part_id = t2.id
|
left join mom_base_unit t3
|
on t2.main_unit_id = t3.id
|
where
|
t1.del_flag = 0
|
and
|
t1.equipment_id=#{equipmentId}
|
</select>
|
</mapper>
|