<?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.casic.missiles.mapper.business.BusinessLabExecutiveOperateLogMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.casic.missiles.model.business.BusinessLabExecutiveOperateLog">
        <id column="id" property="id" />
        <result column="order_id" property="orderId" />
        <result column="sample_id" property="sampleId" />
        <result column="measure_dept_id" property="measureDeptId" />
        <result column="measure_person_id" property="measurePersonId" />
        <result column="measure_status" property="measureStatus" />
        <result column="create_time" property="createTime" />
        <result column="update_time" property="updateTime" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, order_id, sample_id, measure_dept_id, measure_person_id, measure_status, create_time, update_time
    </sql>

    <select id="selectExecutiveOperateLogList" resultType="com.casic.missiles.dto.business.labExecutive.MeasureSendBackDTO">
        SELECT bleoi.measure_dept_id AS measureSegmentId, sd.SIMPLE_NAME AS measureSegment, bleoi.operate_person_id AS sendBackPersonId,
        bleoi.operate_person_name AS sendBackPerson, bleoi.operate_reason AS sendBackReason, bleoi.create_time AS sendBackTime
        FROM business_lab_executive_operate_log bleoi
        JOIN sys_dept sd ON bleoi.measure_dept_id = sd.ID
        WHERE measure_status = 4
        AND bleoi.order_id = #{orderId}
        AND bleoi.sample_id = #{sampleId}
        ORDER BY bleoi.create_time ASC
    </select>
</mapper>
