<?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.EquipmentUseLogMapper">

    <select id="queryUseLogList" resultType="com.casic.missiles.model.equipment.EquipmentUseLog">
        SELECT
            eul.id,
            eul.apply_id,
            eul.equipment_id,
            eul.use_dept,
            sd.full_name AS use_dept_name,
            eul.use_person,
            su.`name` AS use_person_name,
            eul.use_type,
            DATE_FORMAT( eul.start_date, '%Y-%m-%d' ) AS start_date,
            DATE_FORMAT( eul.end_date, '%Y-%m-%d' ) AS end_date
        FROM
            equipment_use_log eul
                LEFT JOIN sys_dept sd ON eul.use_dept = sd.id
                LEFT JOIN sys_user su ON eul.use_person = su.id
        where eul.equipment_id = #{id}
    </select>

</mapper>
