XiaoRuby
2023-08-30 730443b70de88d328ffa275f51f69280fda979e4
laboratory-server/src/main/resources/mapper/InstrumentMapper.xml
@@ -1,25 +1,52 @@
<?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="com.yuanchu.limslaboratory.mapper.InstrumentMapper">
    <select id="getListInstrumentInformation" resultType="map">
        SELECT i.`id`, i.`equipment_code`, i.`equipment_name`, i.`specifications_models`, u.`name`,
               DATE_FORMAT(DATE_ADD(i.`create_time`, INTERVAL i.`term_validity` MONTH), '%Y-%m-%d') termValidity, i.`conditions`, i.`storage_place`
        DATE_FORMAT(DATE_ADD(i.`create_time`, INTERVAL i.`term_validity` MONTH), '%Y-%m-%d') termValidity,
        i.`conditions`, i.`storage_place`
        FROM instrument i, `user` u
        WHERE i.`state` = 1
          AND i.`classify_id` = #{classifyId}
        AND i.`classify_id` = #{classifyId}
        <if test="conditions != null">
            AND i.`conditions` = #{conditions}
        </if>
        <if test="numberOrNameOrSpecifications != null and numberOrNameOrSpecifications != ''">
            AND CONCAT(i.`equipment_code`, i.`equipment_name`, i.`specifications_models`) LIKE CONCAT('%',#{numberOrNameOrSpecifications},'%')
            AND CONCAT(i.`equipment_code`, i.`equipment_name`, i.`specifications_models`) LIKE
            CONCAT('%',#{numberOrNameOrSpecifications},'%')
        </if>
        <if test="whetherWhether == true">
            AND DATE_FORMAT(DATE_ADD(i.`create_time`, INTERVAL i.`term_validity` MONTH), '%Y-%m-%d') <![CDATA[<]]> NOW()
        </if>
        AND i.`user_id` = u.`id`
    </select>
    <select id="selectInstrument" resultType="Map">
        select id,equipment_name from lims_laboratory.instrument
    <!--选择设备-->
    <resultMap id="chooseinstumMap" type="map">
        <id property="id" column="cid"/>
        <result property="name" column="father_name"/>
        <collection property="children" resultMap="chooseinstumTowMap" javaType="List"/>
    </resultMap>
    <resultMap id="chooseinstumTowMap" type="map">
        <id property="id" column="cid"/>
        <result property="name" column="son_name"/>
        <collection property="children" resultMap="chooseinstumTowsMap" javaType="List"/>
    </resultMap>
    <resultMap id="chooseinstumTowsMap" type="map">
        <id property="id" column="id"/>
        <result property="name" column="name"/>
    </resultMap>
    <select id="chooseinstum" resultMap="chooseinstumMap">
        select c.id cid,
            instrument.id,
               father_name ,
               son_name ,
               equipment_name name
        from lims_laboratory.instrument
                 left join lims_laboratory.classify c on c.id = instrument.classify_id
        where conditions in(1,5)
    </select>
    <select id="getInstrument" resultType="com.yuanchu.limslaboratory.pojo.Instrument">
        select id,equipment_name name from instrument  where 1=1  and state=1 and conditions=5
    </select>
</mapper>