117 lines
2.1 KiB
JavaScript

// Cube.js 数据模型 - 店铺信息
// 基于 fys_shopInfo 表
cube(`Shops`, {
sql: `SELECT * FROM rpt.fys_shopInfo`,
measures: {
count: {
sql: `Id`,
type: `count`,
},
totalMargin: {
sql: `shopMargin`,
type: `sum`,
format: `currency`,
title: `总保证金`,
},
totalServiceFee: {
sql: `shopServiceFee`,
type: `sum`,
format: `currency`,
title: `总服务费`,
},
totalAmount: {
sql: `totalAmount`,
type: `sum`,
format: `currency`,
title: `收款合计`,
},
},
dimensions: {
id: {
sql: `Id`,
type: `number`,
primaryKey: true,
},
shopName: {
sql: `shopName`,
type: `string`,
title: `店铺名称`,
},
erpShopName: {
sql: `erpShopName`,
type: `string`,
title: `ERP店铺名称`,
},
platform: {
sql: `platform`,
type: `string`,
title: `平台`,
},
responsibleDepartment: {
sql: `responsibleDepartment`,
type: `string`,
title: `所属利润中心`,
},
shopHead: {
sql: `shopHead`,
type: `string`,
title: `店铺负责人`,
},
shopType: {
sql: `shopType`,
type: `string`,
title: `店铺类型`,
},
mainCategory: {
sql: `mainCategory`,
type: `string`,
title: `主营类目`,
},
channelType: {
sql: `channelType`,
type: `string`,
title: `渠道模式`,
},
shopState: {
sql: `CASE
WHEN shopState = 0 THEN '正常'
WHEN shopState = 1 THEN '开店中'
WHEN shopState = 2 THEN '变更中'
WHEN shopState = 3 THEN '已出售'
WHEN shopState = 4 THEN '出售中'
WHEN shopState = 5 THEN '关闭中'
WHEN shopState = 6 THEN '已关闭'
ELSE '未知' END`,
type: `string`,
title: `店铺状态`,
},
openTime: {
sql: `openTime`,
type: `time`,
title: `开店时间`,
},
createTime: {
sql: `createTime`,
type: `time`,
title: `创建时间`,
},
},
});