<?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.contract.datamodel.Contract" table="xyst_dinas_contract_master" 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"></column>
        </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"></column>
        </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"></column>
        </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"></column>
        </property>
        <property name="discard" type="boolean" not-null="false">
            <column name="discard"></column>
        </property>
        <property name="del" type="boolean" not-null="false">
            <column name="del"></column>
        </property>
        <property name="approveState" type="integer" not-null="false">
            <column name="approve_state"></column>
        </property>
        
        <property name="contractId" type="uuid-binary" not-null="false">
            <column name="contract_id" length="16"></column>
        </property>
		<many-to-one name="project" entity-name="com.xyst.dinas.project.datamodel.ProjectFiled" fetch="select">
            <column name="project_id"  not-null="false"/>
        </many-to-one>
		<property name="projectCode" type="nstring" not-null="false">
			<column name="project_code" length="50"></column>
		</property>
		<many-to-one name="regionCompany" entity-name="com.xyst.dinas.biz.datamodel.Organization" fetch="select">
            <column name="region_company_id"  not-null="false"/>
        </many-to-one>
		<property name="regionCompanyName" type="nstring" not-null="false">
			<column name="region_company_name" length="50"></column>
		</property>
		<many-to-one name="purchaseSandUnit" entity-name="com.xyst.dinas.project.datamodel.PurchaseSandCompany" fetch="select">
            <column name="purchase_sand_unit_id"  not-null="false"/>
        </many-to-one>
		<property name="purchaseSandUnitName" type="nstring" not-null="false">
			<column name="purchase_sand_unit_name" length="50"></column>
		</property>
		<property name="contractName" type="nstring" not-null="false">
			<column name="contract_name" length="50"></column>
		</property>
		<property name="contractCode" type="nstring" not-null="false">
			<column name="contract_code" length="50"></column>
		</property>
		<property name="currentVersion" type="integer" not-null="false">
			<column name="current_version" length="11"></column>
		</property>
		<property name="contractState" type="nstring" not-null="false">
			<column name="contract_state" length="50"></column>
		</property>
		
		
		<property name="addrReceive" type="nstring" not-null="false">
			<column name="addr_receive" length="100"></column>
		</property>
	  	<property name="addrLongitude" type="big_decimal" not-null="false">
            <column name="addr_longitude" precision="10" scale="7"></column>
        </property>
	  	<property name="addrLatitude" type="big_decimal" not-null="false">
            <column name="addr_latitude" precision="10" scale="7"></column>
        </property>
		<property name="contacts" type="nstring" not-null="false">
			<column name="contacts" length="50"></column>
		</property>
		<property name="phoneNumber" type="nstring" not-null="false">
			<column name="phone_number" length="50"></column>
		</property>
		<property name="signDate" type="date" not-null="false">
			<column name="sign_date" length="50"></column>
		</property>
		<property name="startDate" type="date" not-null="false">
			<column name="start_date" length="50"></column>
		</property>
		<property name="endDate" type="date" not-null="false">
			<column name="end_date" length="50"></column>
		</property>
		<property name="payAccount" type="nstring" not-null="false">
			<column name="pay_account" length="100"></column>
		</property>
	  	<property name="deposit" type="big_decimal" not-null="false">
            <column name="deposit" precision="10" scale="2"></column>
        </property>
	  	<property name="amount" type="big_decimal" not-null="false">
            <column name="amount" precision="10" scale="2"></column>
        </property>
		<property name="carInfo" type="nstring" not-null="false">
			<column name="car_info" length="300"></column>
		</property>
		<property name="memo" type="nstring" not-null="false">
			<column name="memo" length="500"></column>
		</property>
		<many-to-one name="station" entity-name="com.xyst.dinas.biz.datamodel.Station" fetch="select">
            <column name="station_id"  not-null="false"/>
        </many-to-one>
		<property name="contractVersion" type="integer" not-null="false">
			<column name="contract_version" length="11"></column>
		</property>
		<property name="valid" type="boolean" not-null="false">
			<column name="valid" length="1"></column>
		</property>
		
		
		

	</class>
	
	<class entity-name="com.xyst.dinas.contract.datamodel.Contract$ContractDetail" table="xyst_dinas_contract_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="master" entity-name="com.xyst.dinas.contract.datamodel.Contract" fetch="select">
			<column name="master_id"  not-null="false"/>
		</many-to-one>
        <property name="contractId" type="uuid-binary" not-null="false">
            <column name="contract_id" length="16"></column>
        </property>
        <many-to-one name="dinasType" entity-name="com.xyst.dinas.biz.datamodel.DinasType" fetch="select">
            <column name="dinas_type_id"  not-null="false"/>
        </many-to-one>
        <property name="purchaseAmount" type="big_decimal" not-null="false">
            <column name="purchase_amount" precision="10" scale="2"></column>
        </property>
        <property name="price" type="big_decimal" not-null="false">
            <column name="price" precision="10" scale="2"></column>
        </property>
        <property name="amount" type="big_decimal" not-null="false">
            <column name="amount" precision="10" scale="2"></column>
        </property>
        
        
	</class>
</hibernate-mapping>