Skip to content

Commit

Permalink
add a demo store
Browse files Browse the repository at this point in the history
  • Loading branch information
kala888 committed May 10, 2024
1 parent a89b49e commit 2d67517
Show file tree
Hide file tree
Showing 7 changed files with 282 additions and 0 deletions.
36 changes: 36 additions & 0 deletions models/demo-store/account_book.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<root brief="账本">

<!-- 测试: menu, 测试actions -->
<account_book label="账本" menu="账户管理">
<!-- 测试: number -->
<balance label="余额" type="Money" required="true"/>
<!--测试: 1对多: transaction_list,-->
<!-- Composition意思就是账户记录在账本中管理,会在detail页面增加相应的ui-->
<!--测试: 1对多,同时定义多的一方的属性名称 合法写法 -->
<!-- 1. transaction_record[]:多的一方使用默认的属性名和中文-->
<!-- 2. transaction_record.book(关联账本)[] :定义多的一方的属性名和中文-->
<!-- 3. transaction_record.book[]:定义多的一方的属性名-->
<!-- 4. transaction_record(关联账本)[]:定义多的一方的中文-->
<transaction_list label="交易记录" ref="transaction_record(关联账本)[]" associationType='Composition'/>
<!-- 测试: long-text-->
<brief label="备注" lenght="100"/>
</account_book>


<!-- 测试: menu=false和 readonly,disableController -->
<transaction_record label="账户记录" readonly="true" menu="false"
disableController="true"
>
<!-- 测试: field level enum -->
<direction label="变动类型" values="increase(增加)|decrease(减少)|reconcile(调账)" required="true" index="money"/>
<amount label="变动金额" type="Money" required="true" index="money"/>
<balance label="余额" type="Money" required="true"/>
<brief label="备注" type="long-text"/>
<source_obj label="备注" type="Clob"
brief="可以存关联对象的JSON String"
hideInTable="true"
hideInSearch="true"
hideInForm="true"
/>
</transaction_record>
</root>
31 changes: 31 additions & 0 deletions models/demo-store/course.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<root brief="店铺历程,演示模型继承">
<!-- 1. 定义type: 历程类型 -->
<course_type label="历程类型" type="enum">
<create label="创建历程"/>
<update label="修改历程"/>
<other label="其他记录"/>
</course_type>

<!-- 2. 定义主对象 -->
<course_record label="历程信息">
<course_type label="历程类型" ref="course_type" subType="true"/>
<title label="历程记录" type="long-text" length="500"/>
<file_attachment label="文档附件" type="fileList" hideInTable="true"/>
</course_record>

<!-- 3. 子对象 -->
<create_record label="创建历程" extends="course_record.create" menu="false" disableController="true">
<title label="申请原因" type="long-text" length="500"/>
</create_record>

<update_record label="改进记录" extends="course_record.update" menu="false" disableController="true">
<approve_pass label="是否通过" type="boolean"/>
<title label="改进基建" type="long-text" length="500"/>
</update_record>

<other_record label="其他记录" extends="course_record.other" menu="false" disableController="true">
<title label="自定义类型" type="long-text" length="500" group="自定义信息"/>
<brief label="补充说明" type="long-text" length="500" group="自定义信息"/>
</other_record>
</root>

73 changes: 73 additions & 0 deletions models/demo-store/data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<!-- 定义说明参照 ./README.md -->
<root brief="基础数据">

<base type="data" bref="基础数据">
<!-- 创建平台和平台账户-->
<account_book id="1" balance="10000"/>
<merchant id="1"
name="如是嘉木"
top_brand="true"
work_time="周一 ~ 周五;早10点 ~ 晚6点"
brief="如是嘉木是一家专业的茶叶店铺,主要经营茶叶、茶具、茶器等茶叶相关产品。"
contact_mobile="13880964614"
contact_email="[email protected]"
account_book="1"
store_status="OPEN"
/>

<!-- 产品单位 -->
<product_unit id="1" name="" code="liang"/>
<product_unit id="2" name="" code="g"/>
<product_unit id="3" name="千克" code="kg"/>
<product_unit id="4" name="" code="piece"/>
<product_unit id="5" name="" code="can"/>
<product_unit id="6" name="" code="set"/>
<product_unit id="7" name="" code="box"/>
<product_unit id="8" name="" code="bag"/>
<product_unit id="9" name="" code="item"/>

</base>

<base type="data" bref="测试数据">
<!-- 测试店铺 -->
<product_tag id="1" name="礼品茶"/>
<product_tag id="2" name="产地茶"/>
<product_tag id="3" name="自营"/>

<product_category id="1" name="品鉴"/>
<product_category id="2" name="口粮"/>

<product id="1"
name="黄金芽"
list_price="100.00"
sale_price="88.88"
instock="10"
unit="1"
product_type="GREENTEA"
category="1"
total_view="200"
/>
<product id="2"
name="黄金甘露"
list_price="299.00"
sale_price="166.00"
instock="1000"
unit="1"
product_type="GREENTEA"
category="1"
total_view="128"
/>
<product id="3"
name="祁门红茶"
list_price="29.00"
sale_price="20.00"
instock="1000"
unit="2"
product_type="BLACKTEA"
category="2"
total_view="10"
/>

</base>

</root>
18 changes: 18 additions & 0 deletions models/demo-store/index.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!-- 定义说明参照 ./README.md -->
<root name="teastore"
org="tiandtech"
label="小茶铺"
brief="Tea World"
logo="logo.svg"
slogan="Get your tea"
>
<import file="account_book.xml"/>
<import file="course.xml"/>
<import file="data.xml"/>
<import file="merchant.xml"/>
<import file="product.xml"/>
<import file="screen.xml"/>

<!--这里为了简单,假设平台就是商店,非SAAS,所以只有一个merchant就行-->

</root>
53 changes: 53 additions & 0 deletions models/demo-store/merchant.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<root brief="客户管理">
<!--entity level enum 测试-->
<customer_type label="客户类型" type="enum">
<Direct label="直客"/>
<Sales label="渠道"/>
<Chanel label="渠道客户"/>
</customer_type>

<store_status label="店铺状态" type="enum" values="open(营业)|closed(打烊)"/>

<!--建立一个平台对象,一般只有一条数据,用来记录平台相关数据,例如平台账本-->
<merchant label="茶铺" lineActions="开门|打烊" insertable="false">

<name label="店铺名称" required="true" brief="小茶铺"/>
<logo label="Logo" type="image"/>
<top_brand label="金牌店铺" type="boolean" searchable="true"/>
<work_time label="营业时间"/>

<!--测试: group-->
<contact_mobile label="联系电话" type="mobile" group="联系方式" rule="required"/>
<contact_email label="Email" type="email" group="联系方式"/>

<!--测试: rich-text-->
<brief label="店铺介绍" type="long-text" lenght="200" searchable="true" queryType="like"/>
<!--测试: 测试日期-->
<available_date label="开业日期" type="date"/>

<store_status label="店铺状态" ref="store_status"/>

<account_book label="账本" ref="account_book"/>

</merchant>


<!-- 拓展系统用户 -->
<customer_user label="客户" actions="充值|调账|对账单">
<!-- 测试: 拓展系统对象-->
<sys_user label="系统用户"
type="com.tiandtech.system.domain.SysUser"
customQuery="com.tiandtech.system.mapper.SysUserMapper.selectById"
/>
<!-- 测试: length-->
<user_type label="客户类型" ref="customer_type" required="true"/>
<name label="客户名称" lenght="20"/>
<uid label="身份证" type="uid"/>
<!-- 测试: int,min, max -->
<age label="年龄" type="int" min="18"/>
<!-- 测试: 修改OOTB属性 -->
<create_time type="date-time" searchable="true" queryType="between" hideInDescriptions="false"/>
<!-- 测试: 关系1:1-->
<account_book label="账本" ref="account_book"/>
</customer_user>
</root>
63 changes: 63 additions & 0 deletions models/demo-store/product.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<root brief="产品">

<product_type label="产品分类" type="enum">
<green_tea label="绿茶"/>
<black_tea label="红茶"/>
<dark_tea label="黑茶"/>
<white_tea label="白茶"/>
<oolong_tea label="乌龙茶"/>
<puer_tea label="普洱茶"/>
<fflower_tea label="花茶"/>
<container label="器皿"/>
<package label="包装"/>
<accessories label="配件"/>
<service label="服务"/>
<other label="其他"/>
</product_type>

<product_unit label="单位">
<name label="单位名称"/>
<code label="编码"/>
<brief label="描述"/>
</product_unit>

<product_category label="产品目录" menu="产品管理">
<name label="分类名称"/>
<!-- 测试: date-time和dateTime-->
<start_time label="开始时间" type="date-time"/>
<end_time label="开始时间" type="dateTime"/>
</product_category>

<product_tag label="产品标签" menu="产品管理">
<name label="产品标签"/>
<brief label="标签描述"/>
</product_tag>

<product label="产品" feature="+IE" menu="产品管理">
<name label="产品名称" required="true" index="true"/>
<brief label="产品简介" type="rich-text"/>
<product_type label="产品分类" ref="product_type" index="true"/>
<image_list label="产品图册" type="image-list" lenght="9" brief="9图"/>
<approve_video label="宣传视频" type="video"/>

<!--测试: 最大,最小,required,between-->
<list_price label="市场价" type="number" min="1" required="true" searchable="true" queryType="between" group="价格"/>
<sale_price label="销售价" type="number" min="1" max="999999" group="价格"/>

<instock label="库存数量" type="number" group="库存"/>
<unit label="单位" ref="product_unit" group="库存"/>

<display_order label="排序" type="number"/>
<category label="目录" ref="product_category"/>

<total_view label="浏览量" type="int" editable="false"/>
<total_hot_point label="热度" type="int" dynamic="true"/>
</product>

<!--测试: 多对多,忽略中间对象-->

<product_tag_relationship label="产品和产品标签" type="ManyToMany">
<product_entities label="产品ID" ref="product.tagList(标签)"/>
<tag_entities label="标签" ref="product_tag.productList(产品列表)"/>
</product_tag_relationship>
</root>
8 changes: 8 additions & 0 deletions models/demo-store/screen.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<root brief="screen 工作台和数据大屏定义">
<dashboard type="screen" label="工作台" >
<slot1 label="店铺数量" condition="count from merchant as card"/>
<slot2 label="产品数量" condition="count from product as card"/>
<slot3 label="店铺状态" condition="count from merchant group by store_status as pie"/>
<slot4 label="产品统计" condition="count from product group by product_type as bar"/>
</dashboard>
</root>

0 comments on commit 2d67517

Please sign in to comment.