<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jdo PUBLIC
    "-//Sun Microsystems, Inc.//DTD Java Data Objects Metadata 2.0//EN"
    "http://java.sun.com/dtd/jdo_2_0.dtd">
<jdo>
    <package name="com.handysoft.beans.entity">
        <class
              name="HUserDept" table="moumi_user_dept_view2">
            <field
                  name="id"
                  persistence-modifier="persistent">
                    <column jdbc-type="CHAR"/>
            </field>
            <field
                  name="deptId"
                  persistence-modifier="persistent">
                    <column jdbc-type="CHAR" name="dept_id"/>
            </field>
            <field
                  name="name"
                  persistence-modifier="persistent"/>
            <field
                  name="partId"
                  persistence-modifier="persistent">
                    <column name="part_id" jdbc-type="CHAR"/>
            </field>
	        <extension vendor-name="datanucleus" key="view-definition" value="
	        CREATE VIEW moumi_user_dept_view2
	        (
	        	{this.id}, {this.deptId}, {this.name}, {this.partId}
	        ) AS
	        SELECT g.group_id || g.member_id AS id,
	            g.member_id AS dept_id,
                null AS name,
                '5' || g.group_id AS part_id
            FROM g_member g, usr_group u
            WHERE g.group_id=u.group_id
                AND u.application='S'
                AND type='1'
	        "/>
        </class>
        <class
              name="HUserUser" table="moumi_user_user_view2">
            <field
                  name="id"
                  persistence-modifier="persistent">
                    <column jdbc-type="CHAR"/>
            </field>
            <field
                  name="userId"
                  persistence-modifier="persistent">
                    <column jdbc-type="CHAR" name="user_id"/>
            </field>
            <field
                  name="name"
                  persistence-modifier="persistent"/>
            <field
                  name="deptId"
                  persistence-modifier="persistent">
                    <column name="dept_id" jdbc-type="CHAR"/>
            </field>
            <field
                  name="partId"
                  persistence-modifier="persistent">
                    <column name="part_id" jdbc-type="CHAR"/>
            </field>
	        <extension vendor-name="datanucleus" key="view-definition" value="
	        CREATE VIEW moumi_user_user_view2
	        (
	        	{this.id}, {this.userId}, {this.name}, {this.deptId}, {this.partId}
	        ) AS
	        SELECT g.group_id || g.member_id AS id,
	            g.member_id AS user_id,
                null AS name,
                (SELECT dept_id FROM usr_global WHERE user_id=g.member_id) AS dept_id,
                '5' || g.group_id AS part_id
            FROM g_member g,
                usr_group u
            WHERE g.group_id=u.group_id
                AND u.application='M'
                AND type='0'
	        "/>
        </class>
        <class
              name="HDept" table="moumi_dept_view">
            <field
                  name="id"
                  persistence-modifier="persistent">
                    <column jdbc-type="CHAR"/>
            </field>
            <field
                  name="name"
                  persistence-modifier="persistent">
                    <column name="dept_name"/>
            </field>
            <field
                  name="address1"
                  persistence-modifier="persistent">
                    <column name="addr1"/>
            </field>
            <field
                  name="address2"
                  persistence-modifier="persistent">
                    <column name="addr2"/>
            </field>
            <field
                  name="passcode"
                  persistence-modifier="persistent"/>
            <field
                  name="priority"
                  persistence-modifier="persistent"/>
            <field
                  name="upperDept"
                  persistence-modifier="persistent">
                    <column name="upper_dept" jdbc-type="CHAR"/>
            </field>
            <field
                  name="isAccUnit"
                  persistence-modifier="persistent">
                    <column name="is_acc_unit" jdbc-type="NUMERIC"/>
            </field>
            <field
                  name="isDocUnit"
                  persistence-modifier="persistent">
                    <column name="is_doc_unit" jdbc-type="NUMERIC"/>
            </field>
            <field
                  name="repDept"
                  persistence-modifier="persistent">
                    <column name="rep_dept_id" jdbc-type="CHAR"/>
            </field>
	        <extension vendor-name="datanucleus" key="view-definition" value="
	        CREATE VIEW moumi_dept_view
	        (
	        	{this.id}, {this.name}, {this.address1}, {this.address2}, {this.passcode}, {this.priority},
	        	{this.upperDept}, {this.isAccUnit}, {this.isDocUnit}, {this.repDept}
	        ) AS
	        SELECT dept_id AS ID,
                dept_name AS dept_name,
                address AS addr1,
                address2 AS addr2,
                dept_code AS passcode,
                seq AS priority,
                par_id AS upper_dept,
                DECODE(recv_box_f,1,1,0) AS is_acc_unit,
                DECODE(box_f,1,1,0) AS is_doc_unit,
                par_id AS rep_dept_id
            FROM dept_global
	        "/>
        </class>
        <class
              name="HUserPart" table="moumi_user_part_view">ssh exchange@192.168.0.39 -p 30022
            <field
                  name="id"
                  persistence-modifier="persistent">
                    <column jdbc-type="CHAR"/>
            </field>
            <field
                  name="name"
                  persistence-modifier="persistent"/>
            <field
                  name="userId"
                  persistence-modifier="persistent">
                    <column name="user_id" jdbc-type="CHAR"/>
            </field>
            <field
                  name="regDate"
                  persistence-modifier="persistent">
                    <column name="reg_date"/>
            </field>
            <field
                  name="des"
                  persistence-modifier="persistent"/>
	        <extension vendor-name="datanucleus" key="view-definition" value="
	        CREATE VIEW moumi_user_part_view
	        (
	        	{this.id}, {this.name}, {this.userId}, {this.regDate}, {this.des}
	        ) AS
	        SELECT '5' || group_id AS id,
                name,
                user_id,
                sysdate AS reg_date,
                NULL AS des
            FROM usr_group
            WHERE application IN ('M','S')
	        "/>
        </class>
        <class
              name="HUser" table="moumi_user_view">
            <field
                  name="moumiId"
                  persistence-modifier="persistent">
                    <column name="moumiid"/>
            </field>
            <field
                  name="password"
                  persistence-modifier="persistent">
                    <column name="passwd"/>
            </field>
            <field
                  name="name"
                  persistence-modifier="persistent">
                    <column name="user_name"/>
            </field>
            <field
                  name="email"
                  persistence-modifier="persistent"/>
            <field
                  name="phone"
                  persistence-modifier="persistent"/>
            <field
                  name="isDeleted"
                  persistence-modifier="persistent">
                    <column name="del_type" jdbc-type="NUMERIC"/>
            </field>
            <field
                  name="mDept"
                  persistence-modifier="persistent">
                    <column name="dept_id" jdbc-type="CHAR"/>
            </field>
            <field
                  name="priority"
                  persistence-modifier="persistent"/>
            <field
                  name="dutyName"
                  persistence-modifier="persistent">
                    <column name="duty_name"/>
            </field>
            <field
                  name="id"
                  persistence-modifier="persistent">
                    <column name="handy_id" jdbc-type="CHAR"/>
            </field>
            <field
                  name="empCode"
                  persistence-modifier="persistent">
                    <column name="emp_code"/>
            </field>
	        <extension vendor-name="datanucleus" key="view-definition" value="
	        CREATE VIEW moumi_user_view
	        (
	        	{this.moumiId}, {this.id}, {this.password}, {this.name}, {this.email}, {this.phone},
	        	{this.isDeleted}, {this.mDept}, {this.priority}, {this.dutyName}, {this.empCode}
	        ) AS
	        SELECT
                NULL AS moumiID,
                login_passwd AS passwd,
                name AS user_name,
                e_mail AS email,
                phone AS phone,
                DECODE(status,4,1,0) AS del_type,
                dept_id AS dept_id,
                seq AS priority,
                pos_name AS duty_name,
                user_id AS handy_id,
                emp_code
            FROM usr_global A,
                pos B
            WHERE A.pos_id=B.pos_id
	        "/>
        </class>
        <class
              name="HDocUnit" table="moumi_docunit_view">
            <field
                  name="userId"
                  persistence-modifier="persistent">
                    <column name="user_id" jdbc-type="CHAR"/>
            </field>
            <field
                  name="relId"
                  persistence-modifier="persistent">
                    <column name="rel_id" jdbc-type="CHAR"/>
            </field>
	        <extension vendor-name="datanucleus" key="view-definition" value="
	        CREATE VIEW moumi_docunit_view
	        (
	        	{this.userId}, {this.relId}
	        ) AS
	        SELECT user_id,rel_id FROM usr_auth WHERE auth='D1'
	        "/>
        </class>
    </package>
</jdo>