<?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.ruoyi.zdsz.mapper.ZEngiineeringPhotoMapper">

    <resultMap type="com.ruoyi.zdsz.domain.ZEngiineeringPhoto" id="ZEngiineeringPhotoResult">
        <result property="id" column="id"/>
        <result property="parentId" column="parent_id"/>
        <result property="picUrl" column="pic_url"/>
        <result property="remark" column="remark"/>
        <result property="delFlag" column="del_flag"/>
        <result property="createBy" column="create_by"/>
        <result property="createTime" column="create_time"/>
        <result property="updateBy" column="update_by"/>
        <result property="updateTime" column="update_time"/>
    </resultMap>


    <delete id="deleteByUrl" parameterType="String">
        delete from g_emergency_repair_photo where
        pic_url in
        <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
            #{item}
        </foreach>
    </delete>

    <update id="deleteByUrls" parameterType="String">
        UPDATE z_engiineering_photo
        SET del_flag = '2'
        WHERE pic_url = #{url}

    </update>

    <select id="getlist" resultType="java.util.Map">
        select id,parent_id as parentId,pic_url as url ,del_flag as delFlag,create_by as creatBy,create_time as createTime from z_engiineering_photo where del_flag = '0' and parent_id = #{id}
    </select>

    <select id="getObjInfo" resultType="java.util.Map">
        SELECT
            IF(ISNULL(zepj.engin_name),IF(ISNULL(zei.engin_name),IF(ISNULL(zed.engin_name),IF(ISNULL(zein.engin_name),'-',zein.engin_name),zed.engin_name),zei.engin_name),zepj.engin_name) AS engin_name,
            IF(ISNULL(zepj.engin_name),IF(ISNULL(zei.engin_name),IF(ISNULL(zed.engin_name),IF(ISNULL(zein.engin_name),'-',IF(zein.type = '1','工业工程','市政工程')),'危险工程'),'基建工程'),'顶管工程') AS type
        FROM z_engineering_node_2024_05 ze
                 LEFT JOIN z_engineering_pipe_jacking zepj ON zepj.id = ze.civli_id
                 LEFT JOIN z_engineering_infrastructure zei ON zei.id = ze.civli_id
                 LEFT JOIN z_engineering_dangerous zed ON zed.id = ze.civli_id
                 LEFT JOIN z_engineering_industry zein ON zein.id = ze.civli_id
        WHERE ze.id = #{nodeId}
    </select>

</mapper>
