配置数据源 D:\apache-tomcat-8.5.24\conf\context.xml
<Resource auth="Container" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/hap_shipments" name="jdbc/hap_shipments" type="javax.sql.DataSource" username="hap_dev" password="hap_dev"/>
创建项目 mvn org.apache.maven.plugins:maven-archetype-plugin:2.4:generate -D archetypeGroupId=hap -D archetypeArtifactId=hap-webapp-archetype -D archetypeVersion=3.1-SNAPSHOT -D groupId=shipments -D artifactId=ShipmentsParent -D package=shipments.core -D archetypeRepository=http://nexus.saas.hand-china.com/content/repositories/rdcsnapshot
新建数据库 create schema hap_shipments default character set utf8;
CREATE USER hap_dev@'%' IDENTIFIED BY 'hap_dev';
CREATE USER hap_dev@'localhost' IDENTIFIED BY 'hap_dev';
GRANT ALL PRIVILEGES ON hap_shipments.* TO hap_dev@'%';
GRANT ALL PRIVILEGES ON hap_shipments.* TO hap_dev@'localhost';
flush privileges;
导入IDEA
将sql文件拷入 ShipmentsParent\core-db\src\main\java\shipments\core\db\data\mysql
修改shipments/core/db/2016-06-01-init-data-migration.groovy
changeSet(author: "mrz", id: "20171218-mrz-1") {
sqlFile(path: MigrationHelper.getInstance().dataPath("com/hand/hap/db/data/"+dbType+"/xxinv_material_item.sql"), encoding: "UTF-8")
sqlFile(path: MigrationHelper.getInstance().dataPath("com/hand/hap/db/data/"+dbType+"/xxinv_material_txns.sql"), encoding: "UTF-8")
sqlFile(path: MigrationHelper.getInstance().dataPath("com/hand/hap/db/data/"+dbType+"/xxinv_shiped_doc.sql"), encoding: "UTF-8")
sqlFile(path: MigrationHelper.getInstance().dataPath("com/hand/hap/db/data/"+dbType+"/xxinv_shiped_doc_lines.sql"), encoding: "UTF-8")
}
执行 mvn process-resources -D skipLiquibaseRun=false -D db.driver=com.mysql.jdbc.Driver -D db.url=jdbc:mysql://127.0.0.1:3306/hap_shipments -D db.user=hap_dev -D db.password=hap_dev
启动redis
cd /
cd Redis-x64-3.2.100
redis-server.exe redis.windows.conf
在IDEA中配置TomCat
运行 ShipmentsParent\core\overlays\com.hand.hap-3.3.1-RELEASE\WEB-INF\view\index.html
创建目录
core(前面的包名称)
│ │ │ │
│ │ │ ├── controllers(Controller包)
│ │ │ │ └── DemoController.java(Controller类)
│ │ │ ├── db(数据表结构,数据初始化入口文件)
│ │ │ │ └── liquibase.groovy
│ │ │ ├── dto(Dto包)
│ │ │ │ └── Demo.java(Dto实现类)
│ │ │ ├── mapper(Mapper包)
│ │ │ │ ├── DemoMapper.java(Mapper接口)
│ │ │ └── service(Service包)
│ │ │ ├── IDemoService.java
│ │ │ └── impl(Service实现)
│ │ │ └── DemoServiceImpl.java
按照数据表新建Dto实现类,根据字段private、get、set。
HAND-HAP-构建项目步骤
最新推荐文章于 2024-07-25 22:25:37 发布