<?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.equipment.EquipmentStateChangeLogMapper">

    <select id="queryStateChangeLogList" resultType="com.casic.missiles.model.equipment.EquipmentStateChangeLog">
        SELECT
            escl.id,
            escl.apply_id,
            escl.equipment_id,
            escl.apply_person,
            su.`name` AS apply_person_name,
            escl.manager_state,
            DATE_FORMAT( escl.start_date, '%Y-%m-%d' ) AS start_date,
            DATE_FORMAT( escl.end_date, '%Y-%m-%d' ) AS end_date
        FROM
            equipment_state_change_log escl
                LEFT JOIN sys_user su ON escl.apply_person = su.id
        where escl.equipment_id = #{id}
    </select>

</mapper>
