1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389
| CREATE TABLE wi.p_asset_record ( `id` VARCHAR ( 50 ) NOT NULL COMMENT '主键UUID', `member_id` VARCHAR ( 50 ) DEFAULT NULL COMMENT '会员ID', `card_no` VARCHAR ( 50 ) DEFAULT NULL COMMENT '卡号(用于会员),打印小票(用于普通顾客)', `order_code` VARCHAR ( 50 ) DEFAULT NULL COMMENT '订单编码', `shop_id` VARCHAR ( 50 ) DEFAULT NULL COMMENT '门店ID', `ref_member_id` VARCHAR ( 50 ) DEFAULT NULL COMMENT '引用会员ID', `create_time` datetime NOT NULL COMMENT '创建时间', `flow_type` TINYINT ( 4 ) DEFAULT NULL COMMENT '流水类型: 1-卡资产流水 2: 托管单流水', `merchant_id` VARCHAR ( 50 ) DEFAULT NULL COMMENT '商户ID', `merchant_name` VARCHAR ( 200 ) DEFAULT NULL COMMENT '商户名称', `shop_code` VARCHAR ( 50 ) DEFAULT NULL COMMENT '门店编码', `shop_name` VARCHAR ( 200 ) DEFAULT NULL COMMENT '门店名称', `member_name` VARCHAR ( 200 ) DEFAULT NULL COMMENT '会员姓名', `id_number` VARCHAR ( 100 ) DEFAULT NULL COMMENT '会员身份证', `mobile_number` VARCHAR ( 50 ) DEFAULT NULL COMMENT '会员手机号', `member_level` VARCHAR ( 50 ) DEFAULT NULL COMMENT '会员等级', `member_level_name` VARCHAR ( 50 ) DEFAULT NULL COMMENT '会员等级名称', `member_type` TINYINT ( 4 ) DEFAULT NULL COMMENT '会员类别 0-会员 1-非会员', `biz_code` VARCHAR ( 50 ) DEFAULT NULL COMMENT '业务编码', `amount` DECIMAL ( 15, 2 ) DEFAULT NULL COMMENT '数额', `amount2` DECIMAL ( 15, 2 ) DEFAULT NULL COMMENT '数额2', `asset_id` VARCHAR ( 50 ) DEFAULT NULL COMMENT '资产ID', `asset_type` TINYINT ( 4 ) DEFAULT NULL COMMENT '资产类型:0查游戏币,1查彩票,2查银票卡,3查游戏券, 4押金', `change_flag` TINYINT ( 4 ) DEFAULT NULL COMMENT '资产变化:0: 增加可用资产, 1: 减少可用资产, 2:增加冻结资产, 3:减少冻结资产', `param1` VARCHAR ( 200 ) DEFAULT NULL COMMENT '参数1', `param2` VARCHAR ( 200 ) DEFAULT NULL COMMENT '参数2', `param3` VARCHAR ( 200 ) DEFAULT NULL COMMENT '参数3', `parent_asset_id` VARCHAR ( 50 ) DEFAULT NULL COMMENT '主资产id', `creator_id` VARCHAR ( 50 ) DEFAULT NULL COMMENT '创建人ID', `creator_name` VARCHAR ( 200 ) DEFAULT NULL COMMENT '创建人名称', `create_pos_id` VARCHAR ( 50 ) DEFAULT NULL COMMENT '创建机台ID', `create_pos_name` VARCHAR ( 200 ) DEFAULT NULL COMMENT '创建机台名称', `cashier_type` TINYINT ( 4 ) DEFAULT NULL COMMENT '收银台类型:0.收银台,1.兑奖台,2.一体机,3.取币机,4.存币机', `machine_id` VARCHAR ( 50 ) DEFAULT NULL COMMENT '机台类型ID', `machine_category_id` VARCHAR ( 50 ) DEFAULT NULL COMMENT '机台分类ID', `machine_category_name` VARCHAR ( 50 ) DEFAULT NULL COMMENT '机台分类名称', `machine_name` VARCHAR ( 50 ) DEFAULT NULL COMMENT '机台类型名称', `machine_instance_id` VARCHAR ( 50 ) DEFAULT NULL COMMENT '机台实例ID', `machine_instance_name` VARCHAR ( 50 ) DEFAULT NULL COMMENT '机台实例名称', `machine_instance_slot_id` VARCHAR ( 50 ) DEFAULT NULL COMMENT '投币口ID', `device_id` VARCHAR ( 50 ) DEFAULT NULL COMMENT '刷卡器ID', `device_name` VARCHAR ( 50 ) DEFAULT NULL COMMENT '刷卡器名称', `record_status` TINYINT ( 4 ) DEFAULT NULL COMMENT '流水状态:0:正常,1:异常', `record_seq` INT ( 11 ) DEFAULT NULL COMMENT '同一操作产生的多条流水的流水序号', `remark` VARCHAR ( 5000 ) DEFAULT NULL COMMENT '备注', `machine_instance_slot_no` INT ( 11 ) DEFAULT NULL COMMENT '机台投币口序号', `source_type` INT ( 11 ) DEFAULT '0' COMMENT '数据来源:0-saas,1-迁移', `ref_asset_id` VARCHAR ( 50 ) DEFAULT NULL COMMENT '关联ID', `ref_asset_type` INT ( 11 ) DEFAULT NULL COMMENT '关联类型 (1 SVIP赠送)', `business_model` VARCHAR ( 50 ) DEFAULT NULL COMMENT '机台营业模式', `item_drop_type` VARCHAR ( 50 ) DEFAULT NULL COMMENT '物品掉落类型 none:无 coin:游戏币 lottery:飞豆 gift:礼品' , INDEX `idx_asset_record_2`(`member_id`) using BITMAP COMMENT 'member_id', INDEX `idx_asset_record_3` (`card_no`) using BITMAP COMMENT 'member_id', INDEX `idx_asset_record_4` (`order_code`) using BITMAP COMMENT 'member_id', INDEX `idx_asset_record_6` (`ref_member_id`) using BITMAP COMMENT 'member_id', INDEX `idx_asset_record_7` (`create_time`) using BITMAP COMMENT 'member_id', ) ENGINE = olap UNIQUE KEY ( `id`, `member_id`, `card_no`, `order_code`, `shop_id`, `ref_member_id`, `create_time` ) rollup ((`shop_id`,`create_time`)) PARTITION BY RANGE ( `create_time` ) ( PARTITION `p201701` VALUES LESS THAN ( "2017-02-01 00:00:00" ), PARTITION `p201702` VALUES LESS THAN ( "2017-03-01 00:00:00" ), PARTITION `p201703` VALUES LESS THAN ( "2017-04-01 00:00:00" ), PARTITION `p201704` VALUES LESS THAN ( "2017-05-01 00:00:00" ), PARTITION `p201705` VALUES LESS THAN ( "2017-06-01 00:00:00" ), PARTITION `p201706` VALUES LESS THAN ( "2017-07-01 00:00:00" ), PARTITION `p201707` VALUES LESS THAN ( "2017-08-01 00:00:00" ), PARTITION `p201708` VALUES LESS THAN ( "2017-09-01 00:00:00" ), PARTITION `p201709` VALUES LESS THAN ( "2017-10-01 00:00:00" ), PARTITION `p201710` VALUES LESS THAN ( "2017-11-01 00:00:00" ), PARTITION `p201711` VALUES LESS THAN ( "2017-12-01 00:00:00" ), PARTITION `p201712` VALUES LESS THAN ( "2018-01-01 00:00:00" ), PARTITION `p201801` VALUES LESS THAN ( "2018-02-01 00:00:00" ), PARTITION `p201802` VALUES LESS THAN ( "2018-03-01 00:00:00" ), PARTITION `p201803` VALUES LESS THAN ( "2018-04-01 00:00:00" ), PARTITION `p201804` VALUES LESS THAN ( "2018-05-01 00:00:00" ), PARTITION `p201805` VALUES LESS THAN ( "2018-06-01 00:00:00" ), PARTITION `p201806` VALUES LESS THAN ( "2018-07-01 00:00:00" ), PARTITION `p201807` VALUES LESS THAN ( "2018-08-01 00:00:00" ), PARTITION `p201808` VALUES LESS THAN ( "2018-09-01 00:00:00" ), PARTITION `p201809` VALUES LESS THAN ( "2018-10-01 00:00:00" ), PARTITION `p201810` VALUES LESS THAN ( "2018-11-01 00:00:00" ), PARTITION `p201811` VALUES LESS THAN ( "2018-12-01 00:00:00" ), PARTITION `p201812` VALUES LESS THAN ( "2019-01-01 00:00:00" ), PARTITION `p201901` VALUES LESS THAN ( "2019-02-01 00:00:00" ), PARTITION `p201902` VALUES LESS THAN ( "2019-03-01 00:00:00" ), PARTITION `p201903` VALUES LESS THAN ( "2019-04-01 00:00:00" ), PARTITION `p201904` VALUES LESS THAN ( "2019-05-01 00:00:00" ), PARTITION `p201905` VALUES LESS THAN ( "2019-06-01 00:00:00" ), PARTITION `p201906` VALUES LESS THAN ( "2019-07-01 00:00:00" ), PARTITION `p201907` VALUES LESS THAN ( "2019-08-01 00:00:00" ), PARTITION `p201908` VALUES LESS THAN ( "2019-09-01 00:00:00" ), PARTITION `p201909` VALUES LESS THAN ( "2019-10-01 00:00:00" ), PARTITION `p201910` VALUES LESS THAN ( "2019-11-01 00:00:00" ), PARTITION `p201911` VALUES LESS THAN ( "2019-12-01 00:00:00" ), PARTITION `p201912` VALUES LESS THAN ( "2020-01-01 00:00:00" ), PARTITION `p202001` VALUES LESS THAN ( "2020-02-01 00:00:00" ), PARTITION `p202002` VALUES LESS THAN ( "2020-03-01 00:00:00" ), PARTITION `p202003` VALUES LESS THAN ( "2020-04-01 00:00:00" ), PARTITION `p202004` VALUES LESS THAN ( "2020-05-01 00:00:00" ), PARTITION `p202005` VALUES LESS THAN ( "2020-06-01 00:00:00" ), PARTITION `p202006` VALUES LESS THAN ( "2020-07-01 00:00:00" ), PARTITION `p202007` VALUES LESS THAN ( "2020-08-01 00:00:00" ), PARTITION `p202008` VALUES LESS THAN ( "2020-09-01 00:00:00" ), PARTITION `p202009` VALUES LESS THAN ( "2020-10-01 00:00:00" ), PARTITION `p202010` VALUES LESS THAN ( "2020-11-01 00:00:00" ), PARTITION `p202011` VALUES LESS THAN ( "2020-12-01 00:00:00" ), PARTITION `p202012` VALUES LESS THAN ( "2021-01-01 00:00:00" ), PARTITION `p202101` VALUES LESS THAN ( "2021-02-01 00:00:00" ), PARTITION `p202102` VALUES LESS THAN ( "2021-03-01 00:00:00" ), PARTITION `p202103` VALUES LESS THAN ( "2021-04-01 00:00:00" ), PARTITION `p202104` VALUES LESS THAN ( "2021-05-01 00:00:00" ), PARTITION `p202105` VALUES LESS THAN ( "2021-06-01 00:00:00" ), PARTITION `p202106` VALUES LESS THAN ( "2021-07-01 00:00:00" ), PARTITION `p202107` VALUES LESS THAN ( "2021-08-01 00:00:00" ), PARTITION `p202108` VALUES LESS THAN ( "2021-09-01 00:00:00" ), PARTITION `p202109` VALUES LESS THAN ( "2021-10-01 00:00:00" ), PARTITION `p202110` VALUES LESS THAN ( "2021-11-01 00:00:00" ), PARTITION `p202111` VALUES LESS THAN ( "2021-12-01 00:00:00" ), PARTITION `p202112` VALUES LESS THAN ( "2022-01-01 00:00:00" ), PARTITION `p202201` VALUES LESS THAN ( "2022-02-01 00:00:00" ), PARTITION `p202202` VALUES LESS THAN ( "2022-03-01 00:00:00" ), PARTITION `p202203` VALUES LESS THAN ( "2022-04-01 00:00:00" ), PARTITION `p202204` VALUES LESS THAN ( "2022-05-01 00:00:00" ), PARTITION `p202205` VALUES LESS THAN ( "2022-06-01 00:00:00" ), PARTITION `p202206` VALUES LESS THAN ( "2022-07-01 00:00:00" ), PARTITION `p202207` VALUES LESS THAN ( "2022-08-01 00:00:00" ), PARTITION `p202208` VALUES LESS THAN ( "2022-09-01 00:00:00" ), PARTITION `p202209` VALUES LESS THAN ( "2022-10-01 00:00:00" ), PARTITION `p202210` VALUES LESS THAN ( "2022-11-01 00:00:00" ), PARTITION `p202211` VALUES LESS THAN ( "2022-12-01 00:00:00" ), PARTITION `p202212` VALUES LESS THAN ( "2023-01-01 00:00:00" ), PARTITION `p202301` VALUES LESS THAN ( "2023-02-01 00:00:00" ), PARTITION `p202302` VALUES LESS THAN ( "2023-03-01 00:00:00" ), PARTITION `p202303` VALUES LESS THAN ( "2023-04-01 00:00:00" ), PARTITION `p202304` VALUES LESS THAN ( "2023-05-01 00:00:00" ), PARTITION `p202305` VALUES LESS THAN ( "2023-06-01 00:00:00" ), PARTITION `p202306` VALUES LESS THAN ( "2023-07-01 00:00:00" ), PARTITION `p202307` VALUES LESS THAN ( "2023-08-01 00:00:00" ), PARTITION `p202308` VALUES LESS THAN ( "2023-09-01 00:00:00" ), PARTITION `p202309` VALUES LESS THAN ( "2023-10-01 00:00:00" ), PARTITION `p202310` VALUES LESS THAN ( "2023-11-01 00:00:00" ), PARTITION `p202311` VALUES LESS THAN ( "2023-12-01 00:00:00" ), PARTITION `p202312` VALUES LESS THAN ( "2024-01-01 00:00:00" ), PARTITION `p202401` VALUES LESS THAN ( "2024-02-01 00:00:00" ), PARTITION `p202402` VALUES LESS THAN ( "2024-03-01 00:00:00" ), PARTITION `p202403` VALUES LESS THAN ( "2024-04-01 00:00:00" ), PARTITION `p202404` VALUES LESS THAN ( "2024-05-01 00:00:00" ), PARTITION `p202405` VALUES LESS THAN ( "2024-06-01 00:00:00" ), PARTITION `p202406` VALUES LESS THAN ( "2024-07-01 00:00:00" ), PARTITION `p202407` VALUES LESS THAN ( "2024-08-01 00:00:00" ), PARTITION `p202408` VALUES LESS THAN ( "2024-09-01 00:00:00" ), PARTITION `p202409` VALUES LESS THAN ( "2024-10-01 00:00:00" ), PARTITION `p202410` VALUES LESS THAN ( "2024-11-01 00:00:00" ), PARTITION `p202411` VALUES LESS THAN ( "2024-12-01 00:00:00" ), PARTITION `p202412` VALUES LESS THAN ( "2025-01-01 00:00:00" ), PARTITION `p202501` VALUES LESS THAN ( "2025-02-01 00:00:00" ), PARTITION `p202502` VALUES LESS THAN ( "2025-03-01 00:00:00" ), PARTITION `p202503` VALUES LESS THAN ( "2025-04-01 00:00:00" ), PARTITION `p202504` VALUES LESS THAN ( "2025-05-01 00:00:00" ), PARTITION `p202505` VALUES LESS THAN ( "2025-06-01 00:00:00" ), PARTITION `p202506` VALUES LESS THAN ( "2025-07-01 00:00:00" ), PARTITION `p202507` VALUES LESS THAN ( "2025-08-01 00:00:00" ), PARTITION `p202508` VALUES LESS THAN ( "2025-09-01 00:00:00" ), PARTITION `p202509` VALUES LESS THAN ( "2025-10-01 00:00:00" ), PARTITION `p202510` VALUES LESS THAN ( "2025-11-01 00:00:00" ), PARTITION `p202511` VALUES LESS THAN ( "2025-12-01 00:00:00" ), PARTITION `p202512` VALUES LESS THAN ( "2026-01-01 00:00:00" ) ) DISTRIBUTED BY HASH ( `id`, `member_id`, `card_no`, `order_code`, `shop_id`, `ref_member_id` ) BUCKETS 32 PROPERTIES ( "replication_num" = "1", "storage_type" = "column" );
|