<?xml version="1.0" encoding="UTF-8"?>
<hibernate-mapping xmlns="http://www.hibernate.org/xsd/hibernate-mapping"
                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                   xsi:schemaLocation="http://www.hibernate.org/xsd/hibernate-mapping
		http://www.hibernate.org/xsd/hibernate-mapping/hibernate-mapping-4.0.xsd">
    <class entity-name="com.xyst.dinas.safe.datamodel.SafeLog" table="xyst_dinas_safe_safe_log" optimistic-lock="version">
        <tuplizer entity-mode="dynamic-map" class="com.beecode.bcp.store.hibernate.KObjectEntityTuplizer" />
        <id name="id" type="uuid-binary" column="id" length="16">
            <generator class="assigned" />
        </id>
        <version name="version" type="int" column="version"/>
        <property name="createTime" type="timestamp" not-null="false">
            <column name="create_time"/>
        </property>
        <many-to-one name="creator" entity-name="com.beecode.bap.staff.datamodel.Staff" fetch="select">
            <column name="creator_id"  not-null="false"/>
        </many-to-one>
        <property name="modifyTime" type="timestamp" not-null="false">
            <column name="modify_time"/>
        </property>
        <many-to-one name="modifier" entity-name="com.beecode.bap.staff.datamodel.Staff" fetch="select">
            <column name="modifier_id"  not-null="false"/>
        </many-to-one>
        <property name="billState" type="nstring" not-null="false">
            <column name="bill_state" length="100"/>
        </property>
        <many-to-one name="bizProcess" entity-name="com.beecode.bap.workflow.datamodel.BizProcess" fetch="select">
            <column name="biz_process_id"  not-null="false"/>
        </many-to-one>
        <property name="billCode" type="nstring" not-null="false">
            <column name="bill_code" length="200"/>
        </property>
        <property name="discard" type="boolean" not-null="false">
            <column name="discard"/>
        </property>
        <property name="del" type="boolean" not-null="false">
            <column name="del"/>
        </property>
        <property name="approveState" type="integer" not-null="false">
            <column name="approve_state"/>
        </property>

        <many-to-one name="regionalCompany" entity-name="com.xyst.dinas.biz.datamodel.xystOrganization" fetch="select">
            <column name="regional_company"  not-null="false">
                <comment>所属组织机构</comment>
            </column>
        </many-to-one>


        <property name="checkDate" type="timestamp" not-null="true">
            <column name="check_date">
                <comment>检查日期</comment>
            </column>
        </property>

        <property name="checkDateWeather" type="nstring" not-null="false">
            <column name="check_date_weather" length="20">
                <comment>检查日期天气</comment>
            </column>
        </property>

        <property name="checkArea" type="nstring" not-null="false">
            <column name="check_area" length="20">
                <comment>检查区域</comment>
            </column>
        </property>

        <property name="checkContent" type="nstring" not-null="false">
            <column name="check_content" length="500">
                <comment>检查内容</comment>
            </column>
        </property>
        <property name="checkItem" type="nstring" not-null="false">
            <column name="check_item" length="500">
                <comment>检查项</comment>
            </column>
        </property>

        <property name="checkFindings" type="nstring" not-null="false">
            <column name="check_findings" length="500">
                <comment>检查结论</comment>
            </column>
        </property>


        <property name="failureReason" type="nstring" not-null="false">
            <column name="failure_reason" length="500">
                <comment>不通过原因</comment>
            </column>
        </property>

        <many-to-one name="approver" entity-name="com.beecode.bap.staff.datamodel.Staff" fetch="select">
            <column name="approver_id"  not-null="false">
                <comment>审批人</comment>
            </column>
        </many-to-one>

        <property name="applyStatus" type="int" not-null="false">
            <column name="apply_status" length="1">
                <comment>审批状态</comment>
            </column>
        </property>

        <property name="approvalTime" type="timestamp" not-null="false">
            <column name="approval_time">
                <comment>审批时间</comment>
            </column>
        </property>

        <bag name="StaffDetails" lazy="true" fetch="select" inverse="true">
            <key column="master_id" not-null="true" />
            <one-to-many entity-name="com.xyst.dinas.safe.datamodel.SafeLogAssociatedStaffDetail" />
        </bag>
    </class>

    <class entity-name="com.xyst.dinas.safe.datamodel.SafeLogAssociatedStaffDetail" table="xyst_dinas_safe_log_staff_detail" >
        <tuplizer entity-mode="dynamic-map" class="com.beecode.bcp.store.hibernate.KObjectEntityTuplizer" />
        <id name="id" type="uuid-binary" column="id" length="16">
            <generator class="assigned" />
        </id>

        <many-to-one name="staff" entity-name="com.beecode.bap.staff.datamodel.Staff" fetch="select">
            <column name="staff_id" not-null="true">
                <comment>检查人员</comment>
            </column>
        </many-to-one>
        <many-to-one name="master" entity-name="com.xyst.dinas.safe.datamodel.SafeLog" fetch="select">
            <column name="master_id" not-null="true">
                <comment>所属的安全日志id</comment>
            </column>
        </many-to-one>
    </class>

</hibernate-mapping>