今日份的学习笔记:2021.08.11

2021/8/12 6:36:33

本文主要是介绍今日份的学习笔记:2021.08.11,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

今日份的学习笔记:2021.08.11

Jeesite 4.0 学习笔记(三)

对之前内容作了部分修改

项目的导入与数据初始化

官方文档给出的十分详细,此处不再赘述,只作简单补充

参考官方文档:

快速开始、环境搭建、修改包名、新建模块、正式部署 - JeeSite 4.x

IDEA的jeesite项目导入补充

01 下载源码到本地

02 IDEA open打开jeesite目录下web工程

03 打开pom文件,pom文件报红,将以下内容进行替换

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	
	<parent>
		<groupId>com.jeesite</groupId>
		<artifactId>jeesite-parent</artifactId>
		<version>4.3.0-SNAPSHOT</version>
		<relativePath>../parent/pom.xml</relativePath>
	</parent>
	
	<artifactId>jeesite-web</artifactId>
	<packaging>war</packaging>
	
	<name>JeeSite Web</name>
	<url>http://jeesite.com</url>
	<inceptionYear>2013-Now</inceptionYear>
	
	<properties>
		
		<finalName>web</finalName><!-- war or jar 包的名称 -->
		<start-class>com.jeesite.modules.Application</start-class>
		
		<!-- environment setting -->
		<eclipse-plugin-download-sources>false</eclipse-plugin-download-sources>
		<eclipse-plugin-download-javadocs>false</eclipse-plugin-download-javadocs>
		
		<!-- docker setting -->
        <docker.run.port>8980:8980</docker.run.port>
		
	</properties>

	<dependencies>
		
		<!-- 核心模块 -->
		<dependency>
			<groupId>com.jeesite</groupId>
			<artifactId>jeesite-module-core</artifactId>
			<version>${project.parent.version}</version>
		</dependency>
		
		<!-- 在线文档接口 -->
		<dependency>
			<groupId>com.jeesite</groupId>
			<artifactId>jeesite-module-swagger</artifactId>
			<version>${project.parent.version}</version>
		</dependency>
		
		<!-- 文件管理共享(标准版)
		<dependency>
			<groupId>com.jeesite</groupId>
			<artifactId>jeesite-module-filemanager</artifactId>
			<version>${project.parent.version}</version>
		</dependency> -->
		
		<!-- 文件在线预览(标准版)
		<dependency>
			<groupId>com.jeesite</groupId>
			<artifactId>jeesite-module-filepreview</artifactId>
			<version>${project.parent.version}</version>
		</dependency> -->
		
		<!-- 内容管理模块
		<dependency>
			<groupId>com.jeesite</groupId>
			<artifactId>jeesite-module-cms</artifactId>
			<version>${project.parent.version}</version>
		</dependency> -->
		
		<!-- Spring Boot Tomcat
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-tomcat</artifactId>
			<scope>provided</scope>
		</dependency> -->

        <!-- Spring Boot -->
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-maven-plugin</artifactId>
			<version>2.4.6</version>
		</dependency>


	</dependencies>
	
	<build>
		<finalName>${finalName}</finalName>
		<outputDirectory>${project.basedir}/src/main/webapp/WEB-INF/classes/</outputDirectory>
		<plugins>
			
			<!-- Spring Boot -->
            <!-- 此处插件已更换为依赖在上方引入 -->
<!--			<plugin>-->
<!--				<groupId>org.springframework.boot</groupId>-->
<!--				<artifactId>spring-boot-maven-plugin</artifactId>-->
<!--				<configuration>-->
<!--					<includeSystemScope>true</includeSystemScope>-->
<!--				</configuration>-->
<!--			</plugin>-->
			<!-- <plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-shade-plugin</artifactId>
			</plugin> -->
			
			<!-- 打包插件, war包名称不带版本号 -->
            <!-- 暂时不需要,需要时到maven repository引入 -->
<!--			<plugin>-->
<!--				<groupId>org.apache.maven.plugins</groupId>-->
<!--				<artifactId>maven-war-plugin</artifactId>-->
<!--				<configuration>-->
<!--					&lt;!&ndash; <packagingExcludes></packagingExcludes>-->
<!--					<warSourceExcludes></warSourceExcludes> &ndash;&gt;-->
<!--					<webappDirectory>${project.build.directory}/${project.artifactId}</webappDirectory>-->
<!--					<warName>${finalName}</warName>-->
<!--					<archive>-->
<!--						<addMavenDescriptor>false</addMavenDescriptor>-->
<!--					</archive>-->
<!--				</configuration>-->
<!--			</plugin>-->
			
		<!-- Eclipse 插件 -->
        <!-- 此处已经删除 -->
			
		</plugins>
	</build>
	
	<developers>  
		<developer>
			<id>thinkgem</id>
			<name>WangZhen</name>
			<email>thinkgem at 163.com</email>
			<roles><role>Project lead</role></roles>
			<timezone>+8</timezone>  
		</developer>
	</developers>
	
	<organization>
		<name>JeeSite</name>
		<url>http://jeesite.com</url>
	</organization>
	
	<repositories>
		<repository>
			<id>aliyun-repos</id>
			<url>https://maven.aliyun.com/repository/public</url>
			<releases><enabled>true</enabled></releases>
			<snapshots><enabled>false</enabled></snapshots>
		</repository>
		<repository>
			<id>jeesite-repos</id>
			<url>http://maven.jeesite.net/repository/maven-public</url>
		</repository>
	</repositories>
	<pluginRepositories>
		<pluginRepository>
			<id>aliyun-repos</id>
			<url>https://maven.aliyun.com/repository/public</url>
			<releases><enabled>true</enabled></releases>
			<snapshots><enabled>false</enabled></snapshots>
		</pluginRepository>
		<pluginRepository>
			<id>jeesite-repos</id>
			<url>http://maven.jeesite.net/repository/maven-public</url>
		</pluginRepository>
	</pluginRepositories>
	
</project>

注意,maven若非缺省,需要在 settings... 和 new projects settings 中都作修改

05 打开 main ——> resources ——> config ——> application.yml 配置连接到mysql的数据库参数

数据初始化相关说明

需要注意的是,

01 数据库初始化时,更改my.ini配置文件可能出现报错,导致mysql服务无法再次启动,此处提供重新安装mysql一种解决办法

02 官方提供的数据库授权语句等语法对于mysql 8.0 版本不一定适用,需要自行更改

03 不要直接cv,先cv到记事本中,再cv到powershell中,避免中英文的全角半角问题

https://www.jeesite.com/docs/install-deploy/)

如何创建新模块

注意,

本项目整体为一个maven project,当我们创建新模块时,选择maven module

创建时,create from archetype 可以用来创建maven module的模板,如无需要可以不必勾选

step 01 创建

File ——> New ——> Module ——> 选择maven ——>选择SDK ——>

是否勾选 create from archetype ——> 选择parent ——> 输入name ——>

设置Location,选择jeesite-web目录下modules文件夹路径,然后在该目录下添加新模块同名文件夹 ——>

创建完成

step 02 配置

在 new module 的pom文件中添加以下依赖

		<!-- 核心模块 -->
		<dependency>
			<groupId>com.jeesite</groupId>
			<artifactId>jeesite-module-core</artifactId>
			<version>${project.parent.version}</version>
		</dependency>

Jeesite 4.0 文件结构与配置

一、Jeesite 4.0 聚合工程

SpringBoot是java领域微服务架构最优落地技术,springboot + MongoDB 方案是在微服务架构下数据治理的最佳方案之一

jeesite分层模式

[ 表现层:com.jeesite.modules.*.web     ]



[ 业务层:com.jeesite.modules.*.service ]

												[ Database ]

[ 持久层:com.jeesite.modules.*.dao     ]



[ 实体层:com.jeesite.modules.*.entity  ]

发布部署

从

 ⚪ ————> 负载均衡服务器 ————> 一系列tomcat高并发	(Cluster)

								  DataBase...
到

分布式架构

分布式架构例图

架构图

什么是聚合工程?

......

二、Jeesite 4.0 模块间依赖关系

三、Jeesite 4.0 配置文件

spring boot 默认大于配置(doge)

我的第一个Jeesite模块项目

以图书目录管理的单表生成功能(增删改查)为例

01 部署成功后登录进入主页

http://127.0.0.1:8980/js

02 在利用navicat或sqlyog在mysql中建立增删改查的对象的对应数据表

image-20210812002047571

03 研发工具 ——> 代码生成工具中选择新增,开始进行代码生成

(1)选择新建的数据表

image-20210812002238028

(2)基本信息配置

image-20210812005539592

(3)字段信息配置

image-20210812005606778

(4)生成信息配置

image-20210812005933041

注释,

统一的生成包路径按缺省即可

生成基础路径需要改为web工程的同级目录modules下以模块名命名的文件夹中,本次示例中为 ...\jeesite4\modules\book

04 创建菜单,方便后续查看

image-20210812010731638

image-20210812010823018

05 完成



这篇关于今日份的学习笔记:2021.08.11的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程