Fixiaobai
2023-08-18 b71fbb924499a4f19988f0f34bec7e01078a1d64
laboratory-server/src/main/resources/mapper/MeteringPlanMapper.xml
@@ -19,15 +19,57 @@
        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)
        and (m.state=1 and i.state=1 and m.result is not null)
        <if test="dto.code!=null and dto.code!=''">
         and    i.`equipment_code` like concat('%',#{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},'%')
            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},'%')
            and i.measurement_unit like concat('%',#{dto.unit},'%')
        </if>
    </select>
    <select id="limitConditionMeteringPlan" resultMap="MeteringPlanAndInfoMap">
        SELECT p.id id,
        u.`name` createName,
        p.planned_order_number plannedOrderNumber,
        p.begin_time beginTime,
        p.end_time endTime,
        IF(IFNULL(i.result, 0) > 0, 1, 0) status,
        (SELECT name FROM `user` u WHERE p.measure_person = u.id) measureName,
        i.`code` iCode,
        p.create_time createTime
        FROM (SELECT id, measure_person, create_Person, begin_Time, end_Time, planned_order_number, create_time
        from metering_plan
        where 1=1
        <if test="dto.plannedOrderNumber!=null and dto.plannedOrderNumber!=''">
            and planned_order_number=#{plannedOrderNumber}
        </if>
        LIMIT #{limitPage.start},#{limitPage.end}) p
        LEFT JOIN metrical_information i ON p.id = i.plan
        LEFT JOIN `user` u ON p.create_Person = u.id
        where 1 = 1
    </select>
    <select id="getTotal" resultType="java.util.Map">
        select count(id) num from metering_plan where 1=1
        <if test="dto.plannedOrderNumber!=null and dto.plannedOrderNumber!=''">
            and planned_order_number=#{plannedOrderNumber}
        </if>
    </select>
    <resultMap id="MeteringPlanAndInfoMap" type="meteringPlanAndInfo">
        <result property="id" column="id"/>
        <result property="createPerson" column="createName"/>
        <result property="beginTime" column="beginTime"/>
        <result property="endTime" column="endTime"/>
        <result property="plannedOrderNumber" column="plannedOrderNumber"/>
        <result property="measurePerson" column="measureName"/>
        <result property="createTime" column="createTime"/>
        <collection property="resultList" ofType="MetricalInformation">
            <result property="code" column="iCode"/>
            <result property="result" column="status"/>
        </collection>
    </resultMap>
</mapper>