From 36614e7b5fd4c248e5793c9a37a781fd2b02d1cc Mon Sep 17 00:00:00 2001 From: ly19960718 <1622779752@qq.com> Date: Tue, 25 May 2021 09:38:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=A5=E5=90=8D=E5=A2=9E=E5=8A=A0=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E6=8A=A5=E5=90=8D=E6=9C=BA=E6=9E=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dao/institution/IInstitutionDao.java | 7 ++++ .../init/InitModule.java | 35 ++++++++++++++++++ .../mapper/institution/institution-mapper.xml | 36 +++++++++++++++++++ 3 files changed, 78 insertions(+) create mode 100644 module-institution-management/src/main/java/cn/com/tenlion/institutionmanagement/init/InitModule.java diff --git a/module-institution-management/src/main/java/cn/com/tenlion/institutionmanagement/dao/institution/IInstitutionDao.java b/module-institution-management/src/main/java/cn/com/tenlion/institutionmanagement/dao/institution/IInstitutionDao.java index e5a720e..9701702 100644 --- a/module-institution-management/src/main/java/cn/com/tenlion/institutionmanagement/dao/institution/IInstitutionDao.java +++ b/module-institution-management/src/main/java/cn/com/tenlion/institutionmanagement/dao/institution/IInstitutionDao.java @@ -23,6 +23,13 @@ import java.util.Map; @Repository public interface IInstitutionDao { + /** + * 建表 + * @throws UpdateException + */ + void createTable() throws UpdateException; + + /** * 新增机构管理 * diff --git a/module-institution-management/src/main/java/cn/com/tenlion/institutionmanagement/init/InitModule.java b/module-institution-management/src/main/java/cn/com/tenlion/institutionmanagement/init/InitModule.java new file mode 100644 index 0000000..f0518a2 --- /dev/null +++ b/module-institution-management/src/main/java/cn/com/tenlion/institutionmanagement/init/InitModule.java @@ -0,0 +1,35 @@ +package cn.com.tenlion.institutionmanagement.init; + + +import cn.com.tenlion.institutionmanagement.dao.institution.IInstitutionDao; +import ink.wgink.module.dictionary.startup.ModuleDictionaryStartUp; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.ApplicationArguments; +import org.springframework.boot.ApplicationRunner; +import org.springframework.stereotype.Component; + +/** + * 模块初始化函数 + */ +@Component +public class InitModule implements ApplicationRunner { + + private static final Logger LOG = LoggerFactory.getLogger(ModuleDictionaryStartUp.class); + @Autowired + private IInstitutionDao iInstitutionDao; + + + @Override + public void run(ApplicationArguments args) throws Exception { + initTable(); + } + + private void initTable(){ + LOG.debug("初始化机构信息表"); + iInstitutionDao.createTable(); + } + + +} diff --git a/module-institution-management/src/main/resources/mybatis/mapper/institution/institution-mapper.xml b/module-institution-management/src/main/resources/mybatis/mapper/institution/institution-mapper.xml index 30238c1..85dba5c 100644 --- a/module-institution-management/src/main/resources/mybatis/mapper/institution/institution-mapper.xml +++ b/module-institution-management/src/main/resources/mybatis/mapper/institution/institution-mapper.xml @@ -71,6 +71,42 @@ + + + + + CREATE TABLE IF NOT EXISTS `m_institution` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT, + `institution_id` char(36) DEFAULT NULL COMMENT '机构ID', + `institution_name` varchar(255) DEFAULT NULL COMMENT '机构名称', + `institution_desc` varchar(500) DEFAULT NULL COMMENT '机构描述', + `institution_image` varchar(500) DEFAULT NULL COMMENT '机构图片', + `institution_address` varchar(255) DEFAULT NULL COMMENT '机构详情地址', + `institution_x` varchar(50) DEFAULT NULL COMMENT '机构经度', + `institution_y` varchar(50) DEFAULT NULL COMMENT '机构纬度', + `institution_founding_time` varchar(50) DEFAULT NULL COMMENT '机构成立时间', + `institution_principal` varchar(100) DEFAULT NULL COMMENT '机构负责人', + `institution_contact` varchar(200) DEFAULT NULL COMMENT '机构联系方式', + `institution_region_province` varchar(255) DEFAULT NULL COMMENT '行政区划-省', + `institution_region_city` varchar(255) DEFAULT NULL COMMENT '行政区化-市', + `institution_region_area` varchar(255) DEFAULT NULL COMMENT '行政区化-区', + `institution_region_village` varchar(255) DEFAULT NULL COMMENT '行政区化-村', + `institution_region_street` varchar(255) DEFAULT NULL COMMENT '行政区化-街', + `institution_type` varchar(255) DEFAULT NULL COMMENT '机构类型', + `creator` char(36) DEFAULT NULL COMMENT '创建人ID', + `gmt_create` datetime DEFAULT NULL COMMENT '创建时间', + `modifier` char(36) DEFAULT NULL COMMENT '修改人', + `gmt_modified` datetime DEFAULT NULL COMMENT '修改时间', + `is_delete` int(1) DEFAULT NULL COMMENT '删除状态 0未删除 1以删除', + PRIMARY KEY (`id`) + ) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=utf8 COMMENT='机构管理'; + + + + + + + INSERT INTO m_institution(