<?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="net.ferrum.business.mapper.QsProjectAttributesMapper">

    <resultMap type="net.ferrum.business.domain.QsProjectAttributes" id="QsProjectAttributesResult">
        <result property="id" column="id"/>
        <result property="projectId" column="project_id"/>
        <result property="typeId" column="type_id"/>
        <result property="valueId" column="value_id"/>
        <result property="createBy" column="create_by"/>
        <result property="createTime" column="create_time"/>
        <result property="updateBy" column="update_by"/>
        <result property="updateTime" column="update_time"/>
        <result property="remark" column="remark"/>
        <result property="delFlag" column="del_flag"/>
    </resultMap>

    <select id="selectProjSpecInfoList" resultType="net.ferrum.business.domain.vo.QsProjectAttributesVo">
        select qpa.id,qpa.project_id,qpa.type_id,qpa.value_id,qpa.remark, qsav.value as value
        from qs_project_attributes qpa
        left join qs_spec_attribute_values qsav on qpa.type_id = qsav.type_id and qpa.value_id = qsav.value_id
            ${ew.getCustomSqlSegment}
        order by qpa.type_id, qpa.value_id
    </select>

    <delete id="deleteByProjectId" parameterType="java.lang.Long">
        DELETE FROM qs_project_attributes
        WHERE project_id = #{projectId}
    </delete>

</mapper>
