<?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="jnpf.qualifications.mapper.QualificationsFieldMapper">


    <resultMap id="itemResultMap" type="jnpf.model.qualifications.vo.QualificationsItemsVo">
        <result column="categoryId" property="categoryId" javaType="java.lang.String"/>
        <result column="fieldId" property="fieldId" javaType="java.lang.String"/>
        <result column="categoryName" property="categoryName" javaType="java.lang.String"/>
        <result column="fieldName" property="fieldName" javaType="java.lang.String"/>
        <collection property="qualificationsFieldItemList" ofType="jnpf.entity.qualifications.QualificationsFieldItem"
                    select="jnpf.qualifications.mapper.QualificationsFieldMapper.getItems"
                    column="fieldId">
        </collection>
    </resultMap>

    <select id ="getQualificationsFieldItem" resultMap="itemResultMap">
        select ca.F_Id as categoryId ,ca.F_Name as categoryName ,fi.F_Name as fieldName,fi.F_ItemNum as itemNum ,fi.F_Id as fieldId
        from ftb_qualifications_field_category as ca
        right join ftb_qualifications_field as fi on ca.F_Id = fi.F_CategoryId
        where fi.F_Id = #{fieldId}
    </select>

    <select id="getItems" resultType="jnpf.entity.qualifications.QualificationsFieldItem">
        select fi.F_Id as id, fi.F_Name as name,fi.F_FieldId  as fieldId,fi.F_Description as description,fi.F_PropertyJson as propertyJson
        from ftb_qualifications_field_item fi
        where fi.F_FieldId  = #{fieldId}
    </select>

</mapper>