-- 商户经营账号（一商户一套，多店共用）
CREATE TABLE IF NOT EXISTS `biz_merchant_account` (
  `account_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '账号ID',
  `merchant_id` bigint(20) NOT NULL COMMENT '商户ID',
  `login_name` varchar(20) NOT NULL COMMENT '登录名',
  `admin_name` varchar(64) NOT NULL COMMENT '管理员姓名',
  `password` varchar(100) NOT NULL COMMENT '密码',
  `del_flag` char(1) NOT NULL DEFAULT '0',
  `create_by` varchar(64) DEFAULT '',
  `create_time` datetime DEFAULT NULL,
  `update_by` varchar(64) DEFAULT '',
  `update_time` datetime DEFAULT NULL,
  PRIMARY KEY (`account_id`),
  KEY `idx_merchant_id` (`merchant_id`,`del_flag`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='商户经营账号';

-- 店铺
CREATE TABLE IF NOT EXISTS `biz_shop` (
  `shop_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '店铺ID',
  `merchant_id` bigint(20) NOT NULL COMMENT '商户ID',
  `shop_name` varchar(128) NOT NULL COMMENT '店铺名称',
  `shop_avatar` varchar(512) NOT NULL COMMENT '店铺头像',
  `shop_status` char(1) NOT NULL DEFAULT '0' COMMENT '0开业1停业',
  `shop_desc` varchar(1000) DEFAULT NULL COMMENT '店铺描述',
  `shop_phone` varchar(20) NOT NULL COMMENT '商家电话',
  `del_flag` char(1) NOT NULL DEFAULT '0',
  `create_by` varchar(64) DEFAULT '',
  `create_time` datetime DEFAULT NULL,
  `update_by` varchar(64) DEFAULT '',
  `update_time` datetime DEFAULT NULL,
  `remark` varchar(500) DEFAULT NULL,
  PRIMARY KEY (`shop_id`),
  KEY `idx_merchant_id` (`merchant_id`,`del_flag`),
  KEY `idx_shop_status` (`shop_status`,`del_flag`),
  KEY `idx_create_time` (`create_time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='店铺';
