<?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.yeejoin.amos.supervision.business.dao.mapper.HiddenDangerMapper">

    <select id="listByCondition" resultType="com.yeejoin.amos.supervision.business.dto.HiddenDangerDto">
        SELECT
            phd.*,
            ci.input_name as inputItemName,
            ci.user_name as checkUserName,
            ci.create_date as checkTime,
            c.point_name
        FROM `p_hidden_danger` phd
        left join  p_check_input ci on phd.check_input_id = ci.id
        left join  p_check c on c.id = phd.check_id
        <where>
            <if test="planId !=null and planId != ''">and phd.plan_id=#{planId}</if>
            <if test="pointId !=null and pointId != ''">and phd.point_id=#{pointId}</if>
        </where>
    </select>
</mapper>