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

    <select id="queryAllDetailList" resultType="com.rongwei.bsentity.domain.EquLubricationPlanDetailVo">
        SELECT
            a.*,
            b.EQUIPMENT,
            b.EQUIPMENTNUMBER,
            b.BELONGFACTORY
        FROM equ_lubrication_plan_detail a
        LEFT JOIN equ_lubrication_plan 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.MODIFYDATE DESC,a.MODIFYDATE DESC
    </select>

</mapper>
