<?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.QualificationsFieldCategoryMapper">


    <resultMap id="categoryResultMap" type="jnpf.model.qualifications.vo.QualificationsCategoryVo">
        <result property="categoryId" column="categoryId" jdbcType="VARCHAR"/>
        <result property="categoryName" column="categoryName" jdbcType="VARCHAR"/>
        <result property="fieldName" column="fieldName" jdbcType="VARCHAR"/>
        <result property="itemNum" column="itemNum" jdbcType="INTEGER"/>
        <result property="fieldId" column="fieldId" jdbcType="VARCHAR"/>
    </resultMap>

    <select id="getQualificationsFieldPages"  resultType="jnpf.model.qualifications.vo.QualificationsCategoryVo">
        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 as fi
        left join ftb_qualifications_field_category as ca on ca.F_Id = fi.F_CategoryId
        where 1=1
        <if test="null != keyWord and '' != keyWord">
            and fi.F_Name like CONCAT('%', #{keyWord},'%')
        </if>
        <if test="null != categoryId and '' != categoryId">
            and ca.F_Id = #{categoryId}
        </if>
        group by categoryName,fi.F_Name
        order by fi.F_CategoryId,fi.F_LastModifyTime desc
    </select>

</mapper>