diff --git a/pom.xml b/pom.xml
index ce2d8f4..c404dc9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -119,6 +119,10 @@
commons-text
1.8
+
+ commons-codec
+ commons-codec
+
io.jsonwebtoken
jjwt
@@ -135,6 +139,25 @@
spring-boot-configuration-processor
true
+
+ io.springfox
+ springfox-swagger2
+ 2.9.2
+
+
+ io.springfox
+ springfox-swagger-ui
+ 2.8.0
+
+
+ org.springframework.boot
+ spring-boot-starter-thymeleaf
+
+
+ net.sourceforge.nekohtml
+ nekohtml
+ 1.9.22
+
diff --git a/src/main/java/com/rymcu/vertical/config/HpeisShiroRealm.java b/src/main/java/com/rymcu/vertical/config/HpeisShiroRealm.java
index 4da8858..ee3bc7a 100644
--- a/src/main/java/com/rymcu/vertical/config/HpeisShiroRealm.java
+++ b/src/main/java/com/rymcu/vertical/config/HpeisShiroRealm.java
@@ -12,6 +12,7 @@ import com.rymcu.vertical.service.UserService;
import com.rymcu.vertical.util.Encodes;
import com.rymcu.vertical.util.Utils;
import org.apache.commons.lang3.StringUtils;
+import org.apache.ibatis.exceptions.TooManyResultsException;
import org.apache.shiro.authc.*;
import org.apache.shiro.authz.AuthorizationInfo;
import org.apache.shiro.authz.SimpleAuthorizationInfo;
@@ -85,8 +86,8 @@ public class HpeisShiroRealm extends AuthorizingRealm {
throw new CaptchaException();
}
try {
- user = userService.findByLoginName(username);
- } catch (ServiceException e) {
+ user = userService.findByAccount(username);
+ } catch (TooManyResultsException e) {
e.printStackTrace();
}
if (user == null) {
@@ -117,7 +118,7 @@ public class HpeisShiroRealm extends AuthorizingRealm {
public Principal(User user, boolean mobileLogin) {
this.id = user.getIdUser();
this.account = user.getAccount();
- this.name = user.getNickName();
+ this.name = user.getNickname();
this.mobileLogin = mobileLogin;
}
diff --git a/src/main/java/com/rymcu/vertical/config/ShiroConfig.java b/src/main/java/com/rymcu/vertical/config/ShiroConfig.java
index 8632a12..c5bbb76 100644
--- a/src/main/java/com/rymcu/vertical/config/ShiroConfig.java
+++ b/src/main/java/com/rymcu/vertical/config/ShiroConfig.java
@@ -49,6 +49,14 @@ public class ShiroConfig implements EnvironmentAware {
filterChainDefinitionMap.put("/js/**", "anon");
filterChainDefinitionMap.put("/uploadFile/**", "anon");
filterChainDefinitionMap.put("/login", "anon");
+
+ filterChainDefinitionMap.put("/swagger-ui.html", "anon");
+ filterChainDefinitionMap.put("/swagger-resources", "anon");
+ filterChainDefinitionMap.put("/swagger-resources/configuration/security", "anon");
+ filterChainDefinitionMap.put("/swagger-resources/configuration/ui", "anon");
+ filterChainDefinitionMap.put("/v2/api-docs", "anon");
+ filterChainDefinitionMap.put("/webjars/springfox-swagger-ui/**", "anon");
+
filterChainDefinitionMap.put("/api/**", "anon");
// filterChainDefinitionMap.put("/**", "authc");
filterChainDefinitionMap.put("/**", "authc");
diff --git a/src/main/java/com/rymcu/vertical/config/Swagger2Configuration.java b/src/main/java/com/rymcu/vertical/config/Swagger2Configuration.java
new file mode 100644
index 0000000..79e773e
--- /dev/null
+++ b/src/main/java/com/rymcu/vertical/config/Swagger2Configuration.java
@@ -0,0 +1,37 @@
+package com.rymcu.vertical.config;
+
+import io.swagger.annotations.Api;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import springfox.documentation.builders.ApiInfoBuilder;
+import springfox.documentation.builders.PathSelectors;
+import springfox.documentation.builders.RequestHandlerSelectors;
+import springfox.documentation.service.ApiInfo;
+import springfox.documentation.spi.DocumentationType;
+import springfox.documentation.spring.web.plugins.Docket;
+import springfox.documentation.swagger2.annotations.EnableSwagger2;
+
+@Configuration
+@EnableSwagger2
+public class Swagger2Configuration {
+
+ @Bean
+ public Docket createRestApi() {
+ return new Docket(DocumentationType.SWAGGER_2)
+ .apiInfo(apiInfo())
+ .select()
+ .apis(RequestHandlerSelectors.basePackage("com.rymcu.vertical.web.api"))//这是注意的代码
+ .paths(PathSelectors.any())
+ .build();
+ }
+
+ private ApiInfo apiInfo() {
+ return new ApiInfoBuilder()
+ .title("Vertical项目接口文档")
+ .description("Vertical项目相关接口的文档")
+ .termsOfServiceUrl("http://www.rymcu.com")
+ .version("1.0")
+ .build();
+ }
+
+}
diff --git a/src/main/java/com/rymcu/vertical/config/WebMvcConfigurer.java b/src/main/java/com/rymcu/vertical/config/WebMvcConfigurer.java
index 11c0972..7aa8c41 100644
--- a/src/main/java/com/rymcu/vertical/config/WebMvcConfigurer.java
+++ b/src/main/java/com/rymcu/vertical/config/WebMvcConfigurer.java
@@ -71,9 +71,7 @@ public class WebMvcConfigurer extends WebMvcConfigurationSupport {
public void addInterceptors(InterceptorRegistry registry) {
// TODO 先不拦截接口,进行测试
registry.addInterceptor(restAuthTokenInterceptor()).addPathPatterns("/api/**")
- .excludePathPatterns("/api/login/**", "/api/logout","/api/member/*",
- "/api/home/*","/api/item/**","/api/searchHistory/**", "/api/pay/payNotify",
- "/api/mall/oauth/**","/api/express/**","/api/person/**");
+ .excludePathPatterns("/api/v1/**");
}
diff --git a/src/main/java/com/rymcu/vertical/core/result/GlobalResultMessage.java b/src/main/java/com/rymcu/vertical/core/result/GlobalResultMessage.java
new file mode 100644
index 0000000..55afdd8
--- /dev/null
+++ b/src/main/java/com/rymcu/vertical/core/result/GlobalResultMessage.java
@@ -0,0 +1,15 @@
+package com.rymcu.vertical.core.result;
+
+public enum GlobalResultMessage {
+
+ SUCCESS("操作成功!"),
+ FAIL("操作失败!"),
+ SEND_FAIL("发送失败,请稍后再试!"),
+ SEND_SUCCESS("发送成功!");
+
+ private String message;
+
+ GlobalResultMessage(String message){
+ this.message = message;
+ }
+}
diff --git a/src/main/java/com/rymcu/vertical/dto/RoleDTO.java b/src/main/java/com/rymcu/vertical/dto/RoleDTO.java
index 13c261e..6c3a3c8 100644
--- a/src/main/java/com/rymcu/vertical/dto/RoleDTO.java
+++ b/src/main/java/com/rymcu/vertical/dto/RoleDTO.java
@@ -12,14 +12,8 @@ public class RoleDTO {
private String name;
// 英文名称
- private String enname;
-
- // 用户类别
- private String roleType;
+ private String inputCode;
// 角色授权菜单ids
private String menuIds;
-
- // 备注
- private String remarks;
}
diff --git a/src/main/java/com/rymcu/vertical/dto/TUser.java b/src/main/java/com/rymcu/vertical/dto/TUser.java
new file mode 100644
index 0000000..3f37530
--- /dev/null
+++ b/src/main/java/com/rymcu/vertical/dto/TUser.java
@@ -0,0 +1,18 @@
+package com.rymcu.vertical.dto;
+
+import lombok.Data;
+
+@Data
+public class TUser {
+
+ private String account;
+
+ private String nickname;
+
+ private String token;
+
+ private String avatarType;
+
+ private String avatarUrl;
+
+}
diff --git a/src/main/java/com/rymcu/vertical/dto/UserExportDTO.java b/src/main/java/com/rymcu/vertical/dto/UserExportDTO.java
deleted file mode 100644
index 2a0d5dd..0000000
--- a/src/main/java/com/rymcu/vertical/dto/UserExportDTO.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package com.rymcu.vertical.dto;
-
-import lombok.Data;
-
-@Data
-public class UserExportDTO {
-
- private String officeName;
-
- private String name;
-
- private String sex;
-
- private String loginName;
-
- private String storePerm;
-
- private String departPerm;
-}
diff --git a/src/main/java/com/rymcu/vertical/entity/Menu.java b/src/main/java/com/rymcu/vertical/entity/Menu.java
index 68dcf39..edd0bdd 100644
--- a/src/main/java/com/rymcu/vertical/entity/Menu.java
+++ b/src/main/java/com/rymcu/vertical/entity/Menu.java
@@ -14,13 +14,13 @@ import java.util.Date;
public class Menu {
@Id
- @Column(name = "ID_MENU")
+ @Column(name = "id")
private Integer idMenu;
/**
* 上级菜单ID
* */
- @Column(name = "PARENT_ID")
+ @Column(name = "parent_id")
private String parentId;
/**
@@ -57,12 +57,12 @@ public class Menu {
/**
* 创建时间
* */
- @Column(name = "CREATED_TIME")
+ @Column(name = "created_time")
private Date createdTime;
/**
* 状态
* */
- @Column(name = "STATUS")
+ @Column(name = "status")
private String status;
}
\ No newline at end of file
diff --git a/src/main/java/com/rymcu/vertical/entity/Role.java b/src/main/java/com/rymcu/vertical/entity/Role.java
index 9c231f8..e7fbcef 100644
--- a/src/main/java/com/rymcu/vertical/entity/Role.java
+++ b/src/main/java/com/rymcu/vertical/entity/Role.java
@@ -8,33 +8,39 @@ import javax.persistence.Table;
import java.util.Date;
@Data
-@Table(name = "SYS_ROLE")
+@Table(name = "sys_role")
public class Role {
@Id
- @Column(name = "ID_ROLE")
- private String idRole;
+ @Column(name = "id")
+ private Integer idRole;
/**
* 角色名称
* */
- @Column(name = "NAME")
+ @Column(name = "name")
private String name;
/**
* 拼音码
* */
- @Column(name = "INPUT_CODE")
+ @Column(name = "input_code")
private String inputCode;
/**
* 状态
* */
- @Column(name = "STATUS")
- private Integer status;
+ @Column(name = "status")
+ private String status;
/**
* 创建时间
* */
- @Column(name = "CREATED_TIME")
+ @Column(name = "created_time")
private Date createdTime;
+
+ /**
+ * 更新时间
+ * */
+ @Column(name = "updated_time")
+ private Date updatedTime;
}
\ No newline at end of file
diff --git a/src/main/java/com/rymcu/vertical/entity/User.java b/src/main/java/com/rymcu/vertical/entity/User.java
index 096c3c4..70464e9 100644
--- a/src/main/java/com/rymcu/vertical/entity/User.java
+++ b/src/main/java/com/rymcu/vertical/entity/User.java
@@ -9,97 +9,97 @@ import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;
-@Table(name = "SYS_USER")
+@Table(name = "sys_user")
@Data
public class User {
@Id
- @Column(name = "ID_USER")
+ @Column(name = "id")
private Integer idUser;
- /**
- * 应用ID
- * */
- @Column(name = "APP_ID")
- private String appId;
-
/**
* 登录账号
* */
- @Column(name = "ACCOUNT")
+ @Column(name = "account")
private String account;
/**
* 密码
* */
- @Column(name = "PASSWORD")
+ @Column(name = "password")
private String password;
/**
* 昵称
* */
- @Column(name = "NICK_NAME")
- private String nickName;
+ @Column(name = "nickname")
+ private String nickname;
/**
* 真实姓名
* */
- @Column(name = "REAL_NAME")
+ @Column(name = "real_name")
private String realName;
/**
* 性别 1:男性 2:女性
* */
- @Column(name = "SEX")
- private Integer sex;
+ @Column(name = "sex")
+ private String sex;
/**
* 头像文件类型
* */
- @Column(name = "AVATAR_TYPE")
- private Integer avatarType;
+ @Column(name = "avatar_type")
+ private String avatarType;
/**
* 头像路径
* */
- @Column(name = "AVATAR_URL")
+ @Column(name = "avatar_url")
private String avatarUrl;
/**
* 邮箱地址
* */
- @ColumnType(column = "EMAIL",
+ @ColumnType(column = "email",
jdbcType = JdbcType.VARCHAR)
private String email;
/**
* 手机号码
* */
- @ColumnType(column = "PHONE",
+ @ColumnType(column = "phone",
jdbcType = JdbcType.VARCHAR)
private String phone;
/**
* 签名
* */
- @ColumnType(column = "SIGNATURE",
+ @ColumnType(column = "signature",
jdbcType = JdbcType.VARCHAR)
private String signature;
/**
* 状态
* */
- @Column(name = "STATUS")
- private Integer status;
+ @Column(name = "status")
+ private String status;
/**
* 最后登录时间
* */
- @Column(name = "LAST_LOGIN_TIME")
+ @Column(name = "last_login_time")
private Date lastLoginTime;
/**
* 创建时间
* */
- @Column(name = "CREATED_TIME")
+ @Column(name = "created_time")
private Date createdTime;
+
+ /**
+ * 创建时间
+ * */
+ @Column(name = "updated_time")
+ private Date updatedTime;
}
\ No newline at end of file
diff --git a/src/main/java/com/rymcu/vertical/mapper/MenuMapper.java b/src/main/java/com/rymcu/vertical/mapper/MenuMapper.java
index ac8ea45..bcb4769 100644
--- a/src/main/java/com/rymcu/vertical/mapper/MenuMapper.java
+++ b/src/main/java/com/rymcu/vertical/mapper/MenuMapper.java
@@ -10,15 +10,5 @@ import java.util.List;
public interface MenuMapper extends Mapper