Fixiaobai
2023-08-17 58f820f804046e7fe82bef5a7b428b442a728e8a
laboratory-server/src/main/resources/mapper/MeteringPlanMapper.xml
@@ -3,9 +3,31 @@
<mapper namespace="com.yuanchu.limslaboratory.mapper.MeteringPlanMapper">
    <select id="pagingQueryOfMeasurementLedger" resultType="map">
        SELECT i.`equipment_code`, i.`equipment_name`, i.`specifications_models`, m.`create_time`, m.`uncertainty`,
               m.`end_date`, i.`term_validity`, i.`storage_place`, i.`conditions`
        FROM instrument i, metrical_information m
        WHERE i.`id` = m.`instrument_id`
        SELECT
        i.`equipment_code` equipmentCode,
        i.`equipment_name` equipmentName,
        m.measurement_unit measurementUnit,
        i.measuring_range measuringRange,
        i.term_validity termValidity,
        m.result result,
        m.end_date endDate,
        u.NAME name ,
        m.`create_time` createTime,
        m.code code
        FROM
        metrical_information m
        LEFT JOIN `user` u ON u.id = m.user_id
        LEFT JOIN instrument i ON i.`id` = m.`instrument_id`
        WHERE 1=1
        and (m.state=1 and i.state=1)
        <if test="dto.code!=null and dto.code!=''">
         and    i.`equipment_code` like concat('%',#{dto.code},'%')
        </if>
        <if test="dto.name!=null and dto.name!=''">
          and   i.`equipment_name` like concat('%',#{dto.name},'%')
        </if>
        <if test="dto.name!=null and dto.name!=''">
          and   i.measurement_unit like concat('%',#{dto.unit},'%')
        </if>
    </select>
</mapper>