<?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.ag.log.mapper.TopicRespMapper">

    <resultMap id="BaseResultMap" type="com.ag.log.TopicResp">
            <id property="id" column="ID" jdbcType="VARCHAR"/>
            <result property="topicName" column="TOPIC_NAME" jdbcType="VARCHAR"/>
            <result property="topicParentName" column="TOPIC_PARENT_NAME" jdbcType="VARCHAR"/>
            <result property="topicParentId" column="TOPIC_PARENT_ID" jdbcType="VARCHAR"/>
            <result property="topicDescribe" column="TOPIC_DESCRIBE" jdbcType="VARCHAR"/>
            <result property="createdBy" column="CREATED_BY" jdbcType="VARCHAR"/>
            <result property="createdOn" column="CREATED_ON" jdbcType="TIMESTAMP"/>
            <result property="updatedBy" column="UPDATED_BY" jdbcType="VARCHAR"/>
            <result property="updatedOn" column="UPDATED_ON" jdbcType="TIMESTAMP"/>
    </resultMap>

    <sql id="Base_Column_List">
        ID,TOPIC_NAME,TOPIC_PARENT_NAME,
        TOPIC_PARENT_ID,TOPIC_DESCRIBE,CREATED_BY,
        CREATED_ON,UPDATED_BY,UPDATED_ON
    </sql>

    <delete id="deleteAllByParentId" parameterType="String">
        DELETE FROM  TOPIC_RESP WHERE ID IN ( select id from (select id from topic_resp where FIND_IN_SET(Id,getTopicChild(#{id,jdbcType=VARCHAR}))) as a)
    </delete>
</mapper>
