<?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.rongwei.bscommon.sys.dao.EquLubricationTaskDetailMapperDao">

    <select id="queryAllTaskDetailList" resultType="com.rongwei.bsentity.domain.EquLubricationTaskDetailVo">
        SELECT
            a.*,
            b.EQUIPMENT,
            b.EQUIPMENTWORKSHOP,
            b.EQUIPMENTNUMBER,
            b.BELONGFACTORY,
            b.COMPLETEDATE
        FROM equ_lubrication_task_detail a
        LEFT JOIN equ_lubrication_task_management b ON a.MASTERID = b.id and b.DELETED = 0
        where a.DELETED = 0
        <if test="tenantId != null and tenantId != ''"> and b.TENANTID = #{tenantId}</if>
        ORDER BY b.TASKNUMBER DESC,b.MODIFYDATE DESC,a.MODIFYDATE DESC
    </select>

</mapper>
