-- https://www.phpmyadmin.net/
--
-- 服务器版本： 10.1.26-MariaDB

START TRANSACTION;



--
-- Database: `tju`
--

-- --------------------------------------------------------

--
-- 表的结构 `auth_group`
--

CREATE TABLE `auth_group` (
  `id` bigint(20) NOT NULL,
  `name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- --------------------------------------------------------

--
-- 表的结构 `auth_privilege`
--

CREATE TABLE `auth_privilege` (
  `id` bigint(20) NOT NULL,
  `name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- --------------------------------------------------------

--
-- 表的结构 `auth_role`
--

CREATE TABLE `auth_role` (
  `id` bigint(20) NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- 转存表中的数据 `auth_role`
--

INSERT INTO `auth_role` (`id`, `name`) VALUES
(1, 'ROLE_ADMIN'),
(2, 'ROLE_USER');

-- --------------------------------------------------------

--
-- 表的结构 `auth_r_group_role`
--

CREATE TABLE `auth_r_group_role` (
  `group_id` bigint(20) NOT NULL,
  `role_id` bigint(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- --------------------------------------------------------

--
-- 表的结构 `auth_r_role_privilege`
--

CREATE TABLE `auth_r_role_privilege` (
  `role_id` bigint(20) NOT NULL,
  `privilege_id` bigint(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- --------------------------------------------------------

--
-- 表的结构 `auth_r_user_group`
--

CREATE TABLE `auth_r_user_group` (
  `group_id` bigint(20) NOT NULL,
  `user_id` bigint(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- 表的结构 `auth_r_user_role`
--

CREATE TABLE `auth_r_user_role` (
  `user_id` int(11) NOT NULL,
  `role_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- 转存表中的数据 `auth_r_user_role`
--

INSERT INTO `auth_r_user_role` (`user_id`, `role_id`) VALUES
(2, 2);

-- --------------------------------------------------------

--
-- 表的结构 `base_address`
--

CREATE TABLE `base_address` (
  `id` bigint(20) NOT NULL,
  `detail` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `latitude` double DEFAULT NULL,
  `longitude` double DEFAULT NULL,
  `street` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `street_number` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `unit` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `zipcode` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `city_id` bigint(20) DEFAULT NULL,
  `country_id` bigint(20) DEFAULT NULL,
  `district_id` bigint(20) DEFAULT NULL,
  `province_id` bigint(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- --------------------------------------------------------

--
-- 表的结构 `base_dict`
--

CREATE TABLE `base_dict` (
  `id` bigint(20) NOT NULL,
  `code` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `next` bigint(20) DEFAULT NULL,
  `number` bigint(20) DEFAULT NULL,
  `parent_id` bigint(20) DEFAULT NULL,
  `prefix` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `type` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- --------------------------------------------------------

--
-- 表的结构 `base_dict_value`
--

CREATE TABLE `base_dict_value` (
  `id` bigint(20) NOT NULL,
  `language` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `type` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `value` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `dict_id` bigint(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- --------------------------------------------------------

--
-- 表的结构 `hero`
--

CREATE TABLE `hero` (
  `id` bigint(20) NOT NULL,
  `name` varchar(255) NOT NULL,
  `gender` varchar(10) DEFAULT NULL,
  `description` varchar(255) DEFAULT NULL,
  `owner_id` bigint(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- 转存表中的数据 `hero`
--

INSERT INTO `hero` (`id`, `name`, `gender`, `description`, `owner_id`) VALUES
(1, 'The Monkey King', 'MALE', NULL, 1),
(2, 'Harry Potter', 'MALE', NULL, 2);

-- --------------------------------------------------------

--
-- 表的结构 `hero_user`
--

CREATE TABLE `hero_user` (
  `id` bigint(20) NOT NULL,
  `name` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- 转存表中的数据 `hero_user`
--

INSERT INTO `hero_user` (`id`, `name`) VALUES
(1, 'Tang Monk'),
(2, 'administrator');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `auth_group`
--
ALTER TABLE `auth_group`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `auth_privilege`
--
ALTER TABLE `auth_privilege`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `auth_role`
--
ALTER TABLE `auth_role`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `auth_r_group_role`
--
ALTER TABLE `auth_r_group_role`
  ADD PRIMARY KEY (`role_id`,`group_id`),
  ADD KEY `FK_jvrlo8i8ua3go76n38f5o12nv` (`group_id`);

--
-- Indexes for table `auth_r_role_privilege`
--
ALTER TABLE `auth_r_role_privilege`
  ADD PRIMARY KEY (`privilege_id`,`role_id`),
  ADD KEY `FK_chdye2i40ooa9d1da4y5oonkf` (`role_id`);

--
-- Indexes for table `auth_r_user_group`
--
ALTER TABLE `auth_r_user_group`
  ADD PRIMARY KEY (`user_id`,`group_id`),
  ADD KEY `FK_b0er90n2gocljr8pm4n200oh7` (`group_id`);

--
-- Indexes for table `auth_r_user_role`
--
ALTER TABLE `auth_r_user_role`
  ADD PRIMARY KEY (`user_id`,`role_id`);

--
-- Indexes for table `base_address`
--
ALTER TABLE `base_address`
  ADD PRIMARY KEY (`id`),
  ADD KEY `FK_ockr1c55y1erai6hkmgebfywu` (`city_id`),
  ADD KEY `FK_6k0ksos5xkpjlav13151k79nb` (`country_id`),
  ADD KEY `FK_ac11cn2swwhj9mse8kinu8s0h` (`district_id`),
  ADD KEY `FK_te3ne9gcpjyrikkpgmadhctga` (`province_id`);

--
-- Indexes for table `base_dict`
--
ALTER TABLE `base_dict`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `base_dict_value`
--
ALTER TABLE `base_dict_value`
  ADD PRIMARY KEY (`id`),
  ADD KEY `FK_m9t5cpdjn6kcf4qtnslxuqir5` (`dict_id`);

--
-- Indexes for table `hero`
--
ALTER TABLE `hero`
  ADD PRIMARY KEY (`id`),
  ADD KEY `ownerId` (`owner_id`);

--
-- Indexes for table `hero_user`
--
ALTER TABLE `hero_user`
  ADD PRIMARY KEY (`id`),
  ADD KEY `id` (`id`);

--
-- 在导出的表使用AUTO_INCREMENT
--

--
-- 使用表AUTO_INCREMENT `auth_group`
--
ALTER TABLE `auth_group`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;
--
-- 使用表AUTO_INCREMENT `auth_privilege`
--
ALTER TABLE `auth_privilege`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;
--
-- 使用表AUTO_INCREMENT `auth_role`
--
ALTER TABLE `auth_role`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- 使用表AUTO_INCREMENT `base_address`
--
ALTER TABLE `base_address`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;
--
-- 使用表AUTO_INCREMENT `base_dict`
--
ALTER TABLE `base_dict`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;
--
-- 使用表AUTO_INCREMENT `base_dict_value`
--
ALTER TABLE `base_dict_value`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;
--
-- 使用表AUTO_INCREMENT `hero`
--
ALTER TABLE `hero`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- 使用表AUTO_INCREMENT `hero_user`
--
ALTER TABLE `hero_user`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- 限制导出的表
--

--
-- 限制表 `auth_r_group_role`
--
ALTER TABLE `auth_r_group_role`
  ADD CONSTRAINT `FK_fcs6k15dvjcycc5jythklglv` FOREIGN KEY (`role_id`) REFERENCES `auth_role` (`id`);

--
-- 限制表 `auth_r_role_privilege`
--
ALTER TABLE `auth_r_role_privilege`
  ADD CONSTRAINT `FK_m4wroyfsiv14tlurah4qipagy` FOREIGN KEY (`privilege_id`) REFERENCES `auth_privilege` (`id`);

--
-- 限制表 `auth_r_user_group`
--
ALTER TABLE `auth_r_user_group`
  ADD CONSTRAINT `FK_hwl9dq1p404qxjwainxhmu7eh` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`);

--
-- 限制表 `hero`
--
ALTER TABLE `hero`
  ADD CONSTRAINT `hero_ibfk_1` FOREIGN KEY (`owner_id`) REFERENCES `hero_user` (`id`);

--
-- 限制表 `hero_user`
--
ALTER TABLE `hero_user`
  ADD CONSTRAINT `hero_user_ibfk_1` FOREIGN KEY (`id`) REFERENCES `auth_user` (`id`);
COMMIT;

