<?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.jeeplus.business.project.mapper.JyProjectEiaQualificationMapper">
    <select id="findById" resultType="com.jeeplus.business.project.service.dto.JyProjectEiaQualificationDTO">
        select
            id,
            project_id,
            status,
            remarks,
            proc_ins_id,
            process_definition_id
        from jy_project_eia_qualification
        where id=#{id}
    </select>

    <select id="findDtos" resultType="com.jeeplus.sys.service.dto.WorkAttachmentInfoDTO">
        select
            wa.id,
			wa.url,
			wa.attachment_name AS `name`,
			wa.create_by_id AS `by`,
			wa.create_time,
			peqf.file_type as jyFileType
		from
		    work_attachment wa
		left join  jy_project_eia_qualification_file peqf on wa.id = peqf.work_attachment_id
		where
		    wa.del_flag = 0
			AND wa.attachment_id = #{id}
    </select>

    <select id="getFileListByAttachmentAndModuleType" resultType="com.jeeplus.sys.service.dto.WorkAttachmentInfoDTO">
        select
        wa.id,
        wa.url,
        wa.attachment_name AS `name`,
        wa.create_by_id AS `createBy.id`,
        su.name AS `createBy.name`,
        wa.create_time,
        wa.type as "type",
        wa.attachment_id as "attachmentId",
        wa.attachment_name as "attachmentName",
        wa.attachment_flag as "attachmentFlag",
        wa.module_type as "moduleType",
        wa.attachment_type as "attachmentType",
        wa.file_size as "fileSize",
        wa.sort as "sort",
        wa.description as "description"
        from
        work_attachment wa
        left join sys_user su on su.id = wa.create_by_id
        <where>
            wa.del_flag = 0
            AND wa.attachment_id = #{attachmentId}
            AND wa.module_type = #{moduleType}
        </where>
    </select>






</mapper>