我正在参加「掘金·启航计划」
I DB 规范
MySQL 支持的类型大致可以分为:数值、日期/时间和字符串(字符)类型。
1.1 字段名类型
| 字段名 | 类型 | 备注 |
|---|---|---|
| id | bigint | 主键雪花ID |
| create_time | datetime | 创建时间 |
| create_id | bigint | 创建用户id |
| update_time | datetime | 修改时间 |
| update_id | bigint | 修改用户id |
| 数量类型 | int | |
| 金额类型 | decimal(10,2) 数据库存元 | |
| 枚举类型 | varchar(n) 大写 | |
| 布尔类型 | varchar(n) 是1否0 | |
| 字符串类型 | varchar(n) | |
| 费率 | decimal(10,4) 费率可能2个小数位以上要给4个小数位 |
alter table t_voucher_coupon
add create_time datetime null comment '创建时间';
alter table t_voucher_coupon
add update_time datetime null comment '更新时间';
alter table t_voucher_coupon
add create_id bigint null comment '创建用户id';
alter table t_voucher_coupon
add update_id bigint null comment '修改用户id';
alter table t_equipment_position add create_name varchar(100) null comment '创建人';
alter table t_equipment_position add update_name varchar(100) null comment '操作人';
TMapper.xml
<result column="create_name" property="createName" />
<result column="update_name" property="updateName" />
entity
@ApiModelProperty(value = "创建人")
@TableField("create_name")
private String createName;
@ApiModelProperty(value = "操作人")
@TableField("update_name")
private String updateName;
代理商信息
alter table t_voucher_merchant
add facilitator_id bigint not null comment '代理商id(直属)';
alter table t_voucher_merchant
add facilitator_name varchar(500) null comment '代理商名称(直属)';
alter table t_voucher_merchant
add facilitator_top_id bigint null comment '一级代理商id';
alter table t_voucher_merchant
add facilitator_top_name varchar(500) null comment '一级代理商名称';
1.2 字段命名
同一个字段在各个表做到统一
| XXX_no | XXX编号 |
| XXX_id | xxxid |
| company_id | 企业号 |
| merchant_id | 商户号 |
| merchant_code | 第三方商户号 |
| merchant_name | 商户名称 |
| facilitator_id | 代理商id(直属) |
| facilitator_name | 代理商名称(直属) |
| facilitator_top_id | 一级代理商id |
| facilitator_top_name | 一级代理商名称 |
| trade_no | 交易流水号 |
| trade_no3 | 三方交易流水号 |
| out_trade_no | 下游交易流水号 |
| office_id | 微信支付宝交易流水号 |
| sref_no | 参考号 |
| remark | 说明,备注 |
| tags_type | 对象类型(PT:平台,JG:机构,DLS:代理商,QY:企业,SH:商户) |
| terminal_code | 交易终端号 |
| state | 状态 |
| base_rate | 基础费率 |
| extra_rate | 附加费率 |
| base_fee | 基础手续费 |
| extra_fee | 附加手续费 |
| province | 省份id |
| province_name | 省份名称 |
1.3 表名模块前缀
| trans_ | 交易 |
| report_trans_ | 交易报表 |
| mer_ | 商户 |
| fac_ | 服务商 |
| risk_ | 风控 |
| sys_ | 系统 |
| policy_ | 政策 |
| tms_ | 终端 |
II 简单的excel 导入导出
用阿里的easyexcel
- 数据不多的话 直接导出就好了
- 数据多的情况才加到下载中心
easyexcel.opensource.alibaba.com/docs/curren…
列宽和列名
see also
-
MySQL数据类型:www.runoob.com/mysql/mysql…
-
微信代金券配置管理:pay.weixin.qq.com/wiki/doc/ap…