<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd" >
<mapper namespace="com.pcloud.book.keywords.mapper.TempRobotSkillDao">
    <resultMap id="BaseResultMap" type="tempRobotSkill">
        <id column="id" jdbcType="INTEGER" property="id" />
        <result column="type" jdbcType="INTEGER" property="type" />
        <result column="key_word" jdbcType="VARCHAR" property="keyWord" />
        <result column="guide_word" jdbcType="VARCHAR" property="guideWord" />
        <result column="depth_id" jdbcType="INTEGER" property="depthId" />
        <result column="depth_label" jdbcType="VARCHAR" property="depthLabel" />
        <result column="resource_type" jdbcType="VARCHAR" property="resourceType" />
        <result column="text" jdbcType="VARCHAR" property="text" />
        <result column="img_url" jdbcType="VARCHAR" property="imgUrl" />
        <result column="product_id" jdbcType="INTEGER" property="productId" />
        <result column="file_url" jdbcType="VARCHAR" property="fileUrl" />
        <result column="file_name" jdbcType="VARCHAR" property="fileName" />
        <result column="group_id" jdbcType="VARCHAR" property="groupId" />
        <result column="group_name" jdbcType="VARCHAR" property="groupName" />
        <result column="reply_content" jdbcType="VARCHAR" property="replyContent" />
    </resultMap>

    <sql id="Base_Column_List">
        id, type, key_word, guide_word, depth_id, depth_label, resource_type, text, img_url,
        product_id, file_url, file_name, group_id, group_name, reply_content
    </sql>

    <select id="getById" resultMap="BaseResultMap">
        SELECT
        <include refid="Base_Column_List" />
        FROM temp_robot_skill
        WHERE id = #{id}
    </select>

    <select id="getTempRobotSkillListByType" resultMap="BaseResultMap">
        SELECT
        <include refid="Base_Column_List" />
        FROM temp_robot_skill
        WHERE type = #{type}
    </select>

    <select id="getTempRobotSkillListByKeyword" resultMap="BaseResultMap">
        SELECT
        <include refid="Base_Column_List" />
        FROM temp_robot_skill
        WHERE type = #{type}
        and key_word = #{keyword}
    </select>

    <select id="getTempRobotSkillListByLabelId" resultMap="BaseResultMap">
        SELECT
        <include refid="Base_Column_List" />
        FROM temp_robot_skill
        WHERE type = #{type}
        and depth_id = #{labelId}
    </select>

    <select id="getLabelListByType" resultType="LabelVO">
        SELECT
        depth_id labelId, depth_label labelName
        FROM temp_robot_skill
        WHERE type = #{type}
        group by depth_id
    </select>

</mapper>