From 093d5c41e8f32c94bdf9d927b1b2c79ecb7b8e8b Mon Sep 17 00:00:00 2001 From: antrain <2464210826@qq.com> Date: Sun, 20 Sep 2020 17:39:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=B7=B2=E7=9F=A5bug=20?= =?UTF-8?q?=E8=B6=85=E6=97=B6=E3=80=81pojo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/pom.xml | 9 ++----- admin/src/main/resources/bootstrap.yml | 2 +- .../java/com/neuedu/filter/CorsConfig.java | 24 +++++++++++++++++++ .../java/com/neuedu/pojo/RolePermission.java | 20 ++++++++++++---- .../main/java/com/neuedu/pojo/UserRole.java | 20 ++++++++++++---- pom.xml | 14 +++++------ 6 files changed, 64 insertions(+), 25 deletions(-) create mode 100644 gateway/src/main/java/com/neuedu/filter/CorsConfig.java diff --git a/admin/pom.xml b/admin/pom.xml index 6a062ab..2c2a5e1 100644 --- a/admin/pom.xml +++ b/admin/pom.xml @@ -10,7 +10,7 @@ 4.0.0 admin - jar + jarorg.apache.maven.pluginsmaven-compiler-plugin99 @@ -30,12 +30,6 @@ 1.0-SNAPSHOT - - service - com.neuedu - 1.0-SNAPSHOT - - com.alibaba.cloud @@ -105,6 +99,7 @@ fastjson + diff --git a/admin/src/main/resources/bootstrap.yml b/admin/src/main/resources/bootstrap.yml index 452a7c1..a6de1a3 100644 --- a/admin/src/main/resources/bootstrap.yml +++ b/admin/src/main/resources/bootstrap.yml @@ -1,5 +1,5 @@ server: - port: 8082 + port: 8866 spring: application: name: admin diff --git a/gateway/src/main/java/com/neuedu/filter/CorsConfig.java b/gateway/src/main/java/com/neuedu/filter/CorsConfig.java new file mode 100644 index 0000000..e1ba9ca --- /dev/null +++ b/gateway/src/main/java/com/neuedu/filter/CorsConfig.java @@ -0,0 +1,24 @@ +package com.neuedu.filter; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.cors.CorsConfiguration; +import org.springframework.web.cors.reactive.CorsWebFilter; +import org.springframework.web.cors.reactive.UrlBasedCorsConfigurationSource; +import org.springframework.web.util.pattern.PathPatternParser; + +@Configuration +public class CorsConfig { + @Bean + public CorsWebFilter corsFilter() { + CorsConfiguration config = new CorsConfiguration(); + config.addAllowedMethod("*"); + config.addAllowedOrigin("*"); + config.addAllowedHeader("*"); + + UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(new PathPatternParser()); + source.registerCorsConfiguration("/**", config); + + return new CorsWebFilter(source); + } +} \ No newline at end of file diff --git a/pojo/src/main/java/com/neuedu/pojo/RolePermission.java b/pojo/src/main/java/com/neuedu/pojo/RolePermission.java index c602a7f..d952f6d 100644 --- a/pojo/src/main/java/com/neuedu/pojo/RolePermission.java +++ b/pojo/src/main/java/com/neuedu/pojo/RolePermission.java @@ -1,11 +1,14 @@ package com.neuedu.pojo; -import com.baomidou.mybatisplus.annotation.TableName; -import com.neuedu.pojo.BasePojo; +import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.EqualsAndHashCode; +import java.io.Serializable; + /** *

* 角色权限 @@ -15,11 +18,18 @@ import lombok.EqualsAndHashCode; * @since 2020-09-17 */ @Data -@EqualsAndHashCode(callSuper = true) +@EqualsAndHashCode(callSuper = false) @TableName("sys_role_permission") -public class RolePermission extends BasePojo { +public class RolePermission implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1243525L; + + /** + * 主键 + * + */ + @TableId(type = IdType.AUTO) + private Integer id; /** * 角色id diff --git a/pojo/src/main/java/com/neuedu/pojo/UserRole.java b/pojo/src/main/java/com/neuedu/pojo/UserRole.java index ec3a66b..d5272d6 100644 --- a/pojo/src/main/java/com/neuedu/pojo/UserRole.java +++ b/pojo/src/main/java/com/neuedu/pojo/UserRole.java @@ -1,11 +1,14 @@ package com.neuedu.pojo; -import com.baomidou.mybatisplus.annotation.TableName; -import com.neuedu.pojo.BasePojo; +import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.EqualsAndHashCode; +import java.io.Serializable; + /** *

* 用户角色 @@ -15,11 +18,18 @@ import lombok.EqualsAndHashCode; * @since 2020-09-17 */ @Data -@EqualsAndHashCode(callSuper = true) +@EqualsAndHashCode(callSuper = false) @TableName("sys_user_role") -public class UserRole extends BasePojo { +public class UserRole implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1234452L; + + /** + * 主键 + * + */ + @TableId(type = IdType.AUTO) + private Integer id; /** * 用户id diff --git a/pom.xml b/pom.xml index 7bd0fac..1e27c5b 100644 --- a/pom.xml +++ b/pom.xml @@ -112,13 +112,6 @@ ${fastjson.version} - - org.springframework.boot - spring-boot-devtools - runtime - true - - @@ -137,6 +130,13 @@ ${lombok.version} provided + + + org.springframework.boot + spring-boot-devtools + 2.3.0.RELEASE + + -- Gitee