<?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.goomood.phm.mapper.KGraphEntityMapper">
    <resultMap type="com.goomood.phm.domain.KGraphEntity" id="ResultDataModel">
        <result property="id" column="id"/>
        <result property="clauseId" column="clause_id"/>
        <result property="headEntity" column="head_entity"/>
        <result property="headEntityClass" column="head_entity_class"/>
        <result property="relation" column="relation"/>
        <result property="tailEntity" column="tail_entity"/>
        <result property="tailEntity" column="tail_entity_class"/>
        <result property="status" column="status"/>
        <result property="remark" column="remark"/>
        <result property="createBy" column="create_by"/>
        <result property="createTime" column="create_time"/>
        <result property="updateBy" column="update_by"/>
        <result property="updateTime" column="update_time"/>
    </resultMap>

    <select id="selectListByTaskId" resultMap="ResultDataModel">
        SELECT
            e.head_entity,
            e.head_entity_class,
            e.relation,
            e.tail_entity,
            e.tail_entity_class
        FROM
            als_k_graph_entity_t e
                JOIN
            als_k_graph_clause_t c ON e.clause_id = c.id
        WHERE
            c.task_id = #{taskId}
          AND c.status = 1
    </select>
</mapper>