1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee

Merge branch 'backend'

This commit is contained in:
程序员小墨 2022-11-06 00:19:01 +08:00
commit fbdcb2a379
68 changed files with 904 additions and 550 deletions

View File

@ -104,11 +104,11 @@
项目开发环境Ubuntu Desktop 22.04 LTS、OpenJDK 11、MySQL 8.0.12
| 板块 | 技术栈 | 开发工具 | 备注 |
| ------ | --------------------------------------------------------- | ------------- | ---- |
| 前端 | Vue 3JavaScript框架、Element PlusUI组件库 | VS Code | 暂定 |
| 后端 | Java 11开发语言、SpringCloud微服务、Redis缓存 | Intellij IDEA | |
| 数据库 | MySQL数据存储 | Navicat | |
| 板块 | 技术栈 | 开发工具 | 备注 |
| ------ | ------------------------------------------------------------ | ------------- | ---- |
| 前端 | Vue 3JavaScript框架、Element PlusUI组件库 | VS Code | 暂定 |
| 后端 | Java 11开发语言、SpringCloud微服务nacos-server-2.1.2(服务注册与发现)、Redis缓存 | Intellij IDEA | |
| 数据库 | MySQL数据存储 | Navicat | |
@ -172,6 +172,24 @@
### 后端
#### 启动nacos
Nacos下载地址https://github.com/alibaba/nacos/releases/tag/2.1.2
> standalone代表着单机模式运行非集群模式
>
```bash
cd nacos/bin
# Windows
startup.cmd -m standalone
# Linux/Unix/Mac
# sh startup.sh -m standalone
# bash startup.sh -m standalone
```
Nacos后台默认用户名密码都是**nacos**
### 前端
@ -265,10 +283,20 @@ Spring initializrhttps://start.spring.io/
https://start.spring.io/#!type=maven-project&language=java&platformVersion=2.7.5&packaging=jar&jvmVersion=11&groupId=com.cxyxiaomo&artifactId=entrance&name=Epidemic%20prevention%20platform&description=&packageName=com.cxyxiaomo.entrance&dependencies=lombok,mysql,mybatis
##### Gateway
B站教程https://www.bilibili.com/video/BV1JB4y1F7aL
#### Maven
MVN REPOSITORYhttps://mvnrepository.com/
#### Nacos
Quick Starthttps://nacos.io/zh-cn/docs/v2/quickstart/quick-start.html
### 前端
#### Element Plus

View File

@ -1,5 +1,13 @@
# 遇到的问题及对应的解决方案
### 2022.11
#### 2022.11.05 nacos启动报错Fail to init node, please see the logs to find the reason.
Nacos启动程序路径不能有中文名
### 2022.10
#### 2022.10.22 CRLF换行替换为LF

View File

@ -1,10 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" defaultCharsetForPropertiesFiles="UTF-8">
<file url="file://$PROJECT_DIR$/microservice-api/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/microservice-api/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/microservice-gateway/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/microservice-gateway/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/microservice-pojo/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/microservice-pojo/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/microservice-provider-miniprogram-8080/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/microservice-provider-miniprogram-8080/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/microservice-provider-test-8011/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/microservice-provider-test-8011/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/microservice-provider-user-8001/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/microservice-provider-user-8001/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />

View File

@ -0,0 +1,16 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Gateway" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" nameIsGenerated="true">
<option name="ACTIVE_PROFILES" />
<module name="microservice-gateway" />
<option name="SPRING_BOOT_MAIN_CLASS" value="com.cxyxiaomo.epp.Gateway" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="com.cxyxiaomo.epp.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>

View File

@ -2,7 +2,7 @@
<configuration default="false" name="MiniProgram" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
<option name="ACTIVE_PROFILES" />
<module name="microservice-provider-miniprogram-8080" />
<option name="SPRING_BOOT_MAIN_CLASS" value="com.cxyxiaomo.Application" />
<option name="SPRING_BOOT_MAIN_CLASS" value="com.cxyxiaomo.epp.Application" />
<method v="2">
<option name="Make" enabled="true" />
</method>

View File

@ -0,0 +1,16 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="TestProvider" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" nameIsGenerated="true">
<option name="ACTIVE_PROFILES" />
<module name="microservice-provider-test-8011" />
<option name="SPRING_BOOT_MAIN_CLASS" value="com.cxyxiaomo.epp.TestProvider" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="com.cxyxiaomo.epp.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>

View File

@ -1,79 +0,0 @@
<?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">
<parent>
<artifactId>epp</artifactId>
<groupId>com.cxyxiaomo</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>microservice-api</artifactId>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins>
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>

View File

@ -0,0 +1,61 @@
<?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">
<parent>
<artifactId>epp</artifactId>
<groupId>com.cxyxiaomo</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>microservice-gateway</artifactId>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-gateway</artifactId>
</dependency>
<!--客户端负载均衡loadbalancer-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-loadbalancer</artifactId>
</dependency>
<!-- Nacos -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
<exclusions>
<exclusion>
<artifactId>snakeyaml</artifactId>
<groupId>org.yaml</groupId>
</exclusion>
</exclusions>
</dependency>
<!-- logback -->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,14 @@
package com.cxyxiaomo.epp;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
@SpringBootApplication
@EnableDiscoveryClient
public class Gateway {
public static void main(String[] args) {
SpringApplication.run(Gateway.class, args);
}
}

View File

@ -0,0 +1,13 @@
package com.cxyxiaomo.epp.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class Controller {
@RequestMapping("/error")
public String error() {
return "[ERROR] 500 Internal Server Error";
}
}

View File

@ -0,0 +1,41 @@
server:
port: 80
# Spring 配置
spring:
application:
name: microservice-gateway
cloud:
nacos:
discovery:
server-addr: 127.0.0.1:8848
gateway:
discovery:
locator:
enabled: true
lower-case-service-id: true
routes:
- id: test1
uri: lb://microservice-provider-test
predicates:
- Path=/test/**,/test1/**
- Method=GET,POST
filters:
- StripPrefix=1 # 跳过第一段 /test
- id: test2
uri: lb://microservice-provider-test
predicates:
- Path=/test2/{routes}
filters:
- SetPath=/hi/{routes}
- id: test3
uri: lb://microservice-provider-test
predicates:
- Path=/test3/**
filters:
- name: RedirectTo
args:
status: 302
url: https://www.baidu.com/?wd=

View File

@ -0,0 +1,20 @@
package com.cxyxiaomo.epp;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
/**
* Unit test for simple App.
*/
public class GatewayTest
{
/**
* Rigorous Test :-)
*/
@Test
public void shouldAnswerWithTrue()
{
assertTrue( true );
}
}

View File

@ -0,0 +1,33 @@
<?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">
<parent>
<artifactId>epp</artifactId>
<groupId>com.cxyxiaomo</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>microservice-pojo</artifactId>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@ -1,9 +1,15 @@
package com.cxyxiaomo.index.pojo;
package com.cxyxiaomo.epp.pojo;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.io.Serializable;
@Data
public class Apply {
@NoArgsConstructor
@Accessors(chain = true) // 链式写法
public class Apply implements Serializable {
private Integer id;

View File

@ -0,0 +1,23 @@
package com.cxyxiaomo.epp.pojo;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.io.Serializable;
@Data
@NoArgsConstructor
@Accessors(chain = true) // 链式写法
public class Feedback implements Serializable {
private Integer id;
private String title;
private String content;
private String time;
private String reply;
}

View File

@ -0,0 +1,26 @@
package com.cxyxiaomo.epp.pojo;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
// import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
@Data
@NoArgsConstructor
@Accessors(chain = true) // 链式写法
public class Notice implements Serializable {
private Integer id;
private String title;
private String content;
// @DateTimeFormat(pattern = "yyyy-MM-dd")
// TODO
private String time;
}

View File

@ -1,9 +1,15 @@
package com.cxyxiaomo.index.pojo;
package com.cxyxiaomo.epp.pojo;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.io.Serializable;
@Data
public class Report {
@NoArgsConstructor
@Accessors(chain = true) // 链式写法
public class Report implements Serializable {
private Integer id;

View File

@ -1,4 +1,4 @@
package com.cxyxiaomo.index.pojo;
package com.cxyxiaomo.epp.pojo;
import lombok.Data;

View File

@ -1,9 +1,7 @@
package com.cxyxiaomo.epp.pojo;
import lombok.Data;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;
import java.io.Serializable;
@ -11,12 +9,16 @@ import java.io.Serializable;
// 数据库关系映射
@Data
@Getter
@Setter
@NoArgsConstructor
@Accessors(chain = true) // 链式写法
public class User implements Serializable { // 微服务必须要实现Serializable
private Long id;
// 微服务必须要实现Serializable
public class User implements Serializable {
private Integer id;
private String username;
private String name;
private String password;
private String img;
private String stu_id;
private Integer role;
private String state;
}

View File

@ -0,0 +1,28 @@
package com.cxyxiaomo.epp.pojo;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.io.Serializable;
@Data
@NoArgsConstructor
@Accessors(chain = true) // 链式写法
public class Visitor implements Serializable {
private Integer id;
private String time;
private String phone;
private String issue;
private String meet_name;
private String create_time;
private Integer state;
}

View File

@ -18,6 +18,12 @@
</properties>
<dependencies>
<!-- 实体类 -->
<dependency>
<groupId>com.cxyxiaomo</groupId>
<artifactId>microservice-pojo</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
@ -59,5 +65,10 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
</dependency>
<!-- Nacos -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -1,9 +1,11 @@
package com.cxyxiaomo;
package com.cxyxiaomo.epp;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
@SpringBootApplication
@EnableDiscoveryClient
public class Application {
public static void main(String[] args) {

View File

@ -1,8 +1,8 @@
package com.cxyxiaomo.index.controller;
package com.cxyxiaomo.epp.index.controller;
import com.cxyxiaomo.index.pojo.Apply;
import com.cxyxiaomo.index.pojo.Res;
import com.cxyxiaomo.index.service.ApplyService;
import com.cxyxiaomo.epp.pojo.Apply;
import com.cxyxiaomo.epp.pojo.Res;
import com.cxyxiaomo.epp.index.service.ApplyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

View File

@ -1,8 +1,8 @@
package com.cxyxiaomo.index.controller;
package com.cxyxiaomo.epp.index.controller;
import com.cxyxiaomo.index.pojo.Notice;
import com.cxyxiaomo.index.pojo.Res;
import com.cxyxiaomo.index.service.NoticeService;
import com.cxyxiaomo.epp.pojo.Notice;
import com.cxyxiaomo.epp.pojo.Res;
import com.cxyxiaomo.epp.index.service.NoticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

View File

@ -1,7 +1,7 @@
package com.cxyxiaomo.index.controller;
package com.cxyxiaomo.epp.index.controller;
import com.cxyxiaomo.index.pojo.Res;
import com.cxyxiaomo.index.service.OtherService;
import com.cxyxiaomo.epp.pojo.Res;
import com.cxyxiaomo.epp.index.service.OtherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

View File

@ -1,8 +1,8 @@
package com.cxyxiaomo.index.controller;
package com.cxyxiaomo.epp.index.controller;
import com.cxyxiaomo.index.pojo.Report;
import com.cxyxiaomo.index.pojo.Res;
import com.cxyxiaomo.index.service.ReportService;
import com.cxyxiaomo.epp.pojo.Report;
import com.cxyxiaomo.epp.pojo.Res;
import com.cxyxiaomo.epp.index.service.ReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

View File

@ -1,8 +1,8 @@
package com.cxyxiaomo.index.controller;
package com.cxyxiaomo.epp.index.controller;
import com.cxyxiaomo.index.pojo.Res;
import com.cxyxiaomo.index.pojo.User;
import com.cxyxiaomo.index.service.UserService;
import com.cxyxiaomo.epp.pojo.Res;
import com.cxyxiaomo.epp.pojo.User;
import com.cxyxiaomo.epp.index.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

View File

@ -1,6 +1,6 @@
package com.cxyxiaomo.index.dao;
package com.cxyxiaomo.epp.index.dao;
import com.cxyxiaomo.index.pojo.Apply;
import com.cxyxiaomo.epp.pojo.Apply;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;

View File

@ -1,6 +1,6 @@
package com.cxyxiaomo.index.dao;
package com.cxyxiaomo.epp.index.dao;
import com.cxyxiaomo.index.pojo.Notice;
import com.cxyxiaomo.epp.pojo.Notice;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;

View File

@ -1,6 +1,6 @@
package com.cxyxiaomo.index.dao;
package com.cxyxiaomo.epp.index.dao;
import com.cxyxiaomo.index.pojo.Feedback;
import com.cxyxiaomo.epp.pojo.Feedback;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;

View File

@ -1,6 +1,6 @@
package com.cxyxiaomo.index.dao;
package com.cxyxiaomo.epp.index.dao;
import com.cxyxiaomo.index.pojo.Report;
import com.cxyxiaomo.epp.pojo.Report;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;

View File

@ -1,6 +1,6 @@
package com.cxyxiaomo.index.dao;
package com.cxyxiaomo.epp.index.dao;
import com.cxyxiaomo.index.pojo.User;
import com.cxyxiaomo.epp.pojo.User;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;

View File

@ -1,6 +1,6 @@
package com.cxyxiaomo.index.service;
package com.cxyxiaomo.epp.index.service;
import com.cxyxiaomo.index.pojo.Apply;
import com.cxyxiaomo.epp.pojo.Apply;
import java.util.List;

View File

@ -1,7 +1,7 @@
package com.cxyxiaomo.index.service;
package com.cxyxiaomo.epp.index.service;
import com.cxyxiaomo.index.dao.ApplyDao;
import com.cxyxiaomo.index.pojo.Apply;
import com.cxyxiaomo.epp.index.dao.ApplyDao;
import com.cxyxiaomo.epp.pojo.Apply;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

View File

@ -1,6 +1,6 @@
package com.cxyxiaomo.index.service;
package com.cxyxiaomo.epp.index.service;
import com.cxyxiaomo.index.pojo.Notice;
import com.cxyxiaomo.epp.pojo.Notice;
import java.util.List;

View File

@ -1,7 +1,7 @@
package com.cxyxiaomo.index.service;
package com.cxyxiaomo.epp.index.service;
import com.cxyxiaomo.index.dao.NoticeDao;
import com.cxyxiaomo.index.pojo.Notice;
import com.cxyxiaomo.epp.index.dao.NoticeDao;
import com.cxyxiaomo.epp.pojo.Notice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

View File

@ -1,6 +1,6 @@
package com.cxyxiaomo.index.service;
package com.cxyxiaomo.epp.index.service;
import com.cxyxiaomo.index.pojo.Feedback;
import com.cxyxiaomo.epp.pojo.Feedback;
import java.util.List;

View File

@ -1,7 +1,7 @@
package com.cxyxiaomo.index.service;
package com.cxyxiaomo.epp.index.service;
import com.cxyxiaomo.index.dao.OtherDao;
import com.cxyxiaomo.index.pojo.Feedback;
import com.cxyxiaomo.epp.index.dao.OtherDao;
import com.cxyxiaomo.epp.pojo.Feedback;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

View File

@ -1,6 +1,6 @@
package com.cxyxiaomo.index.service;
package com.cxyxiaomo.epp.index.service;
import com.cxyxiaomo.index.pojo.Report;
import com.cxyxiaomo.epp.pojo.Report;
import java.util.List;

View File

@ -1,8 +1,8 @@
package com.cxyxiaomo.index.service;
package com.cxyxiaomo.epp.index.service;
import com.cxyxiaomo.index.dao.ReportDao;
import com.cxyxiaomo.index.dao.UserDao;
import com.cxyxiaomo.index.pojo.Report;
import com.cxyxiaomo.epp.index.dao.ReportDao;
import com.cxyxiaomo.epp.index.dao.UserDao;
import com.cxyxiaomo.epp.pojo.Report;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

View File

@ -1,13 +1,13 @@
package com.cxyxiaomo.index.service;
package com.cxyxiaomo.epp.index.service;
import com.cxyxiaomo.index.pojo.User;
import com.cxyxiaomo.epp.pojo.User;
import java.util.List;
public interface UserService {
User getUser(String username,String role);
User getUser(String username, String role);
User getUserByUsername(String username);

View File

@ -1,7 +1,7 @@
package com.cxyxiaomo.index.service;
package com.cxyxiaomo.epp.index.service;
import com.cxyxiaomo.index.dao.UserDao;
import com.cxyxiaomo.index.pojo.User;
import com.cxyxiaomo.epp.index.dao.UserDao;
import com.cxyxiaomo.epp.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -14,7 +14,7 @@ public class UserServiceImpl implements UserService {
private UserDao userDao;
@Override
public User getUser(String username,String role) {
public User getUser(String username, String role) {
return userDao.getUser(username, role);
}

View File

@ -1,8 +1,8 @@
package com.cxyxiaomo.visitor.controller;
package com.cxyxiaomo.epp.visitor.controller;
import com.cxyxiaomo.index.pojo.Res;
import com.cxyxiaomo.visitor.pojo.Visitor;
import com.cxyxiaomo.visitor.service.VisitorService;
import com.cxyxiaomo.epp.pojo.Res;
import com.cxyxiaomo.epp.visitor.service.VisitorService;
import com.cxyxiaomo.epp.pojo.Visitor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

View File

@ -1,6 +1,6 @@
package com.cxyxiaomo.visitor.dao;
package com.cxyxiaomo.epp.visitor.dao;
import com.cxyxiaomo.visitor.pojo.Visitor;
import com.cxyxiaomo.epp.pojo.Visitor;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;

View File

@ -1,6 +1,6 @@
package com.cxyxiaomo.visitor.service;
package com.cxyxiaomo.epp.visitor.service;
import com.cxyxiaomo.visitor.pojo.Visitor;
import com.cxyxiaomo.epp.pojo.Visitor;
import java.util.List;

View File

@ -1,8 +1,8 @@
package com.cxyxiaomo.visitor.service.impl;
package com.cxyxiaomo.epp.visitor.service.impl;
import com.cxyxiaomo.visitor.dao.VisitorDao;
import com.cxyxiaomo.visitor.pojo.Visitor;
import com.cxyxiaomo.visitor.service.VisitorService;
import com.cxyxiaomo.epp.pojo.Visitor;
import com.cxyxiaomo.epp.visitor.service.VisitorService;
import com.cxyxiaomo.epp.visitor.dao.VisitorDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

View File

@ -1,17 +0,0 @@
package com.cxyxiaomo.index.pojo;
import lombok.Data;
@Data
public class Feedback {
private Integer id;
private String title;
private String content;
private String time;
private String reply;
}

View File

@ -1,19 +0,0 @@
package com.cxyxiaomo.index.pojo;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
@Data
public class Notice {
private Integer id;
private String title;
private String content;
@DateTimeFormat(pattern = "yyyy-MM-dd")
private String time;
}

View File

@ -1,15 +0,0 @@
package com.cxyxiaomo.index.pojo;
import lombok.Data;
@Data
public class User {
private Integer id;
private String username;
private String name;
private String password;
private String img;
private String stu_id;
private Integer role;
private String state;
}

View File

@ -1,22 +0,0 @@
package com.cxyxiaomo.visitor.pojo;
import lombok.Data;
@Data
public class Visitor {
private Integer id;
private String time;
private String phone;
private String issue;
private String meet_name;
private String create_time;
private Integer state;
}

View File

@ -3,9 +3,15 @@ server:
max-http-header-size: 102400
spring:
application:
name: microservice-provider-miniprogram
cloud:
nacos:
discovery:
server-addr: 127.0.0.1:8848
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/school?useUnicode=true&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&serverTimezone=UTC
url: jdbc:mysql://127.0.0.1:3306/epp?useUnicode=true&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&serverTimezone=UTC
username: root
password: root

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cxyxiaomo.index.dao.ApplyDao">
<mapper namespace="com.cxyxiaomo.epp.index.dao.ApplyDao">
<insert id="applySub">
insert into apply
@ -15,12 +15,12 @@
<select id="lastApply" resultType="java.lang.Integer">
select * from apply where stu_id = #{id} and state = 0 limit 1
</select>
<select id="applyListNoReplay" resultType="com.cxyxiaomo.index.pojo.Apply">
<select id="applyListNoReplay" resultType="com.cxyxiaomo.epp.pojo.Apply">
select a.*,u.name,u.stu_id as stuId from apply a
left join user u on a.stu_id = u.id
where a.state = 0
</select>
<select id="myApply" resultType="com.cxyxiaomo.index.pojo.Apply">
<select id="myApply" resultType="com.cxyxiaomo.epp.pojo.Apply">
select a.*,u.name,u.stu_id as stuId from apply a
left join user u on a.stu_id = u.id
where a.stu_id = #{id}

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cxyxiaomo.index.dao.NoticeDao">
<mapper namespace="com.cxyxiaomo.epp.index.dao.NoticeDao">
<insert id="addNotice">
insert into notice (title, content , time) values
@ -10,7 +10,7 @@
<delete id="delNotice">
delete from notice where id = #{id}
</delete>
<select id="noticeList" resultType="com.cxyxiaomo.index.pojo.Notice">
<select id="noticeList" resultType="com.cxyxiaomo.epp.pojo.Notice">
select * from notice order by time desc
<if test="limit!= ''">
limit ${limit}

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cxyxiaomo.index.dao.OtherDao">
<mapper namespace="com.cxyxiaomo.epp.index.dao.OtherDao">
<insert id="subFeedback">
insert into feedback (title, content, time, user_id) values
@ -11,7 +11,7 @@
update feedback set reply = #{replay}
where id = #{id}
</update>
<select id="feedbackList" resultType="com.cxyxiaomo.index.pojo.Feedback">
<select id="feedbackList" resultType="com.cxyxiaomo.epp.pojo.Feedback">
select * from feedback
<where>
<if test="id != null">
@ -19,7 +19,7 @@
</if>
</where>
</select>
<select id="feedbackListNoReplay" resultType="com.cxyxiaomo.index.pojo.Feedback">
<select id="feedbackListNoReplay" resultType="com.cxyxiaomo.epp.pojo.Feedback">
select * from feedback where reply is null
</select>
</mapper>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cxyxiaomo.index.dao.ReportDao">
<mapper namespace="com.cxyxiaomo.epp.index.dao.ReportDao">
<insert id="doReport">
insert into report
@ -11,7 +11,7 @@
(#{user_id},#{name},#{address},#{time},#{normal},#{yes_noon_temp},
#{yes_night_temp},#{today_morning_temp},#{isolation})
</insert>
<select id="myReport" resultType="com.cxyxiaomo.index.pojo.Report">
<select id="myReport" resultType="com.cxyxiaomo.epp.pojo.Report">
select name,time,normal,address from report where user_id = #{id}
order by time desc
</select>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cxyxiaomo.index.dao.UserDao">
<mapper namespace="com.cxyxiaomo.epp.index.dao.UserDao">
<insert id="addUser">
insert into user
(username, name, password, role, stu_id) values
@ -19,20 +19,20 @@
update user set state = #{date}
where id = #{id}
</update>
<select id="selectAll" resultType="com.cxyxiaomo.index.pojo.User">
<select id="selectAll" resultType="com.cxyxiaomo.epp.pojo.User">
select * from `user`
</select>
<select id="getUserByUsername" resultType="com.cxyxiaomo.index.pojo.User">
<select id="getUserByUsername" resultType="com.cxyxiaomo.epp.pojo.User">
select * from user where username = #{username}
</select>
<select id="getUser" resultType="com.cxyxiaomo.index.pojo.User">
<select id="getUser" resultType="com.cxyxiaomo.epp.pojo.User">
select * from user where username = #{username} and role_id = #{role}
</select>
<select id="redCodeList" resultType="com.cxyxiaomo.index.pojo.User">
<select id="redCodeList" resultType="com.cxyxiaomo.epp.pojo.User">
select name,stu_id from user where TO_DAYS(NOW( )) != TO_DAYS(state) and role = 2
</select>
<select id="redCodeList2" resultType="com.cxyxiaomo.index.pojo.User">
<select id="redCodeList2" resultType="com.cxyxiaomo.epp.pojo.User">
select name,stu_id from user where state = "1999-01-01"
</select>
</mapper>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cxyxiaomo.visitor.dao.VisitorDao">
<mapper namespace="com.cxyxiaomo.epp.visitor.dao.VisitorDao">
<insert id="visitorApply">
insert into visitor
(time,phone,issue,meet_name,create_time) values
@ -19,7 +19,7 @@
<select id="showMyVisitor" resultType="java.lang.Integer">
select state from visitor where phone = #{phone} and TO_DAYS(NOW( )) - TO_DAYS(time) = 0
</select>
<select id="showVisitorList" resultType="com.cxyxiaomo.visitor.pojo.Visitor">
<select id="showVisitorList" resultType="com.cxyxiaomo.epp.pojo.Visitor">
select * from visitor where state = 0
</select>
</mapper>

View File

@ -0,0 +1,68 @@
<?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">
<parent>
<artifactId>epp</artifactId>
<groupId>com.cxyxiaomo</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>microservice-provider-test</artifactId>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<dependencies>
<!-- Spring Boot -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-test</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- Nacos -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
<exclusions>
<exclusion>
<artifactId>jackson-core</artifactId>
<groupId>com.fasterxml.jackson.core</groupId>
</exclusion>
</exclusions>
</dependency>
<!-- jackson -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</dependency>
<!-- logback -->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,15 @@
package com.cxyxiaomo.epp;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
// 启动类
@SpringBootApplication
@EnableDiscoveryClient
public class TestProvider {
public static void main(String[] args) {
SpringApplication.run(TestProvider.class, args);
}
}

View File

@ -0,0 +1,25 @@
package com.cxyxiaomo.epp.controller;
// 提供 restful 服务
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class TestController {
@GetMapping("/")
public String helloWorld() {
return "Hello World!";
}
@GetMapping("/error")
public String error() throws Exception {
throw new Exception("这是一个异常");
}
@GetMapping("/hi/{id}")
public String hi(@PathVariable("id") String id) {
return id;
}
}

View File

@ -0,0 +1,11 @@
server:
port: 8011
# Spring 配置
spring:
application:
name: microservice-provider-test
cloud:
nacos:
discovery:
server-addr: 127.0.0.1:8848

View File

@ -21,7 +21,7 @@
<!-- 实体类 -->
<dependency>
<groupId>com.cxyxiaomo</groupId>
<artifactId>microservice-api</artifactId>
<artifactId>microservice-pojo</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<!-- mybatis -->
@ -76,6 +76,12 @@
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- Nacos -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<!-- 热部署 -->
<!--<dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->

View File

@ -2,10 +2,12 @@ package com.cxyxiaomo.epp;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
// 启动类
@SpringBootApplication
@EnableDiscoveryClient
public class UserProvider {
public static void main(String[] args) {
SpringApplication.run(UserProvider.class, args);

View File

@ -11,6 +11,10 @@ mybatis:
spring:
application:
name: microservice-provider-user
cloud:
nacos:
discovery:
server-addr: 127.0.0.1:8848
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.cj.jdbc.Driver

View File

@ -13,9 +13,11 @@
<!-- 打包方式 -->
<packaging>pom</packaging>
<modules>
<module>microservice-api</module>
<module>microservice-gateway</module>
<module>microservice-pojo</module>
<module>microservice-provider-user-8001</module>
<module>microservice-provider-miniprogram-8080</module>
<module>microservice-provider-test-8011</module>
</modules>
<!-- 统一管理jar包版本 -->
@ -30,6 +32,7 @@
<mysql.version>8.0.30</mysql.version>
<druid.version>1.2.8</druid.version>
<!--<mybatis.spring.boot.version>2.2.2</mybatis.spring.boot.version>-->
<jackson.version>2.13.4</jackson.version>
</properties>
<!-- 子 module 继承之后,锁定版本 + 不用写groupId和version -->
@ -44,6 +47,18 @@
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- Spring Cloud Starter Gateway -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-gateway</artifactId>
<version>3.1.4</version>
</dependency>
<!-- Spring Cloud Starter Load Balancer -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-loadbalancer</artifactId>
<version>3.1.4</version>
</dependency>
<!-- Spring Boot -->
<dependency>
<groupId>org.springframework.boot</groupId>
@ -60,7 +75,21 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>2.6.4</version>
<version>2.6.3</version>
</dependency>
<!-- Nacos -->
<!-- 服务注册发现 -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
<version>2021.1</version>
</dependency>
<!-- 配置中心依赖管理 -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
<version>2021.1</version>
</dependency>
<!-- Database -->
@ -84,6 +113,23 @@
<version>2.2.2</version>
</dependency>
<!-- jackson -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jackson.version}</version>
</dependency>
<!-- Log -->
<!-- log4j -->
<dependency>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long