<?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.srm.bpm.infra.dao.ToaFormDao">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.srm.bpm.infra.entity.ToaFormEntity">
        <result column="id" property="id" />
        <result column="version" property="version" />
        <result column="creation_time" property="creationTime" />
        <result column="update_time" property="updateTime" />
        <result column="is_deleted" property="isDeleted" />
        <result column="code" property="code" />
        <result column="name" property="name" />
        <result column="icon" property="icon" />
        <result column="process_id" property="processId" />
        <result column="layout" property="layout" />
        <result column="style" property="style" />
        <result column="table_name_" property="tableName" />
        <result column="description" property="description" />
        <result column="documentation" property="documentation" />
        <result column="process_flag" property="processFlag" />
        <result column="client_app_flag" property="clientAppFlag" />
        <result column="data_scope_flag" property="dataScopeFlag" />
        <result column="detail_field_flag" property="detailFieldFlag" />
        <result column="sort" property="sort" />
        <result column="bloc_code" property="blocCode" />
    </resultMap>
    <select id="selectByBillId" resultType="com.srm.bpm.infra.entity.ToaFormEntity">
        SELECT tf.id, tf.icon, tf.code, tf.name, tf.process_flag, tf.process_id, tf.table_name_,
               tf.sort, tf.detail_field_flag
        FROM toa_form tf
                 JOIN toa_bill tb ON tb.process_id = tf.process_id
        WHERE tf.is_deleted = 0 AND tb.id = #{billId}
    </select>

</mapper>
