@@ -60,8 +60,8 @@ Redis | 3.2+ | |
### Technology stack
Component| Version | Remark
-|-|-
-Spring Boot | 2.1.8.RELEASE | Latest release stable version |
-Spring Framework | 5.1.9.RELEASE | Latest release stable version |
+Spring Boot | 2.1.9.RELEASE | Latest release stable version |
+Spring Framework | 5.1.10.RELEASE | Latest release stable version |
Mybatis | 3.5.2 | DAO Framework |
Mybatis Plus | 3.2.0 | mybatis Enhanced framework |
Alibaba Druid | 1.1.20 | Data source |
diff --git a/pom.xml b/pom.xml
index 9737f7b9..c7dc86cc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -21,7 +21,7 @@
io.geekidea
spring-boot-plus
- 1.3.0.RELEASE
+ 1.3.1.RELEASE
jar
spring-boot-plus
@@ -47,7 +47,7 @@
${utf8}
${parent.version}
1.8
- 2.1.0.RELEASE
+ 2.1.9.RELEASE
3.2.0
1.2.60
2.6.1
@@ -260,11 +260,12 @@
-
- de.codecentric
- spring-boot-admin-starter-client
- ${spring-boot-admin.version}
-
+
+
+
+
+
+
@@ -301,6 +302,14 @@
+
+
+ org.apache.commons
+ commons-text
+ 1.8
+
+
+
diff --git a/src/main/java/io/geekidea/springbootplus/SpringBootPlusApplication.java b/src/main/java/io/geekidea/springbootplus/SpringBootPlusApplication.java
index f47b227d..61faf58c 100644
--- a/src/main/java/io/geekidea/springbootplus/SpringBootPlusApplication.java
+++ b/src/main/java/io/geekidea/springbootplus/SpringBootPlusApplication.java
@@ -16,12 +16,12 @@
package io.geekidea.springbootplus;
-import de.codecentric.boot.admin.server.config.EnableAdminServer;
import io.geekidea.springbootplus.util.PrintApplicationInfo;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
@@ -37,8 +37,9 @@
@EnableScheduling
@EnableTransactionManagement
@EnableConfigurationProperties
-@EnableAdminServer
+//@EnableAdminServer
@MapperScan({"io.geekidea.springbootplus.**.mapper"})
+@ServletComponentScan
@SpringBootApplication
public class SpringBootPlusApplication {
diff --git a/src/main/java/io/geekidea/springbootplus/common/aop/LogAop.java b/src/main/java/io/geekidea/springbootplus/common/aop/LogAop.java
index 1b0c9bb9..3429bc06 100644
--- a/src/main/java/io/geekidea/springbootplus/common/aop/LogAop.java
+++ b/src/main/java/io/geekidea/springbootplus/common/aop/LogAop.java
@@ -37,11 +37,10 @@
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
-import java.util.Date;
-import java.util.LinkedHashMap;
-import java.util.Map;
+import java.util.*;
/**
*
@@ -60,7 +59,7 @@ public class LogAop {
/**
* 切点
*/
- private static final String POINTCUT = "execution(public * io.geekidea.springbootplus.*.web.controller..*.*(..))";
+ private static final String POINTCUT = "execution(public * io.geekidea.springbootplus..*.controller..*.*(..))";
/**
* 默认的请求内容类型,表单提交
**/
@@ -98,7 +97,7 @@ public Object doAround(ProceedingJoinPoint joinPoint) throws Throwable {
HttpServletRequest request = attributes.getRequest();
- Map map = new LinkedHashMap<>();
+ Map map = new LinkedHashMap<>();
// 获取请求类名和方法名称
Signature signature = joinPoint.getSignature();
@@ -109,76 +108,74 @@ public Object doAround(ProceedingJoinPoint joinPoint) throws Throwable {
// 请求全路径
String url = request.getRequestURI();
- map.put("path",url);
+ map.put("path", url);
// IP地址
String ip = IpUtil.getRequestIp();
- map.put("ip",ip);
+ map.put("ip", ip);
// 获取请求方式
String requestMethod = request.getMethod();
- map.put("requestMethod",requestMethod);
+ map.put("requestMethod", requestMethod);
// 获取请求内容类型
String contentType = request.getContentType();
- map.put("contentType",contentType);
+ map.put("contentType", contentType);
// 判断控制器方法参数中是否有RequestBody注解
Annotation[][] annotations = method.getParameterAnnotations();
boolean isRequestBody = isRequestBody(annotations);
- map.put("isRequestBody",isRequestBody);
+ map.put("isRequestBody", isRequestBody);
// 设置请求参数
Object requestParamJson = getRequestParamJsonString(joinPoint, request, requestMethod, contentType, isRequestBody);
- map.put("param",requestParamJson);
+ map.put("param", requestParamJson);
map.put("time", DateUtil.getYYYYMMDDHHMMSS(new Date()));
// 获取请求头token
- map.put("token",request.getHeader(JwtTokenUtil.getTokenName()));
+ map.put("token", request.getHeader(JwtTokenUtil.getTokenName()));
String requestInfo = null;
try {
- if (requestLogFormat){
- requestInfo = "\n" + JSON.toJSONString(map,true);
- }else{
+ if (requestLogFormat) {
+ requestInfo = "\n" + JSON.toJSONString(map, true);
+ } else {
requestInfo = JSON.toJSONString(map);
}
} catch (Exception e) {
}
- log.info(AnsiUtil.getAnsi(Ansi.Color.GREEN,"requestInfo:" + requestInfo));
+ log.info(AnsiUtil.getAnsi(Ansi.Color.GREEN, "requestInfo:" + requestInfo));
} catch (Exception e) {
e.printStackTrace();
}
-
// 执行目标方法,获得返回值
Object result = joinPoint.proceed();
- try{
- if (result != null && result instanceof ApiResult){
+ try {
+ if (result != null && result instanceof ApiResult) {
ApiResult apiResult = (ApiResult) result;
int code = apiResult.getCode();
String responseResultInfo = "responseResult:";
- if (responseLogFormat){
- responseResultInfo += "\n" + JSON.toJSONString(apiResult,true);
- }else{
+ if (responseLogFormat) {
+ responseResultInfo += "\n" + JSON.toJSONString(apiResult, true);
+ } else {
responseResultInfo += JSON.toJSONString(apiResult);
}
- if (code == ApiCode.SUCCESS.getCode()){
- log.info(AnsiUtil.getAnsi(Ansi.Color.BLUE,responseResultInfo));
- }else{
- log.error(AnsiUtil.getAnsi(Ansi.Color.RED,responseResultInfo));
+ if (code == ApiCode.SUCCESS.getCode()) {
+ log.info(AnsiUtil.getAnsi(Ansi.Color.BLUE, responseResultInfo));
+ } else {
+ log.error(AnsiUtil.getAnsi(Ansi.Color.RED, responseResultInfo));
}
}
- }catch (Exception e){
- log.error("处理响应结果异常",e);
+ } catch (Exception e) {
+ log.error("处理响应结果异常", e);
}
return result;
}
-
/**
* 获取请求参数JSON字符串
*
@@ -255,10 +252,21 @@ private Object argsArrayToJsonString(Object[] args) {
if (args == null) {
return null;
}
- if (args.length == 1) {
- return args[0];
+ // 去掉HttpServletRequest和HttpServletResponse
+ List realArgs = new ArrayList<>();
+ for (Object arg : args) {
+ if (arg instanceof HttpServletRequest) {
+ continue;
+ }
+ if (arg instanceof HttpServletResponse) {
+ continue;
+ }
+ realArgs.add(arg);
+ }
+ if (realArgs.size() == 1) {
+ return realArgs.get(0);
} else {
- return args;
+ return realArgs;
}
}
diff --git a/src/main/java/io/geekidea/springbootplus/config/json/jackson/JacksonConfig.java b/src/main/java/io/geekidea/springbootplus/config/json/jackson/JacksonConfig.java
index d1ec2b1a..cecb10a2 100644
--- a/src/main/java/io/geekidea/springbootplus/config/json/jackson/JacksonConfig.java
+++ b/src/main/java/io/geekidea/springbootplus/config/json/jackson/JacksonConfig.java
@@ -34,6 +34,8 @@
import io.geekidea.springbootplus.config.json.jackson.deserializer.JacksonDoubleDeserializer;
import io.geekidea.springbootplus.config.json.jackson.serializer.JacksonDateSerializer;
import io.geekidea.springbootplus.config.json.jackson.serializer.JacksonIntegerDeserializer;
+import io.geekidea.springbootplus.xss.XssJacksonDeserializer;
+import io.geekidea.springbootplus.xss.XssJacksonSerializer;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
@@ -47,7 +49,6 @@
import java.util.List;
/**
- *
* @author geekidea
* @author 2018-11-08
*/
@@ -67,29 +68,33 @@ public void extendMessageConverters(List> converters) {
simpleModule.addSerializer(Long.class, ToStringSerializer.instance);
simpleModule.addSerializer(Long.TYPE, ToStringSerializer.instance);
+ // XSS序列化
+ simpleModule.addSerializer(String.class, new XssJacksonSerializer());
+ simpleModule.addDeserializer(String.class, new XssJacksonDeserializer());
+
// Date
- simpleModule.addSerializer(Date.class,new JacksonDateSerializer());
- simpleModule.addDeserializer(Date.class,new JacksonDateDeserializer());
+ simpleModule.addSerializer(Date.class, new JacksonDateSerializer());
+ simpleModule.addDeserializer(Date.class, new JacksonDateDeserializer());
- simpleModule.addDeserializer(Integer.class,new JacksonIntegerDeserializer());
- simpleModule.addDeserializer(Double.class,new JacksonDoubleDeserializer());
+ simpleModule.addDeserializer(Integer.class, new JacksonIntegerDeserializer());
+ simpleModule.addDeserializer(Double.class, new JacksonDoubleDeserializer());
// jdk8日期序列化和反序列化设置
JavaTimeModule javaTimeModule = new JavaTimeModule();
- javaTimeModule.addSerializer(LocalDateTime.class,new LocalDateTimeSerializer(DateTimeFormatter.ofPattern(DatePattern.yyyy_MM_dd_HH_mm_ss)));
- javaTimeModule.addDeserializer(LocalDateTime.class,new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern(DatePattern.yyyy_MM_dd_HH_mm_ss)));
-
- javaTimeModule.addSerializer(LocalDate.class,new LocalDateSerializer(DateTimeFormatter.ofPattern(DatePattern.yyyy_MM_dd)));
- javaTimeModule.addDeserializer(LocalDate.class,new LocalDateDeserializer(DateTimeFormatter.ofPattern(DatePattern.yyyy_MM_dd)));
-
- javaTimeModule.addSerializer(LocalTime.class,new LocalTimeSerializer(DateTimeFormatter.ofPattern(DatePattern.HH_mm_ss)));
- javaTimeModule.addDeserializer(LocalTime.class,new LocalTimeDeserializer(DateTimeFormatter.ofPattern(DatePattern.HH_mm_ss)));
+ javaTimeModule.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(DateTimeFormatter.ofPattern(DatePattern.yyyy_MM_dd_HH_mm_ss)));
+ javaTimeModule.addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern(DatePattern.yyyy_MM_dd_HH_mm_ss)));
+
+ javaTimeModule.addSerializer(LocalDate.class, new LocalDateSerializer(DateTimeFormatter.ofPattern(DatePattern.yyyy_MM_dd)));
+ javaTimeModule.addDeserializer(LocalDate.class, new LocalDateDeserializer(DateTimeFormatter.ofPattern(DatePattern.yyyy_MM_dd)));
+
+ javaTimeModule.addSerializer(LocalTime.class, new LocalTimeSerializer(DateTimeFormatter.ofPattern(DatePattern.HH_mm_ss)));
+ javaTimeModule.addDeserializer(LocalTime.class, new LocalTimeDeserializer(DateTimeFormatter.ofPattern(DatePattern.HH_mm_ss)));
objectMapper.registerModule(simpleModule).registerModule(javaTimeModule).registerModule(new ParameterNamesModule());
jackson2HttpMessageConverter.setObjectMapper(objectMapper);
//放到第一个
- converters.add(0,jackson2HttpMessageConverter);
+ converters.add(0, jackson2HttpMessageConverter);
}
}
\ No newline at end of file
diff --git a/src/main/java/io/geekidea/springbootplus/core/config/SpringBootPlusConfig.java b/src/main/java/io/geekidea/springbootplus/core/config/SpringBootPlusConfig.java
index b125a9de..ea5ffe87 100644
--- a/src/main/java/io/geekidea/springbootplus/core/config/SpringBootPlusConfig.java
+++ b/src/main/java/io/geekidea/springbootplus/core/config/SpringBootPlusConfig.java
@@ -17,10 +17,7 @@
import io.geekidea.springbootplus.common.aop.LogAop;
import io.geekidea.springbootplus.common.web.interceptor.PermissionInterceptor;
-import io.geekidea.springbootplus.core.properties.SpringBootPlusCorsProperties;
-import io.geekidea.springbootplus.core.properties.SpringBootPlusFilterProperties;
-import io.geekidea.springbootplus.core.properties.SpringBootPlusInterceptorProperties;
-import io.geekidea.springbootplus.core.properties.SpringBootPlusProperties;
+import io.geekidea.springbootplus.core.properties.*;
import io.geekidea.springbootplus.resource.web.interceptor.DownloadInterceptor;
import io.geekidea.springbootplus.resource.web.interceptor.ResourceInterceptor;
import io.geekidea.springbootplus.resource.web.interceptor.UploadInterceptor;
@@ -47,7 +44,8 @@
SpringBootPlusProperties.class,
SpringBootPlusCorsProperties.class,
SpringBootPlusFilterProperties.class,
- SpringBootPlusInterceptorProperties.class
+ SpringBootPlusInterceptorProperties.class,
+ SpringBootPlusAopProperties.class
})
public class SpringBootPlusConfig {
diff --git a/src/main/java/io/geekidea/springbootplus/core/properties/SpringBootPlusAopProperties.java b/src/main/java/io/geekidea/springbootplus/core/properties/SpringBootPlusAopProperties.java
new file mode 100644
index 00000000..93dfaaa4
--- /dev/null
+++ b/src/main/java/io/geekidea/springbootplus/core/properties/SpringBootPlusAopProperties.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2019-2029 geekidea(https://github.com/geekidea)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.geekidea.springbootplus.core.properties;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.boot.context.properties.NestedConfigurationProperty;
+
+/**
+ * AOP配置属性
+ *
+ * @author geekidea
+ * @date 2019-09-29
+ * @since 1.3.0.RELEASE
+ **/
+@Data
+@ConfigurationProperties(prefix = "spring-boot-plus.aop")
+public class SpringBootPlusAopProperties {
+
+ /**
+ * 请求路径Filter配置
+ */
+ @NestedConfigurationProperty
+ private AopConfig log = new LogAopConfig();
+
+ @Data
+ public static class AopConfig {
+
+ /**
+ * 是否启用
+ */
+ private boolean enabled;
+
+ /**
+ * 切点表达式
+ */
+ private String pointcut;
+
+ }
+
+
+ @Data
+ public static class LogAopConfig extends AopConfig{
+
+ /**
+ * 请求日志在控制台是否格式化输出,local环境建议开启,服务器环境设置为false
+ */
+ private boolean requestLogFormat;
+
+ /**
+ * 响应日志在控制台是否格式化输出,local环境建议开启,服务器环境设置为false
+ */
+ private boolean responseLogFormat;
+
+ }
+
+}
diff --git a/src/main/java/io/geekidea/springbootplus/core/properties/SpringBootPlusFilterProperties.java b/src/main/java/io/geekidea/springbootplus/core/properties/SpringBootPlusFilterProperties.java
index 1fa0310a..5722988d 100644
--- a/src/main/java/io/geekidea/springbootplus/core/properties/SpringBootPlusFilterProperties.java
+++ b/src/main/java/io/geekidea/springbootplus/core/properties/SpringBootPlusFilterProperties.java
@@ -21,6 +21,8 @@
import org.springframework.boot.context.properties.NestedConfigurationProperty;
/**
+ * Filter配置属性
+ *
* @author geekidea
* @date 2019-09-29
* @since 1.3.0.RELEASE
diff --git a/src/main/java/io/geekidea/springbootplus/core/properties/SpringBootPlusStaticProperties.java b/src/main/java/io/geekidea/springbootplus/core/properties/SpringBootPlusStaticProperties.java
new file mode 100644
index 00000000..bbc7dcbe
--- /dev/null
+++ b/src/main/java/io/geekidea/springbootplus/core/properties/SpringBootPlusStaticProperties.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2019-2029 geekidea(https://github.com/geekidea)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.geekidea.springbootplus.core.properties;
+
+import com.oracle.tools.packager.Log;
+import lombok.Data;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Configuration;
+
+import javax.annotation.PostConstruct;
+
+/**
+ * 配置文件属性映射为静态属性
+ *
+ * @author geekidea
+ * @date 2019-10-11
+ * @since 1.3.1.RELEASE
+ **/
+@Data
+@Configuration
+public class SpringBootPlusStaticProperties {
+
+ public static String INFO_PROJECT_VERSION = "";
+
+ @Value("${info.project-version}")
+ private String infoProjectVersion;
+
+ @PostConstruct
+ public void init() {
+ INFO_PROJECT_VERSION = this.infoProjectVersion;
+ Log.debug("INFO_PROJECT_VERSION:" + INFO_PROJECT_VERSION);
+ }
+
+}
diff --git a/src/main/java/io/geekidea/springbootplus/shiro/config/ShiroConfig.java b/src/main/java/io/geekidea/springbootplus/shiro/config/ShiroConfig.java
index fb9377a9..13ea3f91 100644
--- a/src/main/java/io/geekidea/springbootplus/shiro/config/ShiroConfig.java
+++ b/src/main/java/io/geekidea/springbootplus/shiro/config/ShiroConfig.java
@@ -302,6 +302,7 @@ public LifecycleBeanPostProcessor lifecycleBeanPostProcessor() {
@Bean
public DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator() {
DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator = new DefaultAdvisorAutoProxyCreator();
+ defaultAdvisorAutoProxyCreator.setProxyTargetClass(true);
return defaultAdvisorAutoProxyCreator;
}
diff --git a/src/main/java/io/geekidea/springbootplus/shiro/controller/LoginController.java b/src/main/java/io/geekidea/springbootplus/shiro/controller/LoginController.java
index 237bf88a..76c08381 100644
--- a/src/main/java/io/geekidea/springbootplus/shiro/controller/LoginController.java
+++ b/src/main/java/io/geekidea/springbootplus/shiro/controller/LoginController.java
@@ -17,8 +17,6 @@
package io.geekidea.springbootplus.shiro.controller;
import io.geekidea.springbootplus.common.api.ApiResult;
-import io.geekidea.springbootplus.shiro.cache.LoginRedisService;
-import io.geekidea.springbootplus.shiro.jwt.JwtProperties;
import io.geekidea.springbootplus.shiro.param.LoginParam;
import io.geekidea.springbootplus.shiro.service.LoginService;
import io.geekidea.springbootplus.system.web.vo.SysUserQueryVo;
@@ -49,12 +47,6 @@ public class LoginController {
@Autowired
private LoginService loginService;
- @Autowired
- private LoginRedisService loginRedisService;
-
- @Autowired
- private JwtProperties jwtProperties;
-
@PostMapping("/login")
@ApiOperation(value = "登陆", notes = "系统用户登陆", response = SysUserQueryVo.class)
public ApiResult login(@Valid @RequestBody LoginParam loginParam, HttpServletResponse response) {
diff --git a/src/main/java/io/geekidea/springbootplus/xss/XssFilter.java b/src/main/java/io/geekidea/springbootplus/xss/XssFilter.java
new file mode 100644
index 00000000..02815830
--- /dev/null
+++ b/src/main/java/io/geekidea/springbootplus/xss/XssFilter.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2019-2029 geekidea(https://github.com/geekidea)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.geekidea.springbootplus.xss;
+
+import lombok.extern.slf4j.Slf4j;
+
+import javax.servlet.*;
+import javax.servlet.annotation.WebFilter;
+import javax.servlet.http.HttpServletRequest;
+import java.io.IOException;
+
+/**
+ * Xss过滤器
+ *
+ * @author geekidea
+ * @date 2019-10-10
+ * @since 1.3.1.RELEASE
+ **/
+@Slf4j
+@WebFilter(filterName = "xssFilter", urlPatterns = "/*", asyncSupported = true)
+public class XssFilter implements Filter {
+ @Override
+ public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
+ HttpServletRequest request = (HttpServletRequest) servletRequest;
+ XssHttpServletRequestWrapper xssHttpServletRequestWrapper = new XssHttpServletRequestWrapper(request);
+ filterChain.doFilter(xssHttpServletRequestWrapper, servletResponse);
+ }
+}
diff --git a/src/main/java/io/geekidea/springbootplus/xss/XssHttpServletRequestWrapper.java b/src/main/java/io/geekidea/springbootplus/xss/XssHttpServletRequestWrapper.java
new file mode 100644
index 00000000..772593ad
--- /dev/null
+++ b/src/main/java/io/geekidea/springbootplus/xss/XssHttpServletRequestWrapper.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2019-2029 geekidea(https://github.com/geekidea)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.geekidea.springbootplus.xss;
+
+import org.apache.commons.lang3.ArrayUtils;
+import org.apache.commons.text.StringEscapeUtils;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletRequestWrapper;
+
+/**
+ * XSS 跨站脚本攻击(Cross Site Scripting) 处理
+ *
+ * @author geekidea
+ * @date 2019-10-10
+ * @since 1.3.1.RELEASE
+ **/
+public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper {
+
+ public XssHttpServletRequestWrapper(HttpServletRequest request) {
+ super(request);
+ }
+
+ @Override
+ public String getQueryString() {
+ String value = super.getQueryString();
+ return StringEscapeUtils.escapeHtml4(value);
+ }
+
+ @Override
+ public String getParameter(String name) {
+ String value = super.getParameter(name);
+ return StringEscapeUtils.escapeHtml4(value);
+ }
+
+ @Override
+ public String[] getParameterValues(String name) {
+ String[] values = super.getParameterValues(name);
+ if (ArrayUtils.isEmpty(values)) {
+ return values;
+ }
+ int length = values.length;
+ String[] escapeValues = new String[length];
+ for (int i = 0; i < length; i++) {
+ String value = values[i];
+ escapeValues[i] = StringEscapeUtils.escapeHtml4(value);
+ }
+ return escapeValues;
+ }
+
+}
diff --git a/src/main/java/io/geekidea/springbootplus/xss/XssJacksonDeserializer.java b/src/main/java/io/geekidea/springbootplus/xss/XssJacksonDeserializer.java
new file mode 100644
index 00000000..cba32137
--- /dev/null
+++ b/src/main/java/io/geekidea/springbootplus/xss/XssJacksonDeserializer.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2019-2029 geekidea(https://github.com/geekidea)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.geekidea.springbootplus.xss;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.JsonDeserializer;
+import org.apache.commons.text.StringEscapeUtils;
+
+import java.io.IOException;
+
+/**
+ * Jackson请求参数字符串转义处理
+ *
+ * @author geekidea
+ * @date 2019-10-10
+ * @since 1.3.1.RELEASE
+ **/
+public class XssJacksonDeserializer extends JsonDeserializer {
+
+ @Override
+ public String deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
+ String string = jsonParser.getText();
+ return StringEscapeUtils.escapeHtml4(string);
+ }
+
+}
diff --git a/src/main/java/io/geekidea/springbootplus/xss/XssJacksonSerializer.java b/src/main/java/io/geekidea/springbootplus/xss/XssJacksonSerializer.java
new file mode 100644
index 00000000..eb988c22
--- /dev/null
+++ b/src/main/java/io/geekidea/springbootplus/xss/XssJacksonSerializer.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2019-2029 geekidea(https://github.com/geekidea)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.geekidea.springbootplus.xss;
+
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.databind.JsonSerializer;
+import com.fasterxml.jackson.databind.SerializerProvider;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.text.StringEscapeUtils;
+
+import java.io.IOException;
+
+/**
+ * Jackson响应参数字符串转义处理
+ *
+ * @author geekidea
+ * @date 2019-10-10
+ * @since 1.3.1.RELEASE
+ **/
+public class XssJacksonSerializer extends JsonSerializer {
+
+ @Override
+ public void serialize(String s, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
+ if (StringUtils.isNotBlank(s)) {
+ String escapeValue = StringEscapeUtils.escapeHtml4(s);
+ jsonGenerator.writeString(escapeValue);
+ }
+ }
+
+}
diff --git a/src/main/resources/config/application.yml b/src/main/resources/config/application.yml
index 6e4c6c87..1d3244ad 100644
--- a/src/main/resources/config/application.yml
+++ b/src/main/resources/config/application.yml
@@ -38,6 +38,22 @@ spring:
############################## spring-boot-plus start ##############################
spring-boot-plus:
+ # 是否启用ansi控制台输出有颜色的字体
+ enable-ansi: true
+ # 请求日志在控制台是否格式化输出
+ request-log-format: true
+ # 响应日志在控制台是否格式化输出
+ response-log-format: true
+ # 过滤器配置
+ filter:
+ # 请求路径Filter配置
+ request-path:
+ enabled: true
+ include-paths: /**
+ # 排除路径,多行字符串配置
+ exclude-paths: |
+ /actuator/**,/instances,/logfile,/sba-settings.js,/assets/img/favicon.png,
+ /swagger-ui.html,/swagger-resources/**,/webjars/springfox-swagger-ui/**,/v2/api-docs
# 拦截器配置
interceptor:
permission:
@@ -54,17 +70,6 @@ spring-boot-plus:
enabled: true
include-paths: /download/**
- # 过滤器配置
- filter:
- # 请求路径Filter配置
- request-path:
- enabled: true
- include-paths: /**
- # 排除路径,多行字符串配置
- exclude-paths: |
- /actuator/**,/instances,/logfile,/sba-settings.js,/assets/img/favicon.png,
- /swagger-ui.html,/swagger-resources/**,/webjars/springfox-swagger-ui/**,/v2/api-docs
-
# 文件上传下载配置
# 上传路径配置
upload-path: /opt/upload/
@@ -115,6 +120,7 @@ spring-boot-plus:
/templates/**=anon
/druid/**=anon
/hello/world=anon
+ /xss/**=anon
# 权限配置
permission:
# 排除登陆登出相关
@@ -220,12 +226,6 @@ spring:
---
spring:
redis:
- jedis:
- pool:
- max-active: 2000
- max-wait: -1ms
- min-idle: 8
- max-idle: 200
timeout: 10s
lettuce:
pool:
From 00b49f013a23c40f2ac828075ac8404751577911 Mon Sep 17 00:00:00 2001
From: springboot-plus
Date: Fri, 11 Oct 2019 16:33:30 +0800
Subject: [PATCH 05/21] =?UTF-8?q?:cn:=20=E4=BB=A3=E7=A0=81=E7=94=9F?=
=?UTF-8?q?=E6=88=90Validation=E5=AD=97=E6=AE=B5=E9=AA=8C=E8=AF=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pom.xml | 3 +-
.../SpringBootPlusStaticProperties.java | 5 +--
.../config/SpringBootPlusMySqlQuery.java | 34 +++++++++++++++++++
.../generator/package-info.java | 21 ++++++++++++
.../springbootplus/test/CodeGenerator.java | 4 +++
src/test/resources/templates/entity.java.vm | 13 +++++++
6 files changed, 77 insertions(+), 3 deletions(-)
create mode 100644 src/main/java/io/geekidea/springbootplus/generator/config/SpringBootPlusMySqlQuery.java
create mode 100644 src/main/java/io/geekidea/springbootplus/generator/package-info.java
diff --git a/pom.xml b/pom.xml
index c7dc86cc..06414511 100644
--- a/pom.xml
+++ b/pom.xml
@@ -70,6 +70,7 @@
1.3.0.Final
1.4.1
3.8.3
+ 1.8
3.8.1
3.1.0
@@ -306,7 +307,7 @@
org.apache.commons
commons-text
- 1.8
+ ${commons-text.version}
diff --git a/src/main/java/io/geekidea/springbootplus/core/properties/SpringBootPlusStaticProperties.java b/src/main/java/io/geekidea/springbootplus/core/properties/SpringBootPlusStaticProperties.java
index bbc7dcbe..a843354f 100644
--- a/src/main/java/io/geekidea/springbootplus/core/properties/SpringBootPlusStaticProperties.java
+++ b/src/main/java/io/geekidea/springbootplus/core/properties/SpringBootPlusStaticProperties.java
@@ -16,8 +16,8 @@
package io.geekidea.springbootplus.core.properties;
-import com.oracle.tools.packager.Log;
import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
@@ -30,6 +30,7 @@
* @date 2019-10-11
* @since 1.3.1.RELEASE
**/
+@Slf4j
@Data
@Configuration
public class SpringBootPlusStaticProperties {
@@ -42,7 +43,7 @@ public class SpringBootPlusStaticProperties {
@PostConstruct
public void init() {
INFO_PROJECT_VERSION = this.infoProjectVersion;
- Log.debug("INFO_PROJECT_VERSION:" + INFO_PROJECT_VERSION);
+ log.debug("INFO_PROJECT_VERSION:" + INFO_PROJECT_VERSION);
}
}
diff --git a/src/main/java/io/geekidea/springbootplus/generator/config/SpringBootPlusMySqlQuery.java b/src/main/java/io/geekidea/springbootplus/generator/config/SpringBootPlusMySqlQuery.java
new file mode 100644
index 00000000..fc92c680
--- /dev/null
+++ b/src/main/java/io/geekidea/springbootplus/generator/config/SpringBootPlusMySqlQuery.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2019-2029 geekidea(https://github.com/geekidea)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.geekidea.springbootplus.generator.config;
+
+import com.baomidou.mybatisplus.generator.config.querys.MySqlQuery;
+
+/**
+ * MySQL代码生成查询是否为空的列
+ *
+ * @author geekidea
+ * @date 2019-10-11
+ **/
+public class SpringBootPlusMySqlQuery extends MySqlQuery {
+
+ @Override
+ public String[] fieldCustom() {
+ return new String[]{"null", "default"};
+ }
+
+}
diff --git a/src/main/java/io/geekidea/springbootplus/generator/package-info.java b/src/main/java/io/geekidea/springbootplus/generator/package-info.java
new file mode 100644
index 00000000..d70cb518
--- /dev/null
+++ b/src/main/java/io/geekidea/springbootplus/generator/package-info.java
@@ -0,0 +1,21 @@
+/*
+ * Copyright 2019-2029 geekidea(https://github.com/geekidea)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @author geekidea
+ * @date 2019-10-11
+ **/
+package io.geekidea.springbootplus.generator;
\ No newline at end of file
diff --git a/src/test/java/io/geekidea/springbootplus/test/CodeGenerator.java b/src/test/java/io/geekidea/springbootplus/test/CodeGenerator.java
index 89e53c56..973e45a0 100644
--- a/src/test/java/io/geekidea/springbootplus/test/CodeGenerator.java
+++ b/src/test/java/io/geekidea/springbootplus/test/CodeGenerator.java
@@ -24,6 +24,7 @@
import com.baomidou.mybatisplus.generator.config.po.TableInfo;
import com.baomidou.mybatisplus.generator.config.rules.DateType;
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
+import io.geekidea.springbootplus.generator.config.SpringBootPlusMySqlQuery;
import org.apache.commons.lang3.StringUtils;
import java.util.ArrayList;
@@ -104,6 +105,9 @@ public static void main(String[] args) {
dsc.setDriverName(DRIVER_NAME);
dsc.setUsername(USER_NAME);
dsc.setPassword(PASSWORD);
+ // 设置自定义查询
+ dsc.setDbQuery(new SpringBootPlusMySqlQuery());
+
mpg.setDataSource(dsc);
// 包配置
diff --git a/src/test/resources/templates/entity.java.vm b/src/test/resources/templates/entity.java.vm
index fc801134..a56d38ad 100644
--- a/src/test/resources/templates/entity.java.vm
+++ b/src/test/resources/templates/entity.java.vm
@@ -13,6 +13,9 @@ import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
#end
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+
/**
*
* $!{table.comment}
@@ -96,9 +99,19 @@ public class ${entity} implements Serializable {
#if(${custom_is_pk})
private ${field.propertyType} ${field.propertyName};
#else
+## 如果没有默认值,且不为空,则设置非空校验
+#if(${field.customMap.null} == 'NO' && !${field.customMap.default})
+#if(${field.propertyType} == 'String')
+@NotBlank(message = "${field.comment}不能为空")
+#else
+@NotNull(message = "${field.comment}不能为空")
+#end
+ private ${field.propertyType} ${field.propertyName};
+#else
private ${field.propertyType} ${field.propertyName};
#end
#end
+#end
## ---------- END 字段循环遍历 ----------
#if(!${entityLombokModel})
#foreach($field in ${table.fields})
From a5f5b17e8f3b5a015733e8a384a417a495a2ebe0 Mon Sep 17 00:00:00 2001
From: springboot-plus
Date: Fri, 11 Oct 2019 17:50:35 +0800
Subject: [PATCH 06/21] =?UTF-8?q?:cn:=20=E5=8F=AF=E9=85=8D=E7=BD=AE?=
=?UTF-8?q?=E6=98=AF=E5=90=A6=E7=94=9F=E6=88=90Validation=E9=AA=8C?=
=?UTF-8?q?=E8=AF=81=E4=BB=A3=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../springbootplus/test/CodeGenerator.java | 18 +++++++++++++-----
.../resources/templates/controller.java.vm | 2 ++
src/test/resources/templates/entity.java.vm | 6 ++++++
3 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/src/test/java/io/geekidea/springbootplus/test/CodeGenerator.java b/src/test/java/io/geekidea/springbootplus/test/CodeGenerator.java
index 973e45a0..d34fffde 100644
--- a/src/test/java/io/geekidea/springbootplus/test/CodeGenerator.java
+++ b/src/test/java/io/geekidea/springbootplus/test/CodeGenerator.java
@@ -61,13 +61,16 @@ public class CodeGenerator {
// 作者
private static final String AUTHOR = "geekidea";
// 生成的表名称
- private static final String TABLE_NAME = "sys_log";
+ private static final String TABLE_NAME = "sys_role";
// 主键数据库列名称
- private static final String PK_ID_COLUMN_NAME = "log_id";
+ private static final String PK_ID_COLUMN_NAME = "id";
// 代码生成策略 true:All/false:SIMPLE
private static final boolean GENERATOR_STRATEGY = true;
// 分页列表查询是否排序 true:有排序参数/false:无
private static final boolean PAGE_LIST_ORDER = false;
+ // 是否生成validation校验,true:生成/false:不生成
+ private static final boolean PARAM_VALIDATION = true;
+
// 生成文件配置,是否生成entity/controller/service/serviceImpl/mapper/xml
private static final boolean GENERATOR_ENTITY = true;
private static final boolean GENERATOR_CONTROLLER = true;
@@ -123,6 +126,7 @@ public static void main(String[] args) {
@Override
public void initMap() {
+ String camelTableName = underlineToCamel(TABLE_NAME);
String pascalTableName = underlineToPascal(TABLE_NAME);
Map map = new HashMap<>();
@@ -142,11 +146,11 @@ public void initMap() {
// 响应结果类路径
map.put("queryVoPath", queryVoPackage + StringPool.DOT + pascalTableName + "QueryVo");
// 实体对象名称
- map.put("entityObjectName", pascalTableName);
+ map.put("entityObjectName", camelTableName);
// service对象名称
- map.put("serviceObjectName", pascalTableName + "Service");
+ map.put("serviceObjectName", camelTableName + "Service");
// mapper对象名称
- map.put("mapperObjectName", pascalTableName + "Mapper");
+ map.put("mapperObjectName", camelTableName + "Mapper");
// 主键ID列名
map.put("pkIdColumnName", PK_ID_COLUMN_NAME);
// 主键ID驼峰名称
@@ -164,6 +168,8 @@ public void initMap() {
map.put("orderQueryParamPath", PARENT_PACKAGE + StringPool.DOT + "common.web.param." + "OrderQueryParam");
// 代码生成策略
map.put("generatorStrategy", GENERATOR_STRATEGY);
+ // 代码Validation校验
+ map.put("paramValidation", PARAM_VALIDATION);
this.setMap(map);
}
};
@@ -267,4 +273,6 @@ public static String underlineToPascal(String underline) {
return null;
}
+
+
}
diff --git a/src/test/resources/templates/controller.java.vm b/src/test/resources/templates/controller.java.vm
index 7930f041..8999f58e 100644
--- a/src/test/resources/templates/controller.java.vm
+++ b/src/test/resources/templates/controller.java.vm
@@ -23,7 +23,9 @@ import org.springframework.web.bind.annotation.RestController;
import org.springframework.stereotype.Controller;
#end
+#if(${cfg.paramValidation})
import javax.validation.Valid;
+#end
import ${cfg.paging};
import ${cfg.idParamPath};
diff --git a/src/test/resources/templates/entity.java.vm b/src/test/resources/templates/entity.java.vm
index a56d38ad..0b82076e 100644
--- a/src/test/resources/templates/entity.java.vm
+++ b/src/test/resources/templates/entity.java.vm
@@ -13,8 +13,10 @@ import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
#end
+#if(${cfg.paramValidation})
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
+#end
/**
*
@@ -100,6 +102,7 @@ public class ${entity} implements Serializable {
private ${field.propertyType} ${field.propertyName};
#else
## 如果没有默认值,且不为空,则设置非空校验
+#if(${cfg.paramValidation})
#if(${field.customMap.null} == 'NO' && !${field.customMap.default})
#if(${field.propertyType} == 'String')
@NotBlank(message = "${field.comment}不能为空")
@@ -110,6 +113,9 @@ public class ${entity} implements Serializable {
#else
private ${field.propertyType} ${field.propertyName};
#end
+#else
+private ${field.propertyType} ${field.propertyName};
+#end
#end
#end
## ---------- END 字段循环遍历 ----------
From 3166019e949728bc1839f84e54e745a17499a2f7 Mon Sep 17 00:00:00 2001
From: springboot-plus
Date: Fri, 11 Oct 2019 19:19:02 +0800
Subject: [PATCH 07/21] =?UTF-8?q?:cn:=20=E4=BC=98=E5=8C=96controller?=
=?UTF-8?q?=E4=BB=A3=E7=A0=81=E7=94=9F=E6=88=90=E5=99=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../io/geekidea/springbootplus/test/CodeGenerator.java | 2 +-
src/test/resources/templates/controller.java.vm | 10 +++++-----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/test/java/io/geekidea/springbootplus/test/CodeGenerator.java b/src/test/java/io/geekidea/springbootplus/test/CodeGenerator.java
index d34fffde..d6d59455 100644
--- a/src/test/java/io/geekidea/springbootplus/test/CodeGenerator.java
+++ b/src/test/java/io/geekidea/springbootplus/test/CodeGenerator.java
@@ -57,7 +57,7 @@ public class CodeGenerator {
// ############################ 配置部分 start ############################
// 模块名称
- private static final String MODULE_NAME = "system";
+ private static final String MODULE_NAME = "hello";
// 作者
private static final String AUTHOR = "geekidea";
// 生成的表名称
diff --git a/src/test/resources/templates/controller.java.vm b/src/test/resources/templates/controller.java.vm
index 8999f58e..3553e91c 100644
--- a/src/test/resources/templates/controller.java.vm
+++ b/src/test/resources/templates/controller.java.vm
@@ -65,7 +65,7 @@ public class ${table.controllerName} {
*/
@PostMapping("/add")
@ApiOperation(value = "添加${entity}对象", notes = "添加$!{table.comment}", response = ApiResult.class)
- public ApiResult add${entity}(@Valid @RequestBody ${entity} ${cfg.entityObjectName}) throws Exception {
+ public ApiResult add${entity}(#if(${cfg.paramValidation})@Valid#end @RequestBody ${entity} ${cfg.entityObjectName}) throws Exception {
boolean flag = ${cfg.serviceObjectName}.save(${cfg.entityObjectName});
return ApiResult.result(flag);
}
@@ -75,7 +75,7 @@ public class ${table.controllerName} {
*/
@PostMapping("/update")
@ApiOperation(value = "修改${entity}对象", notes = "修改$!{table.comment}", response = ApiResult.class)
- public ApiResult update${entity}(@Valid @RequestBody ${entity} ${cfg.entityObjectName}) throws Exception {
+ public ApiResult update${entity}(#if(${cfg.paramValidation})@Valid#end @RequestBody ${entity} ${cfg.entityObjectName}) throws Exception {
boolean flag = ${cfg.serviceObjectName}.updateById(${cfg.entityObjectName});
return ApiResult.result(flag);
}
@@ -85,7 +85,7 @@ public class ${table.controllerName} {
*/
@PostMapping("/delete")
@ApiOperation(value = "删除${entity}对象", notes = "删除$!{table.comment}", response = ApiResult.class)
- public ApiResult delete${entity}(@Valid @RequestBody IdParam idParam) throws Exception {
+ public ApiResult delete${entity}(#if(${cfg.paramValidation})@Valid#end @RequestBody IdParam idParam) throws Exception {
boolean flag = ${cfg.serviceObjectName}.removeById(idParam.getId());
return ApiResult.result(flag);
}
@@ -95,7 +95,7 @@ public class ${table.controllerName} {
*/
@PostMapping("/info")
@ApiOperation(value = "获取${entity}对象详情", notes = "查看$!{table.comment}", response = ${entity}QueryVo.class)
- public ApiResult<${entity}QueryVo> get${entity}(@Valid @RequestBody IdParam idParam) throws Exception {
+ public ApiResult<${entity}QueryVo> get${entity}(#if(${cfg.paramValidation})@Valid#end @RequestBody IdParam idParam) throws Exception {
${entity}QueryVo ${cfg.entityObjectName}QueryVo = ${cfg.serviceObjectName}.get${entity}ById(idParam.getId());
return ApiResult.ok(${cfg.entityObjectName}QueryVo);
}
@@ -105,7 +105,7 @@ public class ${table.controllerName} {
*/
@PostMapping("/getPageList")
@ApiOperation(value = "获取${entity}分页列表", notes = "$!{table.comment}分页列表", response = ${entity}QueryVo.class)
- public ApiResult> get${entity}PageList(@Valid @RequestBody(required = false) ${entity}QueryParam ${cfg.entityObjectName}QueryParam) throws Exception {
+ public ApiResult> get${entity}PageList(#if(${cfg.paramValidation})@Valid#end @RequestBody ${entity}QueryParam ${cfg.entityObjectName}QueryParam) throws Exception {
Paging<${entity}QueryVo> paging = ${cfg.entityObjectName}Service.get${entity}PageList(${cfg.entityObjectName}QueryParam);
return ApiResult.ok(paging);
}
From 01d3b8cdf839fe6659badfc6a59ca5304020b3cc Mon Sep 17 00:00:00 2001
From: springboot-plus
Date: Fri, 11 Oct 2019 19:42:15 +0800
Subject: [PATCH 08/21] =?UTF-8?q?:tiger:=20=E8=B0=83=E6=95=B4controller/pa?=
=?UTF-8?q?ram/vo=E4=BB=A3=E7=A0=81=E7=94=9F=E6=88=90=E7=9A=84=E7=9B=AE?=
=?UTF-8?q?=E5=BD=95=E7=BB=93=E6=9E=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../springbootplus/test/CodeGenerator.java | 47 ++++++++++++-------
1 file changed, 29 insertions(+), 18 deletions(-)
diff --git a/src/test/java/io/geekidea/springbootplus/test/CodeGenerator.java b/src/test/java/io/geekidea/springbootplus/test/CodeGenerator.java
index d6d59455..b9db8dab 100644
--- a/src/test/java/io/geekidea/springbootplus/test/CodeGenerator.java
+++ b/src/test/java/io/geekidea/springbootplus/test/CodeGenerator.java
@@ -45,14 +45,27 @@ public class CodeGenerator {
private static final String DRIVER_NAME = "com.mysql.jdbc.Driver";
private static final String DRIVER_URL = "jdbc:mysql://localhost:3306/spring_boot_plus?useUnicode=true&characterEncoding=UTF-8&useSSL=false";
+ // 生成的类路径
+ private static final String PROJECT_PACKAGE_PATH = "io/geekidea/springbootplus";
+
+ // 项目主包路径
private static final String PARENT_PACKAGE = "io.geekidea.springbootplus";
- private static final String SUPER_ENTITY = PARENT_PACKAGE + ".common.entity.BaseEntity";
+ private static final String COMMON_PARENT_PACKAGE = PARENT_PACKAGE + ".common";
+
+ // 父类包路径
+ private static final String SUPER_ENTITY = COMMON_PARENT_PACKAGE + ".entity.BaseEntity";
+ private static final String SUPER_CONTROLLER = COMMON_PARENT_PACKAGE + ".web.controller.BaseController";
+ private static final String SUPER_SERVICE = COMMON_PARENT_PACKAGE + ".service.BaseService";
+ private static final String SUPER_SERVICE_IMPL = COMMON_PARENT_PACKAGE + ".service.impl.BaseServiceImpl";
+ private static final String SUPER_QUERY_PARAM = COMMON_PARENT_PACKAGE + ".web.param.QueryParam";
private static final String[] SUPER_ENTITY_COMMON_COLUMNS = new String[]{};
- private static final String SUPER_CONTROLLER = PARENT_PACKAGE + ".common.web.controller.BaseController";
- private static final String SUPER_SERVICE = PARENT_PACKAGE + ".common.service.BaseService";
- private static final String SUPER_SERVICE_IMPL = PARENT_PACKAGE + ".common.service.impl.BaseServiceImpl";
- private static final String PROJECT_PACKAGE_PATH = "io/geekidea/springbootplus";
+ // 公共类包路径
+ private static final String COMMON_ID_PARAM = COMMON_PARENT_PACKAGE + ".web.param.IdParam";
+ private static final String COMMON_API_RESULT = COMMON_PARENT_PACKAGE + ".api.ApiResult";
+ private static final String COMMON_ORDER_ENUM = COMMON_PARENT_PACKAGE + ".enums.OrderEnum";
+ private static final String COMMON_ORDER_QUERY_PARAM = COMMON_PARENT_PACKAGE + ".web.param.OrderQueryParam";
+ private static final String COMMON_PAGING = COMMON_PARENT_PACKAGE + ".web.vo.Paging";
// ############################ 配置部分 start ############################
@@ -117,7 +130,7 @@ public static void main(String[] args) {
PackageConfig pc = new PackageConfig();
pc.setModuleName(MODULE_NAME);
pc.setParent(PARENT_PACKAGE);
- pc.setController("web.controller");
+ pc.setController("controller");
mpg.setPackageInfo(pc);
@@ -132,16 +145,16 @@ public void initMap() {
Map map = new HashMap<>();
map.put("customField", "Hello " + this.getConfig().getGlobalConfig().getAuthor());
// 查询参数包路径
- String queryParamPackage = PARENT_PACKAGE + StringPool.DOT + pc.getModuleName() + ".web.param";
+ String queryParamPackage = PARENT_PACKAGE + StringPool.DOT + pc.getModuleName() + ".param";
map.put("queryParamPackage", queryParamPackage);
// 查询参数类路径
map.put("queryParamPath", queryParamPackage + StringPool.DOT + pascalTableName + "QueryParam");
// 查询参数共公包路径
- map.put("queryParamCommonPath", PARENT_PACKAGE + StringPool.DOT + "common.web.param." + "QueryParam");
+ map.put("queryParamCommonPath", SUPER_QUERY_PARAM);
// 查询参数共公包路径
- map.put("idParamPath", PARENT_PACKAGE + StringPool.DOT + "common.web.param." + "IdParam");
+ map.put("idParamPath", COMMON_ID_PARAM);
// 响应结果包路径
- String queryVoPackage = PARENT_PACKAGE + StringPool.DOT + pc.getModuleName() + ".web.vo";
+ String queryVoPackage = PARENT_PACKAGE + StringPool.DOT + pc.getModuleName() + ".vo";
map.put("queryVoPackage", queryVoPackage);
// 响应结果类路径
map.put("queryVoPath", queryVoPackage + StringPool.DOT + pascalTableName + "QueryVo");
@@ -156,16 +169,15 @@ public void initMap() {
// 主键ID驼峰名称
map.put("pkIdCamelName", underlineToCamel(PK_ID_COLUMN_NAME));
// 导入分页类
- map.put("paging", PARENT_PACKAGE + ".common.web.vo.Paging");
+ map.put("paging", COMMON_PAGING);
// 导入排序枚举
- map.put("orderEnum", PARENT_PACKAGE + ".common.enums.OrderEnum");
+ map.put("orderEnum", COMMON_ORDER_ENUM);
// ApiResult
- // io.geekidea.springbootplus.common.api.ApiResult;
- map.put("apiResult", PARENT_PACKAGE + ".common.api.ApiResult");
+ map.put("apiResult", COMMON_API_RESULT);
// 分页列表查询是否排序
map.put("pageListOrder", PAGE_LIST_ORDER);
// 导入排序查询参数类
- map.put("orderQueryParamPath", PARENT_PACKAGE + StringPool.DOT + "common.web.param." + "OrderQueryParam");
+ map.put("orderQueryParamPath", COMMON_ORDER_QUERY_PARAM);
// 代码生成策略
map.put("generatorStrategy", GENERATOR_STRATEGY);
// 代码Validation校验
@@ -192,7 +204,7 @@ public String outputFile(TableInfo tableInfo) {
focList.add(new FileOutConfig("/templates/queryParam.java.vm") {
@Override
public String outputFile(TableInfo tableInfo) {
- return projectPath + "/src/main/java/" + PROJECT_PACKAGE_PATH + "/" + pc.getModuleName() + "/web/param/" + tableInfo.getEntityName() + "QueryParam" + StringPool.DOT_JAVA;
+ return projectPath + "/src/main/java/" + PROJECT_PACKAGE_PATH + "/" + pc.getModuleName() + "/param/" + tableInfo.getEntityName() + "QueryParam" + StringPool.DOT_JAVA;
}
});
}
@@ -202,7 +214,7 @@ public String outputFile(TableInfo tableInfo) {
focList.add(new FileOutConfig("/templates/queryVo.java.vm") {
@Override
public String outputFile(TableInfo tableInfo) {
- return projectPath + "/src/main/java/" + PROJECT_PACKAGE_PATH + "/" + pc.getModuleName() + "/web/vo/" + tableInfo.getEntityName() + "QueryVo" + StringPool.DOT_JAVA;
+ return projectPath + "/src/main/java/" + PROJECT_PACKAGE_PATH + "/" + pc.getModuleName() + "/vo/" + tableInfo.getEntityName() + "QueryVo" + StringPool.DOT_JAVA;
}
});
}
@@ -274,5 +286,4 @@ public static String underlineToPascal(String underline) {
}
-
}
From aa5730d76e3094fe4e44b55d8ac0e0bf6b376e76 Mon Sep 17 00:00:00 2001
From: springboot-plus
Date: Fri, 11 Oct 2019 23:02:25 +0800
Subject: [PATCH 09/21] =?UTF-8?q?:tiger:=20=E8=B0=83=E6=95=B4common?=
=?UTF-8?q?=E5=8C=85=E4=B8=8Bcontroller/param/vo=E4=BB=A3=E7=A0=81?=
=?UTF-8?q?=E7=94=9F=E6=88=90=E7=9A=84=E7=9B=AE=E5=BD=95=E7=BB=93=E6=9E=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
docs/db/mysql_spring_boot_plus.sql | 2 +-
pom.xml | 1 -
.../controller/ApiDocController.java | 2 +-
.../{web => }/controller/BaseController.java | 2 +-
.../{web => }/controller/IndexController.java | 2 +-
.../{web => }/filter/RequestPathFilter.java | 2 +-
.../interceptor/PermissionInterceptor.java | 2 +-
.../springbootplus/common/package-info.java | 22 -----
.../common/{web => }/param/IdParam.java | 2 +-
.../common/{web => }/param/IdStatusParam.java | 2 +-
.../common/{web => }/param/NameParam.java | 2 +-
.../{web => }/param/OrderQueryParam.java | 2 +-
.../common/{web => }/param/QueryParam.java | 2 +-
.../common/service/impl/BaseServiceImpl.java | 4 +-
.../common/{web => }/vo/CommonIdName.java | 2 +-
.../common/{web => }/vo/Paging.java | 2 +-
.../springbootplus/config/package-info.java | 22 -----
.../core/config/SpringBootPlusConfig.java | 8 +-
.../config/SpringBootPlusWebMvcConfig.java | 8 +-
.../controller/DownloadController.java | 2 +-
.../controller/ResourceController.java | 2 +-
.../controller/UploadController.java | 6 +-
.../interceptor/DownloadInterceptor.java | 2 +-
.../interceptor/ResourceInterceptor.java | 2 +-
.../interceptor/UploadInterceptor.java | 2 +-
.../springbootplus/resource/package-info.java | 17 ----
.../shiro/config/ShiroConfig.java | 2 +-
.../shiro/controller/LoginController.java | 3 +-
.../controller/HelloWorldController.java | 2 +-
.../system/controller/IpController.java | 90 +++++++++++++++++++
.../controller/SysLogController.java | 55 ++++--------
.../controller/SysUserController.java | 52 ++++-------
.../springbootplus/system/entity/Ip.java | 33 ++-----
.../springbootplus/system/entity/SysLog.java | 5 +-
.../springbootplus/system/entity/SysUser.java | 23 ++---
.../system/mapper/IpMapper.java | 42 +++++----
.../system/mapper/SysLogMapper.java | 26 ++----
.../system/mapper/SysUserMapper.java | 27 ++----
.../system/param/IpQueryParam.java | 24 +++++
.../system/param/SysLogQueryParam.java | 24 +++++
.../system/param/SysUserQueryParam.java | 24 +++++
.../system/service/IpService.java | 40 +++++----
.../system/service/SysLogService.java | 28 ++----
.../system/service/SysUserService.java | 28 ++----
.../system/service/impl/IpServiceImpl.java | 43 ++++-----
.../service/impl/SysLogServiceImpl.java | 34 ++-----
.../service/impl/SysUserServiceImpl.java | 34 ++-----
.../springbootplus/system/vo/IpQueryVo.java | 39 ++++++++
.../system/{web => }/vo/SysLogQueryVo.java | 20 +----
.../system/{web => }/vo/SysUserQueryVo.java | 21 +----
.../system/web/param/SysLogQueryParam.java | 40 ---------
.../system/web/param/SysUserQueryParam.java | 40 ---------
.../system/web/vo/IpQueryVo.java | 60 -------------
src/main/resources/mapper/system/IpMapper.xml | 27 +++---
.../resources/mapper/system/SysLogMapper.xml | 20 +----
.../resources/mapper/system/SysUserMapper.xml | 20 +----
.../springbootplus/test/CodeGenerator.java | 14 +--
57 files changed, 423 insertions(+), 641 deletions(-)
rename src/main/java/io/geekidea/springbootplus/common/{web => }/controller/ApiDocController.java (95%)
rename src/main/java/io/geekidea/springbootplus/common/{web => }/controller/BaseController.java (96%)
rename src/main/java/io/geekidea/springbootplus/common/{web => }/controller/IndexController.java (95%)
rename src/main/java/io/geekidea/springbootplus/common/{web => }/filter/RequestPathFilter.java (97%)
rename src/main/java/io/geekidea/springbootplus/common/{web => }/interceptor/PermissionInterceptor.java (96%)
delete mode 100644 src/main/java/io/geekidea/springbootplus/common/package-info.java
rename src/main/java/io/geekidea/springbootplus/common/{web => }/param/IdParam.java (95%)
rename src/main/java/io/geekidea/springbootplus/common/{web => }/param/IdStatusParam.java (96%)
rename src/main/java/io/geekidea/springbootplus/common/{web => }/param/NameParam.java (96%)
rename src/main/java/io/geekidea/springbootplus/common/{web => }/param/OrderQueryParam.java (96%)
rename src/main/java/io/geekidea/springbootplus/common/{web => }/param/QueryParam.java (97%)
rename src/main/java/io/geekidea/springbootplus/common/{web => }/vo/CommonIdName.java (96%)
rename src/main/java/io/geekidea/springbootplus/common/{web => }/vo/Paging.java (97%)
delete mode 100644 src/main/java/io/geekidea/springbootplus/config/package-info.java
rename src/main/java/io/geekidea/springbootplus/resource/{web => }/controller/DownloadController.java (97%)
rename src/main/java/io/geekidea/springbootplus/resource/{web => }/controller/ResourceController.java (96%)
rename src/main/java/io/geekidea/springbootplus/resource/{web => }/controller/UploadController.java (94%)
rename src/main/java/io/geekidea/springbootplus/resource/{web => }/interceptor/DownloadInterceptor.java (97%)
rename src/main/java/io/geekidea/springbootplus/resource/{web => }/interceptor/ResourceInterceptor.java (97%)
rename src/main/java/io/geekidea/springbootplus/resource/{web => }/interceptor/UploadInterceptor.java (97%)
delete mode 100644 src/main/java/io/geekidea/springbootplus/resource/package-info.java
rename src/main/java/io/geekidea/springbootplus/system/{web => }/controller/HelloWorldController.java (96%)
create mode 100644 src/main/java/io/geekidea/springbootplus/system/controller/IpController.java
rename src/main/java/io/geekidea/springbootplus/system/{web => }/controller/SysLogController.java (59%)
rename src/main/java/io/geekidea/springbootplus/system/{web => }/controller/SysUserController.java (58%)
create mode 100644 src/main/java/io/geekidea/springbootplus/system/param/IpQueryParam.java
create mode 100644 src/main/java/io/geekidea/springbootplus/system/param/SysLogQueryParam.java
create mode 100644 src/main/java/io/geekidea/springbootplus/system/param/SysUserQueryParam.java
create mode 100644 src/main/java/io/geekidea/springbootplus/system/vo/IpQueryVo.java
rename src/main/java/io/geekidea/springbootplus/system/{web => }/vo/SysLogQueryVo.java (55%)
rename src/main/java/io/geekidea/springbootplus/system/{web => }/vo/SysUserQueryVo.java (62%)
delete mode 100644 src/main/java/io/geekidea/springbootplus/system/web/param/SysLogQueryParam.java
delete mode 100644 src/main/java/io/geekidea/springbootplus/system/web/param/SysUserQueryParam.java
delete mode 100644 src/main/java/io/geekidea/springbootplus/system/web/vo/IpQueryVo.java
diff --git a/docs/db/mysql_spring_boot_plus.sql b/docs/db/mysql_spring_boot_plus.sql
index 4fd7332b..a8be0c76 100644
--- a/docs/db/mysql_spring_boot_plus.sql
+++ b/docs/db/mysql_spring_boot_plus.sql
@@ -32,7 +32,7 @@ CREATE TABLE `ip` (
`ip_start_num` bigint(20) NOT NULL,
`ip_end_num` bigint(20) NOT NULL,
PRIMARY KEY (`id`) USING BTREE
-) ENGINE = InnoDB AUTO_INCREMENT = 526718 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
+) ENGINE = InnoDB AUTO_INCREMENT = 526718 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = 'IP地址' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for sys_log
diff --git a/pom.xml b/pom.xml
index 06414511..f1c9a802 100644
--- a/pom.xml
+++ b/pom.xml
@@ -45,7 +45,6 @@
UTF-8
${utf8}
${utf8}
- ${parent.version}
1.8
2.1.9.RELEASE
3.2.0
diff --git a/src/main/java/io/geekidea/springbootplus/common/web/controller/ApiDocController.java b/src/main/java/io/geekidea/springbootplus/common/controller/ApiDocController.java
similarity index 95%
rename from src/main/java/io/geekidea/springbootplus/common/web/controller/ApiDocController.java
rename to src/main/java/io/geekidea/springbootplus/common/controller/ApiDocController.java
index 51dc6b1e..17a466cc 100644
--- a/src/main/java/io/geekidea/springbootplus/common/web/controller/ApiDocController.java
+++ b/src/main/java/io/geekidea/springbootplus/common/controller/ApiDocController.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package io.geekidea.springbootplus.common.web.controller;
+package io.geekidea.springbootplus.common.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
diff --git a/src/main/java/io/geekidea/springbootplus/common/web/controller/BaseController.java b/src/main/java/io/geekidea/springbootplus/common/controller/BaseController.java
similarity index 96%
rename from src/main/java/io/geekidea/springbootplus/common/web/controller/BaseController.java
rename to src/main/java/io/geekidea/springbootplus/common/controller/BaseController.java
index 889d0f4a..eec1326c 100644
--- a/src/main/java/io/geekidea/springbootplus/common/web/controller/BaseController.java
+++ b/src/main/java/io/geekidea/springbootplus/common/controller/BaseController.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package io.geekidea.springbootplus.common.web.controller;
+package io.geekidea.springbootplus.common.controller;
import io.geekidea.springbootplus.common.api.ApiController;
import lombok.extern.slf4j.Slf4j;
diff --git a/src/main/java/io/geekidea/springbootplus/common/web/controller/IndexController.java b/src/main/java/io/geekidea/springbootplus/common/controller/IndexController.java
similarity index 95%
rename from src/main/java/io/geekidea/springbootplus/common/web/controller/IndexController.java
rename to src/main/java/io/geekidea/springbootplus/common/controller/IndexController.java
index 55d654c0..acfee509 100644
--- a/src/main/java/io/geekidea/springbootplus/common/web/controller/IndexController.java
+++ b/src/main/java/io/geekidea/springbootplus/common/controller/IndexController.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package io.geekidea.springbootplus.common.web.controller;
+package io.geekidea.springbootplus.common.controller;
import io.geekidea.springbootplus.common.api.ApiResult;
import lombok.extern.slf4j.Slf4j;
diff --git a/src/main/java/io/geekidea/springbootplus/common/web/filter/RequestPathFilter.java b/src/main/java/io/geekidea/springbootplus/common/filter/RequestPathFilter.java
similarity index 97%
rename from src/main/java/io/geekidea/springbootplus/common/web/filter/RequestPathFilter.java
rename to src/main/java/io/geekidea/springbootplus/common/filter/RequestPathFilter.java
index 7a17016e..0f3c44de 100644
--- a/src/main/java/io/geekidea/springbootplus/common/web/filter/RequestPathFilter.java
+++ b/src/main/java/io/geekidea/springbootplus/common/filter/RequestPathFilter.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package io.geekidea.springbootplus.common.web.filter;
+package io.geekidea.springbootplus.common.filter;
import io.geekidea.springbootplus.core.properties.SpringBootPlusFilterProperties;
import lombok.extern.slf4j.Slf4j;
diff --git a/src/main/java/io/geekidea/springbootplus/common/web/interceptor/PermissionInterceptor.java b/src/main/java/io/geekidea/springbootplus/common/interceptor/PermissionInterceptor.java
similarity index 96%
rename from src/main/java/io/geekidea/springbootplus/common/web/interceptor/PermissionInterceptor.java
rename to src/main/java/io/geekidea/springbootplus/common/interceptor/PermissionInterceptor.java
index 8564113e..2c5ac243 100644
--- a/src/main/java/io/geekidea/springbootplus/common/web/interceptor/PermissionInterceptor.java
+++ b/src/main/java/io/geekidea/springbootplus/common/interceptor/PermissionInterceptor.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package io.geekidea.springbootplus.common.web.interceptor;
+package io.geekidea.springbootplus.common.interceptor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.servlet.ModelAndView;
diff --git a/src/main/java/io/geekidea/springbootplus/common/package-info.java b/src/main/java/io/geekidea/springbootplus/common/package-info.java
deleted file mode 100644
index f943efa2..00000000
--- a/src/main/java/io/geekidea/springbootplus/common/package-info.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright 2019-2029 geekidea(https://github.com/geekidea)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * 公共部分
- * @author geekidea
- * @date 2018-11-08
- */
-package io.geekidea.springbootplus.common;
\ No newline at end of file
diff --git a/src/main/java/io/geekidea/springbootplus/common/web/param/IdParam.java b/src/main/java/io/geekidea/springbootplus/common/param/IdParam.java
similarity index 95%
rename from src/main/java/io/geekidea/springbootplus/common/web/param/IdParam.java
rename to src/main/java/io/geekidea/springbootplus/common/param/IdParam.java
index 5da24042..d8126416 100644
--- a/src/main/java/io/geekidea/springbootplus/common/web/param/IdParam.java
+++ b/src/main/java/io/geekidea/springbootplus/common/param/IdParam.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package io.geekidea.springbootplus.common.web.param;
+package io.geekidea.springbootplus.common.param;
import io.swagger.annotations.ApiModel;
import lombok.Data;
diff --git a/src/main/java/io/geekidea/springbootplus/common/web/param/IdStatusParam.java b/src/main/java/io/geekidea/springbootplus/common/param/IdStatusParam.java
similarity index 96%
rename from src/main/java/io/geekidea/springbootplus/common/web/param/IdStatusParam.java
rename to src/main/java/io/geekidea/springbootplus/common/param/IdStatusParam.java
index 49038583..eab72401 100644
--- a/src/main/java/io/geekidea/springbootplus/common/web/param/IdStatusParam.java
+++ b/src/main/java/io/geekidea/springbootplus/common/param/IdStatusParam.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package io.geekidea.springbootplus.common.web.param;
+package io.geekidea.springbootplus.common.param;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
diff --git a/src/main/java/io/geekidea/springbootplus/common/web/param/NameParam.java b/src/main/java/io/geekidea/springbootplus/common/param/NameParam.java
similarity index 96%
rename from src/main/java/io/geekidea/springbootplus/common/web/param/NameParam.java
rename to src/main/java/io/geekidea/springbootplus/common/param/NameParam.java
index d43a5072..47c52936 100644
--- a/src/main/java/io/geekidea/springbootplus/common/web/param/NameParam.java
+++ b/src/main/java/io/geekidea/springbootplus/common/param/NameParam.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package io.geekidea.springbootplus.common.web.param;
+package io.geekidea.springbootplus.common.param;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
diff --git a/src/main/java/io/geekidea/springbootplus/common/web/param/OrderQueryParam.java b/src/main/java/io/geekidea/springbootplus/common/param/OrderQueryParam.java
similarity index 96%
rename from src/main/java/io/geekidea/springbootplus/common/web/param/OrderQueryParam.java
rename to src/main/java/io/geekidea/springbootplus/common/param/OrderQueryParam.java
index 77df968f..bff2701a 100644
--- a/src/main/java/io/geekidea/springbootplus/common/web/param/OrderQueryParam.java
+++ b/src/main/java/io/geekidea/springbootplus/common/param/OrderQueryParam.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package io.geekidea.springbootplus.common.web.param;
+package io.geekidea.springbootplus.common.param;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import io.swagger.annotations.ApiModel;
diff --git a/src/main/java/io/geekidea/springbootplus/common/web/param/QueryParam.java b/src/main/java/io/geekidea/springbootplus/common/param/QueryParam.java
similarity index 97%
rename from src/main/java/io/geekidea/springbootplus/common/web/param/QueryParam.java
rename to src/main/java/io/geekidea/springbootplus/common/param/QueryParam.java
index 6addc339..51bb6592 100644
--- a/src/main/java/io/geekidea/springbootplus/common/web/param/QueryParam.java
+++ b/src/main/java/io/geekidea/springbootplus/common/param/QueryParam.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package io.geekidea.springbootplus.common.web.param;
+package io.geekidea.springbootplus.common.param;
import io.geekidea.springbootplus.common.constant.CommonConstant;
import io.swagger.annotations.ApiModel;
diff --git a/src/main/java/io/geekidea/springbootplus/common/service/impl/BaseServiceImpl.java b/src/main/java/io/geekidea/springbootplus/common/service/impl/BaseServiceImpl.java
index ca391f29..7b726bdb 100644
--- a/src/main/java/io/geekidea/springbootplus/common/service/impl/BaseServiceImpl.java
+++ b/src/main/java/io/geekidea/springbootplus/common/service/impl/BaseServiceImpl.java
@@ -21,8 +21,8 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.geekidea.springbootplus.common.service.BaseService;
-import io.geekidea.springbootplus.common.web.param.OrderQueryParam;
-import io.geekidea.springbootplus.common.web.param.QueryParam;
+import io.geekidea.springbootplus.common.param.OrderQueryParam;
+import io.geekidea.springbootplus.common.param.QueryParam;
import org.apache.commons.collections.CollectionUtils;
import java.util.Arrays;
diff --git a/src/main/java/io/geekidea/springbootplus/common/web/vo/CommonIdName.java b/src/main/java/io/geekidea/springbootplus/common/vo/CommonIdName.java
similarity index 96%
rename from src/main/java/io/geekidea/springbootplus/common/web/vo/CommonIdName.java
rename to src/main/java/io/geekidea/springbootplus/common/vo/CommonIdName.java
index 6b0197fc..82587eee 100644
--- a/src/main/java/io/geekidea/springbootplus/common/web/vo/CommonIdName.java
+++ b/src/main/java/io/geekidea/springbootplus/common/vo/CommonIdName.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package io.geekidea.springbootplus.common.web.vo;
+package io.geekidea.springbootplus.common.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
diff --git a/src/main/java/io/geekidea/springbootplus/common/web/vo/Paging.java b/src/main/java/io/geekidea/springbootplus/common/vo/Paging.java
similarity index 97%
rename from src/main/java/io/geekidea/springbootplus/common/web/vo/Paging.java
rename to src/main/java/io/geekidea/springbootplus/common/vo/Paging.java
index 63f3c3f9..80eb7391 100644
--- a/src/main/java/io/geekidea/springbootplus/common/web/vo/Paging.java
+++ b/src/main/java/io/geekidea/springbootplus/common/vo/Paging.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package io.geekidea.springbootplus.common.web.vo;
+package io.geekidea.springbootplus.common.vo;
import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.core.metadata.IPage;
diff --git a/src/main/java/io/geekidea/springbootplus/config/package-info.java b/src/main/java/io/geekidea/springbootplus/config/package-info.java
deleted file mode 100644
index def6cd80..00000000
--- a/src/main/java/io/geekidea/springbootplus/config/package-info.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright 2019-2029 geekidea(https://github.com/geekidea)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * 公共配置
- * @author geekidea
- * @date 2018-11-08
- */
-package io.geekidea.springbootplus.config;
\ No newline at end of file
diff --git a/src/main/java/io/geekidea/springbootplus/core/config/SpringBootPlusConfig.java b/src/main/java/io/geekidea/springbootplus/core/config/SpringBootPlusConfig.java
index ea5ffe87..526e8df9 100644
--- a/src/main/java/io/geekidea/springbootplus/core/config/SpringBootPlusConfig.java
+++ b/src/main/java/io/geekidea/springbootplus/core/config/SpringBootPlusConfig.java
@@ -16,11 +16,11 @@
package io.geekidea.springbootplus.core.config;
import io.geekidea.springbootplus.common.aop.LogAop;
-import io.geekidea.springbootplus.common.web.interceptor.PermissionInterceptor;
+import io.geekidea.springbootplus.common.interceptor.PermissionInterceptor;
import io.geekidea.springbootplus.core.properties.*;
-import io.geekidea.springbootplus.resource.web.interceptor.DownloadInterceptor;
-import io.geekidea.springbootplus.resource.web.interceptor.ResourceInterceptor;
-import io.geekidea.springbootplus.resource.web.interceptor.UploadInterceptor;
+import io.geekidea.springbootplus.resource.interceptor.DownloadInterceptor;
+import io.geekidea.springbootplus.resource.interceptor.ResourceInterceptor;
+import io.geekidea.springbootplus.resource.interceptor.UploadInterceptor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
diff --git a/src/main/java/io/geekidea/springbootplus/core/config/SpringBootPlusWebMvcConfig.java b/src/main/java/io/geekidea/springbootplus/core/config/SpringBootPlusWebMvcConfig.java
index 1933d675..cfdb1f42 100644
--- a/src/main/java/io/geekidea/springbootplus/core/config/SpringBootPlusWebMvcConfig.java
+++ b/src/main/java/io/geekidea/springbootplus/core/config/SpringBootPlusWebMvcConfig.java
@@ -17,12 +17,12 @@
package io.geekidea.springbootplus.core.config;
import com.alibaba.fastjson.JSON;
-import io.geekidea.springbootplus.common.web.interceptor.PermissionInterceptor;
+import io.geekidea.springbootplus.common.interceptor.PermissionInterceptor;
import io.geekidea.springbootplus.core.properties.SpringBootPlusInterceptorProperties;
import io.geekidea.springbootplus.core.properties.SpringBootPlusProperties;
-import io.geekidea.springbootplus.resource.web.interceptor.DownloadInterceptor;
-import io.geekidea.springbootplus.resource.web.interceptor.ResourceInterceptor;
-import io.geekidea.springbootplus.resource.web.interceptor.UploadInterceptor;
+import io.geekidea.springbootplus.resource.interceptor.DownloadInterceptor;
+import io.geekidea.springbootplus.resource.interceptor.ResourceInterceptor;
+import io.geekidea.springbootplus.resource.interceptor.UploadInterceptor;
import io.geekidea.springbootplus.util.IniUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
diff --git a/src/main/java/io/geekidea/springbootplus/resource/web/controller/DownloadController.java b/src/main/java/io/geekidea/springbootplus/resource/controller/DownloadController.java
similarity index 97%
rename from src/main/java/io/geekidea/springbootplus/resource/web/controller/DownloadController.java
rename to src/main/java/io/geekidea/springbootplus/resource/controller/DownloadController.java
index 0bf03094..24824762 100644
--- a/src/main/java/io/geekidea/springbootplus/resource/web/controller/DownloadController.java
+++ b/src/main/java/io/geekidea/springbootplus/resource/controller/DownloadController.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package io.geekidea.springbootplus.resource.web.controller;
+package io.geekidea.springbootplus.resource.controller;
import io.geekidea.springbootplus.common.api.ApiResult;
import io.geekidea.springbootplus.core.properties.SpringBootPlusProperties;
diff --git a/src/main/java/io/geekidea/springbootplus/resource/web/controller/ResourceController.java b/src/main/java/io/geekidea/springbootplus/resource/controller/ResourceController.java
similarity index 96%
rename from src/main/java/io/geekidea/springbootplus/resource/web/controller/ResourceController.java
rename to src/main/java/io/geekidea/springbootplus/resource/controller/ResourceController.java
index 71afbe2b..1413dd3d 100644
--- a/src/main/java/io/geekidea/springbootplus/resource/web/controller/ResourceController.java
+++ b/src/main/java/io/geekidea/springbootplus/resource/controller/ResourceController.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package io.geekidea.springbootplus.resource.web.controller;
+package io.geekidea.springbootplus.resource.controller;
import io.geekidea.springbootplus.common.api.ApiResult;
import io.geekidea.springbootplus.core.properties.SpringBootPlusProperties;
diff --git a/src/main/java/io/geekidea/springbootplus/resource/web/controller/UploadController.java b/src/main/java/io/geekidea/springbootplus/resource/controller/UploadController.java
similarity index 94%
rename from src/main/java/io/geekidea/springbootplus/resource/web/controller/UploadController.java
rename to src/main/java/io/geekidea/springbootplus/resource/controller/UploadController.java
index 702d80ec..f920f76c 100644
--- a/src/main/java/io/geekidea/springbootplus/resource/web/controller/UploadController.java
+++ b/src/main/java/io/geekidea/springbootplus/resource/controller/UploadController.java
@@ -14,12 +14,12 @@
* limitations under the License.
*/
-package io.geekidea.springbootplus.resource.web.controller;
+package io.geekidea.springbootplus.resource.controller;
import io.geekidea.springbootplus.common.api.ApiResult;
-import io.geekidea.springbootplus.common.web.param.IdParam;
+import io.geekidea.springbootplus.common.param.IdParam;
import io.geekidea.springbootplus.core.properties.SpringBootPlusProperties;
-import io.geekidea.springbootplus.system.web.vo.SysLogQueryVo;
+import io.geekidea.springbootplus.system.vo.SysLogQueryVo;
import io.geekidea.springbootplus.util.UploadUtil;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
diff --git a/src/main/java/io/geekidea/springbootplus/resource/web/interceptor/DownloadInterceptor.java b/src/main/java/io/geekidea/springbootplus/resource/interceptor/DownloadInterceptor.java
similarity index 97%
rename from src/main/java/io/geekidea/springbootplus/resource/web/interceptor/DownloadInterceptor.java
rename to src/main/java/io/geekidea/springbootplus/resource/interceptor/DownloadInterceptor.java
index a51e8da3..a2dee017 100644
--- a/src/main/java/io/geekidea/springbootplus/resource/web/interceptor/DownloadInterceptor.java
+++ b/src/main/java/io/geekidea/springbootplus/resource/interceptor/DownloadInterceptor.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package io.geekidea.springbootplus.resource.web.interceptor;
+package io.geekidea.springbootplus.resource.interceptor;
import io.geekidea.springbootplus.common.api.ApiResult;
import io.geekidea.springbootplus.core.properties.SpringBootPlusProperties;
diff --git a/src/main/java/io/geekidea/springbootplus/resource/web/interceptor/ResourceInterceptor.java b/src/main/java/io/geekidea/springbootplus/resource/interceptor/ResourceInterceptor.java
similarity index 97%
rename from src/main/java/io/geekidea/springbootplus/resource/web/interceptor/ResourceInterceptor.java
rename to src/main/java/io/geekidea/springbootplus/resource/interceptor/ResourceInterceptor.java
index 38b0eef1..cdab86ab 100644
--- a/src/main/java/io/geekidea/springbootplus/resource/web/interceptor/ResourceInterceptor.java
+++ b/src/main/java/io/geekidea/springbootplus/resource/interceptor/ResourceInterceptor.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package io.geekidea.springbootplus.resource.web.interceptor;
+package io.geekidea.springbootplus.resource.interceptor;
import io.geekidea.springbootplus.common.api.ApiResult;
import io.geekidea.springbootplus.core.properties.SpringBootPlusProperties;
diff --git a/src/main/java/io/geekidea/springbootplus/resource/web/interceptor/UploadInterceptor.java b/src/main/java/io/geekidea/springbootplus/resource/interceptor/UploadInterceptor.java
similarity index 97%
rename from src/main/java/io/geekidea/springbootplus/resource/web/interceptor/UploadInterceptor.java
rename to src/main/java/io/geekidea/springbootplus/resource/interceptor/UploadInterceptor.java
index bbb99d68..554c7b59 100644
--- a/src/main/java/io/geekidea/springbootplus/resource/web/interceptor/UploadInterceptor.java
+++ b/src/main/java/io/geekidea/springbootplus/resource/interceptor/UploadInterceptor.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package io.geekidea.springbootplus.resource.web.interceptor;
+package io.geekidea.springbootplus.resource.interceptor;
import io.geekidea.springbootplus.common.api.ApiResult;
import io.geekidea.springbootplus.core.properties.SpringBootPlusProperties;
diff --git a/src/main/java/io/geekidea/springbootplus/resource/package-info.java b/src/main/java/io/geekidea/springbootplus/resource/package-info.java
deleted file mode 100644
index 68753d22..00000000
--- a/src/main/java/io/geekidea/springbootplus/resource/package-info.java
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- * Copyright 2019-2029 geekidea(https://github.com/geekidea)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.geekidea.springbootplus.resource;
\ No newline at end of file
diff --git a/src/main/java/io/geekidea/springbootplus/shiro/config/ShiroConfig.java b/src/main/java/io/geekidea/springbootplus/shiro/config/ShiroConfig.java
index 13ea3f91..76bd33a2 100644
--- a/src/main/java/io/geekidea/springbootplus/shiro/config/ShiroConfig.java
+++ b/src/main/java/io/geekidea/springbootplus/shiro/config/ShiroConfig.java
@@ -17,7 +17,7 @@
package io.geekidea.springbootplus.shiro.config;
import com.alibaba.fastjson.JSON;
-import io.geekidea.springbootplus.common.web.filter.RequestPathFilter;
+import io.geekidea.springbootplus.common.filter.RequestPathFilter;
import io.geekidea.springbootplus.core.properties.SpringBootPlusFilterProperties;
import io.geekidea.springbootplus.shiro.cache.LoginRedisService;
import io.geekidea.springbootplus.shiro.exception.ShiroConfigException;
diff --git a/src/main/java/io/geekidea/springbootplus/shiro/controller/LoginController.java b/src/main/java/io/geekidea/springbootplus/shiro/controller/LoginController.java
index 76c08381..dee1faa9 100644
--- a/src/main/java/io/geekidea/springbootplus/shiro/controller/LoginController.java
+++ b/src/main/java/io/geekidea/springbootplus/shiro/controller/LoginController.java
@@ -19,7 +19,6 @@
import io.geekidea.springbootplus.common.api.ApiResult;
import io.geekidea.springbootplus.shiro.param.LoginParam;
import io.geekidea.springbootplus.shiro.service.LoginService;
-import io.geekidea.springbootplus.system.web.vo.SysUserQueryVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
@@ -48,7 +47,7 @@ public class LoginController {
private LoginService loginService;
@PostMapping("/login")
- @ApiOperation(value = "登陆", notes = "系统用户登陆", response = SysUserQueryVo.class)
+ @ApiOperation(value = "登陆", notes = "系统用户登陆", response = ApiResult.class)
public ApiResult login(@Valid @RequestBody LoginParam loginParam, HttpServletResponse response) {
return loginService.login(loginParam, response);
}
diff --git a/src/main/java/io/geekidea/springbootplus/system/web/controller/HelloWorldController.java b/src/main/java/io/geekidea/springbootplus/system/controller/HelloWorldController.java
similarity index 96%
rename from src/main/java/io/geekidea/springbootplus/system/web/controller/HelloWorldController.java
rename to src/main/java/io/geekidea/springbootplus/system/controller/HelloWorldController.java
index f3e7c15a..a2182d43 100644
--- a/src/main/java/io/geekidea/springbootplus/system/web/controller/HelloWorldController.java
+++ b/src/main/java/io/geekidea/springbootplus/system/controller/HelloWorldController.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package io.geekidea.springbootplus.system.web.controller;
+package io.geekidea.springbootplus.system.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
diff --git a/src/main/java/io/geekidea/springbootplus/system/controller/IpController.java b/src/main/java/io/geekidea/springbootplus/system/controller/IpController.java
new file mode 100644
index 00000000..7da38b79
--- /dev/null
+++ b/src/main/java/io/geekidea/springbootplus/system/controller/IpController.java
@@ -0,0 +1,90 @@
+package io.geekidea.springbootplus.system.controller;
+
+import io.geekidea.springbootplus.system.entity.Ip;
+import io.geekidea.springbootplus.system.service.IpService;
+import io.geekidea.springbootplus.system.param.IpQueryParam;
+import io.geekidea.springbootplus.system.vo.IpQueryVo;
+import io.geekidea.springbootplus.common.api.ApiResult;
+import io.geekidea.springbootplus.common.controller.BaseController;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+
+import io.geekidea.springbootplus.common.vo.Paging;
+import io.geekidea.springbootplus.common.param.IdParam;
+
+/**
+ *
+ * IP地址 前端控制器
+ *
+ *
+ * @author geekidea
+ * @since 2019-10-11
+ */
+@Slf4j
+@RestController
+@RequestMapping("/ip")
+@Api("IP地址 API")
+public class IpController extends BaseController {
+
+ @Autowired
+ private IpService ipService;
+
+ /**
+ * 添加IP地址
+ */
+ @PostMapping("/add")
+ @ApiOperation(value = "添加Ip对象", notes = "添加IP地址", response = ApiResult.class)
+ public ApiResult addIp( @RequestBody Ip ip) throws Exception {
+ boolean flag = ipService.save(ip);
+ return ApiResult.result(flag);
+ }
+
+ /**
+ * 修改IP地址
+ */
+ @PostMapping("/update")
+ @ApiOperation(value = "修改Ip对象", notes = "修改IP地址", response = ApiResult.class)
+ public ApiResult updateIp( @RequestBody Ip ip) throws Exception {
+ boolean flag = ipService.updateById(ip);
+ return ApiResult.result(flag);
+ }
+
+ /**
+ * 删除IP地址
+ */
+ @PostMapping("/delete")
+ @ApiOperation(value = "删除Ip对象", notes = "删除IP地址", response = ApiResult.class)
+ public ApiResult deleteIp( @RequestBody IdParam idParam) throws Exception {
+ boolean flag = ipService.removeById(idParam.getId());
+ return ApiResult.result(flag);
+ }
+
+ /**
+ * 获取IP地址
+ */
+ @PostMapping("/info")
+ @ApiOperation(value = "获取Ip对象详情", notes = "查看IP地址", response = IpQueryVo.class)
+ public ApiResult getIp( @RequestBody IdParam idParam) throws Exception {
+ IpQueryVo ipQueryVo = ipService.getIpById(idParam.getId());
+ return ApiResult.ok(ipQueryVo);
+ }
+
+ /**
+ * IP地址分页列表
+ */
+ @PostMapping("/getPageList")
+ @ApiOperation(value = "获取Ip分页列表", notes = "IP地址分页列表", response = IpQueryVo.class)
+ public ApiResult> getIpPageList( @RequestBody IpQueryParam ipQueryParam) throws Exception {
+ Paging paging = ipService.getIpPageList(ipQueryParam);
+ return ApiResult.ok(paging);
+ }
+
+}
+
diff --git a/src/main/java/io/geekidea/springbootplus/system/web/controller/SysLogController.java b/src/main/java/io/geekidea/springbootplus/system/controller/SysLogController.java
similarity index 59%
rename from src/main/java/io/geekidea/springbootplus/system/web/controller/SysLogController.java
rename to src/main/java/io/geekidea/springbootplus/system/controller/SysLogController.java
index eda7ae5f..a1c99fe4 100644
--- a/src/main/java/io/geekidea/springbootplus/system/web/controller/SysLogController.java
+++ b/src/main/java/io/geekidea/springbootplus/system/controller/SysLogController.java
@@ -1,27 +1,13 @@
-/*
- * Copyright 2019-2029 geekidea(https://github.com/geekidea)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.geekidea.springbootplus.system.web.controller;
+package io.geekidea.springbootplus.system.controller;
+import io.geekidea.springbootplus.common.api.ApiResult;
+import io.geekidea.springbootplus.common.controller.BaseController;
+import io.geekidea.springbootplus.common.param.IdParam;
+import io.geekidea.springbootplus.common.vo.Paging;
import io.geekidea.springbootplus.system.entity.SysLog;
+import io.geekidea.springbootplus.system.param.SysLogQueryParam;
import io.geekidea.springbootplus.system.service.SysLogService;
-import io.geekidea.springbootplus.system.web.param.SysLogQueryParam;
-import io.geekidea.springbootplus.system.web.vo.SysLogQueryVo;
-import io.geekidea.springbootplus.common.api.ApiResult;
-import io.geekidea.springbootplus.common.web.controller.BaseController;
+import io.geekidea.springbootplus.system.vo.SysLogQueryVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
@@ -33,33 +19,30 @@
import javax.validation.Valid;
-import io.geekidea.springbootplus.common.web.vo.Paging;
-import io.geekidea.springbootplus.common.web.param.IdParam;
-
/**
*
* 系统日志 前端控制器
*
*
* @author geekidea
- * @since 2019-10-05
+ * @since 2019-10-11
*/
@Slf4j
@RestController
-@RequestMapping("/SysLog")
+@RequestMapping("/sysLog")
@Api("系统日志 API")
public class SysLogController extends BaseController {
@Autowired
- private SysLogService SysLogService;
+ private SysLogService sysLogService;
/**
* 添加系统日志
*/
@PostMapping("/add")
@ApiOperation(value = "添加SysLog对象", notes = "添加系统日志", response = ApiResult.class)
- public ApiResult addSysLog(@Valid @RequestBody SysLog SysLog) throws Exception {
- boolean flag = SysLogService.save(SysLog);
+ public ApiResult addSysLog(@Valid @RequestBody SysLog sysLog) throws Exception {
+ boolean flag = sysLogService.save(sysLog);
return ApiResult.result(flag);
}
@@ -68,8 +51,8 @@ public ApiResult addSysLog(@Valid @RequestBody SysLog SysLog) throws Ex
*/
@PostMapping("/update")
@ApiOperation(value = "修改SysLog对象", notes = "修改系统日志", response = ApiResult.class)
- public ApiResult updateSysLog(@Valid @RequestBody SysLog SysLog) throws Exception {
- boolean flag = SysLogService.updateById(SysLog);
+ public ApiResult updateSysLog(@Valid @RequestBody SysLog sysLog) throws Exception {
+ boolean flag = sysLogService.updateById(sysLog);
return ApiResult.result(flag);
}
@@ -79,7 +62,7 @@ public ApiResult updateSysLog(@Valid @RequestBody SysLog SysLog) throws
@PostMapping("/delete")
@ApiOperation(value = "删除SysLog对象", notes = "删除系统日志", response = ApiResult.class)
public ApiResult deleteSysLog(@Valid @RequestBody IdParam idParam) throws Exception {
- boolean flag = SysLogService.removeById(idParam.getId());
+ boolean flag = sysLogService.removeById(idParam.getId());
return ApiResult.result(flag);
}
@@ -89,8 +72,8 @@ public ApiResult deleteSysLog(@Valid @RequestBody IdParam idParam) thro
@PostMapping("/info")
@ApiOperation(value = "获取SysLog对象详情", notes = "查看系统日志", response = SysLogQueryVo.class)
public ApiResult getSysLog(@Valid @RequestBody IdParam idParam) throws Exception {
- SysLogQueryVo SysLogQueryVo = SysLogService.getSysLogById(idParam.getId());
- return ApiResult.ok(SysLogQueryVo);
+ SysLogQueryVo sysLogQueryVo = sysLogService.getSysLogById(idParam.getId());
+ return ApiResult.ok(sysLogQueryVo);
}
/**
@@ -98,8 +81,8 @@ public ApiResult getSysLog(@Valid @RequestBody IdParam idParam) t
*/
@PostMapping("/getPageList")
@ApiOperation(value = "获取SysLog分页列表", notes = "系统日志分页列表", response = SysLogQueryVo.class)
- public ApiResult> getSysLogPageList(@Valid @RequestBody(required = false) SysLogQueryParam SysLogQueryParam) throws Exception {
- Paging paging = SysLogService.getSysLogPageList(SysLogQueryParam);
+ public ApiResult> getSysLogPageList(@Valid @RequestBody SysLogQueryParam sysLogQueryParam) throws Exception {
+ Paging paging = sysLogService.getSysLogPageList(sysLogQueryParam);
return ApiResult.ok(paging);
}
diff --git a/src/main/java/io/geekidea/springbootplus/system/web/controller/SysUserController.java b/src/main/java/io/geekidea/springbootplus/system/controller/SysUserController.java
similarity index 58%
rename from src/main/java/io/geekidea/springbootplus/system/web/controller/SysUserController.java
rename to src/main/java/io/geekidea/springbootplus/system/controller/SysUserController.java
index 6133291c..8a02e855 100644
--- a/src/main/java/io/geekidea/springbootplus/system/web/controller/SysUserController.java
+++ b/src/main/java/io/geekidea/springbootplus/system/controller/SysUserController.java
@@ -1,27 +1,11 @@
-/*
- * Copyright 2019-2029 geekidea(https://github.com/geekidea)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.geekidea.springbootplus.system.web.controller;
+package io.geekidea.springbootplus.system.controller;
import io.geekidea.springbootplus.system.entity.SysUser;
import io.geekidea.springbootplus.system.service.SysUserService;
-import io.geekidea.springbootplus.system.web.param.SysUserQueryParam;
-import io.geekidea.springbootplus.system.web.vo.SysUserQueryVo;
+import io.geekidea.springbootplus.system.param.SysUserQueryParam;
+import io.geekidea.springbootplus.system.vo.SysUserQueryVo;
import io.geekidea.springbootplus.common.api.ApiResult;
-import io.geekidea.springbootplus.common.web.controller.BaseController;
+import io.geekidea.springbootplus.common.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
@@ -33,8 +17,8 @@
import javax.validation.Valid;
-import io.geekidea.springbootplus.common.web.vo.Paging;
-import io.geekidea.springbootplus.common.web.param.IdParam;
+import io.geekidea.springbootplus.common.vo.Paging;
+import io.geekidea.springbootplus.common.param.IdParam;
/**
*
@@ -42,24 +26,24 @@
*
*
* @author geekidea
- * @since 2019-10-05
+ * @since 2019-10-11
*/
@Slf4j
@RestController
-@RequestMapping("/SysUser")
+@RequestMapping("/sysUser")
@Api("SystemUser API")
public class SysUserController extends BaseController {
@Autowired
- private SysUserService SysUserService;
+ private SysUserService sysUserService;
/**
* 添加SystemUser
*/
@PostMapping("/add")
@ApiOperation(value = "添加SysUser对象", notes = "添加SystemUser", response = ApiResult.class)
- public ApiResult addSysUser(@Valid @RequestBody SysUser SysUser) throws Exception {
- boolean flag = SysUserService.save(SysUser);
+ public ApiResult addSysUser(@Valid @RequestBody SysUser sysUser) throws Exception {
+ boolean flag = sysUserService.save(sysUser);
return ApiResult.result(flag);
}
@@ -68,8 +52,8 @@ public ApiResult addSysUser(@Valid @RequestBody SysUser SysUser) throws
*/
@PostMapping("/update")
@ApiOperation(value = "修改SysUser对象", notes = "修改SystemUser", response = ApiResult.class)
- public ApiResult updateSysUser(@Valid @RequestBody SysUser SysUser) throws Exception {
- boolean flag = SysUserService.updateById(SysUser);
+ public ApiResult updateSysUser(@Valid @RequestBody SysUser sysUser) throws Exception {
+ boolean flag = sysUserService.updateById(sysUser);
return ApiResult.result(flag);
}
@@ -79,7 +63,7 @@ public ApiResult updateSysUser(@Valid @RequestBody SysUser SysUser) thr
@PostMapping("/delete")
@ApiOperation(value = "删除SysUser对象", notes = "删除SystemUser", response = ApiResult.class)
public ApiResult deleteSysUser(@Valid @RequestBody IdParam idParam) throws Exception {
- boolean flag = SysUserService.removeById(idParam.getId());
+ boolean flag = sysUserService.removeById(idParam.getId());
return ApiResult.result(flag);
}
@@ -89,8 +73,8 @@ public ApiResult deleteSysUser(@Valid @RequestBody IdParam idParam) thr
@PostMapping("/info")
@ApiOperation(value = "获取SysUser对象详情", notes = "查看SystemUser", response = SysUserQueryVo.class)
public ApiResult getSysUser(@Valid @RequestBody IdParam idParam) throws Exception {
- SysUserQueryVo SysUserQueryVo = SysUserService.getSysUserById(idParam.getId());
- return ApiResult.ok(SysUserQueryVo);
+ SysUserQueryVo sysUserQueryVo = sysUserService.getSysUserById(idParam.getId());
+ return ApiResult.ok(sysUserQueryVo);
}
/**
@@ -98,8 +82,8 @@ public ApiResult getSysUser(@Valid @RequestBody IdParam idParam)
*/
@PostMapping("/getPageList")
@ApiOperation(value = "获取SysUser分页列表", notes = "SystemUser分页列表", response = SysUserQueryVo.class)
- public ApiResult> getSysUserPageList(@Valid @RequestBody(required = false) SysUserQueryParam SysUserQueryParam) throws Exception {
- Paging paging = SysUserService.getSysUserPageList(SysUserQueryParam);
+ public ApiResult> getSysUserPageList(@Valid @RequestBody SysUserQueryParam sysUserQueryParam) throws Exception {
+ Paging paging = sysUserService.getSysUserPageList(sysUserQueryParam);
return ApiResult.ok(paging);
}
diff --git a/src/main/java/io/geekidea/springbootplus/system/entity/Ip.java b/src/main/java/io/geekidea/springbootplus/system/entity/Ip.java
index 5f001317..294750d1 100644
--- a/src/main/java/io/geekidea/springbootplus/system/entity/Ip.java
+++ b/src/main/java/io/geekidea/springbootplus/system/entity/Ip.java
@@ -1,28 +1,13 @@
-/*
- * Copyright 2019-2029 geekidea(https://github.com/geekidea)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
package io.geekidea.springbootplus.system.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.geekidea.springbootplus.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
/**
*
@@ -30,35 +15,29 @@
*
*
* @author geekidea
- * @since 2019-08-04
+ * @since 2019-10-11
*/
@Data
+@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
-@ApiModel(value="Ip对象", description="IP地址")
+@ApiModel(value = "Ip对象", description = "IP地址")
public class Ip extends BaseEntity {
private static final long serialVersionUID = 1L;
- @ApiModelProperty(value = "ip开始地址")
private String ipStart;
- @ApiModelProperty(value = "ip结束地址")
private String ipEnd;
- @ApiModelProperty(value = "区域")
private String area;
- @ApiModelProperty(value = "运营商")
private String operator;
- @ApiModelProperty(value = "主键")
- @TableId(value = "id", type = IdType.ID_WORKER)
+ @TableId(value = "id", type = IdType.AUTO)
private Long id;
- @ApiModelProperty(value = "ip开始地址数字")
private Long ipStartNum;
- @ApiModelProperty(value = "ip结束地址数字")
private Long ipEndNum;
}
diff --git a/src/main/java/io/geekidea/springbootplus/system/entity/SysLog.java b/src/main/java/io/geekidea/springbootplus/system/entity/SysLog.java
index d8c94522..a18906fc 100644
--- a/src/main/java/io/geekidea/springbootplus/system/entity/SysLog.java
+++ b/src/main/java/io/geekidea/springbootplus/system/entity/SysLog.java
@@ -17,7 +17,6 @@
package io.geekidea.springbootplus.system.entity;
import com.baomidou.mybatisplus.annotation.IdType;
-import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableId;
import io.geekidea.springbootplus.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
@@ -26,13 +25,15 @@
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
+import java.util.Date;
+
/**
*
* 系统日志
*
*
* @author geekidea
- * @since 2019-10-05
+ * @since 2019-10-11
*/
@Data
@Accessors(chain = true)
diff --git a/src/main/java/io/geekidea/springbootplus/system/entity/SysUser.java b/src/main/java/io/geekidea/springbootplus/system/entity/SysUser.java
index 8ef9d0b9..845810ba 100644
--- a/src/main/java/io/geekidea/springbootplus/system/entity/SysUser.java
+++ b/src/main/java/io/geekidea/springbootplus/system/entity/SysUser.java
@@ -1,19 +1,3 @@
-/*
- * Copyright 2019-2029 geekidea(https://github.com/geekidea)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
package io.geekidea.springbootplus.system.entity;
import com.baomidou.mybatisplus.annotation.IdType;
@@ -26,13 +10,16 @@
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+
/**
*
* SystemUser
*
*
* @author geekidea
- * @since 2019-10-05
+ * @since 2019-10-11
*/
@Data
@Accessors(chain = true)
@@ -47,12 +34,14 @@ public class SysUser extends BaseEntity {
private Long id;
@ApiModelProperty(value = "用户名")
+ @NotBlank(message = "用户名不能为空")
private String username;
@ApiModelProperty(value = "昵称")
private String nickname;
@ApiModelProperty(value = "密码")
+ @NotBlank(message = "密码不能为空")
private String password;
@ApiModelProperty(value = "盐值")
diff --git a/src/main/java/io/geekidea/springbootplus/system/mapper/IpMapper.java b/src/main/java/io/geekidea/springbootplus/system/mapper/IpMapper.java
index 2644d77e..89e116de 100644
--- a/src/main/java/io/geekidea/springbootplus/system/mapper/IpMapper.java
+++ b/src/main/java/io/geekidea/springbootplus/system/mapper/IpMapper.java
@@ -1,34 +1,42 @@
-/*
- * Copyright 2019-2029 geekidea(https://github.com/geekidea)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
package io.geekidea.springbootplus.system.mapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import io.geekidea.springbootplus.system.entity.Ip;
+import io.geekidea.springbootplus.system.param.IpQueryParam;
+import io.geekidea.springbootplus.system.vo.IpQueryVo;
+import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
+import java.io.Serializable;
+
/**
*
* IP地址 Mapper 接口
*
*
* @author geekidea
- * @since 2019-08-04
+ * @since 2019-10-11
*/
@Repository
public interface IpMapper extends BaseMapper {
+ /**
+ * 根据ID获取查询对象
+ *
+ * @param id
+ * @return
+ */
+ IpQueryVo getIpById(Serializable id);
+
+ /**
+ * 获取分页对象
+ *
+ * @param page
+ * @param ipQueryParam
+ * @return
+ */
+ IPage getIpPageList(@Param("page") Page page, @Param("param") IpQueryParam ipQueryParam);
+
}
diff --git a/src/main/java/io/geekidea/springbootplus/system/mapper/SysLogMapper.java b/src/main/java/io/geekidea/springbootplus/system/mapper/SysLogMapper.java
index 96f62c5b..3f3d7545 100644
--- a/src/main/java/io/geekidea/springbootplus/system/mapper/SysLogMapper.java
+++ b/src/main/java/io/geekidea/springbootplus/system/mapper/SysLogMapper.java
@@ -1,27 +1,11 @@
-/*
- * Copyright 2019-2029 geekidea(https://github.com/geekidea)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
package io.geekidea.springbootplus.system.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import io.geekidea.springbootplus.system.entity.SysLog;
-import io.geekidea.springbootplus.system.web.param.SysLogQueryParam;
-import io.geekidea.springbootplus.system.web.vo.SysLogQueryVo;
+import io.geekidea.springbootplus.system.param.SysLogQueryParam;
+import io.geekidea.springbootplus.system.vo.SysLogQueryVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
@@ -33,7 +17,7 @@
*
*
* @author geekidea
- * @since 2019-10-05
+ * @since 2019-10-11
*/
@Repository
public interface SysLogMapper extends BaseMapper {
@@ -50,9 +34,9 @@ public interface SysLogMapper extends BaseMapper {
* 获取分页对象
*
* @param page
- * @param SysLogQueryParam
+ * @param sysLogQueryParam
* @return
*/
- IPage getSysLogPageList(@Param("page") Page page, @Param("param") SysLogQueryParam SysLogQueryParam);
+ IPage getSysLogPageList(@Param("page") Page page, @Param("param") SysLogQueryParam sysLogQueryParam);
}
diff --git a/src/main/java/io/geekidea/springbootplus/system/mapper/SysUserMapper.java b/src/main/java/io/geekidea/springbootplus/system/mapper/SysUserMapper.java
index 1a722417..4c61698c 100644
--- a/src/main/java/io/geekidea/springbootplus/system/mapper/SysUserMapper.java
+++ b/src/main/java/io/geekidea/springbootplus/system/mapper/SysUserMapper.java
@@ -1,28 +1,11 @@
-/*
- * Copyright 2019-2029 geekidea(https://github.com/geekidea)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
package io.geekidea.springbootplus.system.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import io.geekidea.springbootplus.shiro.vo.LoginSysUserVo;
import io.geekidea.springbootplus.system.entity.SysUser;
-import io.geekidea.springbootplus.system.web.param.SysUserQueryParam;
-import io.geekidea.springbootplus.system.web.vo.SysUserQueryVo;
+import io.geekidea.springbootplus.system.param.SysUserQueryParam;
+import io.geekidea.springbootplus.system.vo.SysUserQueryVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
@@ -34,7 +17,7 @@
*
*
* @author geekidea
- * @since 2019-10-05
+ * @since 2019-10-11
*/
@Repository
public interface SysUserMapper extends BaseMapper {
@@ -51,10 +34,10 @@ public interface SysUserMapper extends BaseMapper {
* 获取分页对象
*
* @param page
- * @param SysUserQueryParam
+ * @param sysUserQueryParam
* @return
*/
- IPage getSysUserPageList(@Param("page") Page page, @Param("param") SysUserQueryParam SysUserQueryParam);
+ IPage getSysUserPageList(@Param("page") Page page, @Param("param") SysUserQueryParam sysUserQueryParam);
/**
* 根据用户名获取用户信息
diff --git a/src/main/java/io/geekidea/springbootplus/system/param/IpQueryParam.java b/src/main/java/io/geekidea/springbootplus/system/param/IpQueryParam.java
new file mode 100644
index 00000000..3976fd24
--- /dev/null
+++ b/src/main/java/io/geekidea/springbootplus/system/param/IpQueryParam.java
@@ -0,0 +1,24 @@
+package io.geekidea.springbootplus.system.param;
+
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import io.geekidea.springbootplus.common.param.QueryParam;
+
+/**
+ *
+ * IP地址 查询参数对象
+ *
+ *
+ * @author geekidea
+ * @date 2019-10-11
+ */
+@Data
+@Accessors(chain = true)
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "IpQueryParam对象", description = "IP地址查询参数")
+public class IpQueryParam extends QueryParam {
+ private static final long serialVersionUID = 1L;
+}
diff --git a/src/main/java/io/geekidea/springbootplus/system/param/SysLogQueryParam.java b/src/main/java/io/geekidea/springbootplus/system/param/SysLogQueryParam.java
new file mode 100644
index 00000000..d2d3c55b
--- /dev/null
+++ b/src/main/java/io/geekidea/springbootplus/system/param/SysLogQueryParam.java
@@ -0,0 +1,24 @@
+package io.geekidea.springbootplus.system.param;
+
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import io.geekidea.springbootplus.common.param.QueryParam;
+
+/**
+ *
+ * 系统日志 查询参数对象
+ *
+ *
+ * @author geekidea
+ * @date 2019-10-11
+ */
+@Data
+@Accessors(chain = true)
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "SysLogQueryParam对象", description = "系统日志查询参数")
+public class SysLogQueryParam extends QueryParam {
+ private static final long serialVersionUID = 1L;
+}
diff --git a/src/main/java/io/geekidea/springbootplus/system/param/SysUserQueryParam.java b/src/main/java/io/geekidea/springbootplus/system/param/SysUserQueryParam.java
new file mode 100644
index 00000000..fb8bea68
--- /dev/null
+++ b/src/main/java/io/geekidea/springbootplus/system/param/SysUserQueryParam.java
@@ -0,0 +1,24 @@
+package io.geekidea.springbootplus.system.param;
+
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import io.geekidea.springbootplus.common.param.QueryParam;
+
+/**
+ *
+ * SystemUser 查询参数对象
+ *
+ *
+ * @author geekidea
+ * @date 2019-10-11
+ */
+@Data
+@Accessors(chain = true)
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "SysUserQueryParam对象", description = "SystemUser查询参数")
+public class SysUserQueryParam extends QueryParam {
+ private static final long serialVersionUID = 1L;
+}
diff --git a/src/main/java/io/geekidea/springbootplus/system/service/IpService.java b/src/main/java/io/geekidea/springbootplus/system/service/IpService.java
index 1d42c944..2e0ba43f 100644
--- a/src/main/java/io/geekidea/springbootplus/system/service/IpService.java
+++ b/src/main/java/io/geekidea/springbootplus/system/service/IpService.java
@@ -1,23 +1,12 @@
-/*
- * Copyright 2019-2029 geekidea(https://github.com/geekidea)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
package io.geekidea.springbootplus.system.service;
-import io.geekidea.springbootplus.common.service.BaseService;
import io.geekidea.springbootplus.system.entity.Ip;
+import io.geekidea.springbootplus.common.service.BaseService;
+import io.geekidea.springbootplus.system.param.IpQueryParam;
+import io.geekidea.springbootplus.system.vo.IpQueryVo;
+import io.geekidea.springbootplus.common.vo.Paging;
+
+import java.io.Serializable;
/**
*
@@ -25,9 +14,24 @@
*
*
* @author geekidea
- * @since 2019-08-04
+ * @since 2019-10-11
*/
public interface IpService extends BaseService {
+ /**
+ * 根据ID获取查询对象
+ *
+ * @param id
+ * @return
+ */
+ IpQueryVo getIpById(Serializable id) throws Exception;
+
+ /**
+ * 获取分页对象
+ *
+ * @param ipQueryParam
+ * @return
+ */
+ Paging getIpPageList(IpQueryParam ipQueryParam) throws Exception;
}
diff --git a/src/main/java/io/geekidea/springbootplus/system/service/SysLogService.java b/src/main/java/io/geekidea/springbootplus/system/service/SysLogService.java
index 70869ad8..f1cc9b82 100644
--- a/src/main/java/io/geekidea/springbootplus/system/service/SysLogService.java
+++ b/src/main/java/io/geekidea/springbootplus/system/service/SysLogService.java
@@ -1,26 +1,10 @@
-/*
- * Copyright 2019-2029 geekidea(https://github.com/geekidea)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
package io.geekidea.springbootplus.system.service;
import io.geekidea.springbootplus.system.entity.SysLog;
import io.geekidea.springbootplus.common.service.BaseService;
-import io.geekidea.springbootplus.system.web.param.SysLogQueryParam;
-import io.geekidea.springbootplus.system.web.vo.SysLogQueryVo;
-import io.geekidea.springbootplus.common.web.vo.Paging;
+import io.geekidea.springbootplus.system.param.SysLogQueryParam;
+import io.geekidea.springbootplus.system.vo.SysLogQueryVo;
+import io.geekidea.springbootplus.common.vo.Paging;
import java.io.Serializable;
@@ -30,7 +14,7 @@
*
*
* @author geekidea
- * @since 2019-10-05
+ * @since 2019-10-11
*/
public interface SysLogService extends BaseService {
@@ -45,9 +29,9 @@ public interface SysLogService extends BaseService {
/**
* 获取分页对象
*
- * @param SysLogQueryParam
+ * @param sysLogQueryParam
* @return
*/
- Paging getSysLogPageList(SysLogQueryParam SysLogQueryParam) throws Exception;
+ Paging getSysLogPageList(SysLogQueryParam sysLogQueryParam) throws Exception;
}
diff --git a/src/main/java/io/geekidea/springbootplus/system/service/SysUserService.java b/src/main/java/io/geekidea/springbootplus/system/service/SysUserService.java
index c328ca30..c9622aa9 100644
--- a/src/main/java/io/geekidea/springbootplus/system/service/SysUserService.java
+++ b/src/main/java/io/geekidea/springbootplus/system/service/SysUserService.java
@@ -1,26 +1,10 @@
-/*
- * Copyright 2019-2029 geekidea(https://github.com/geekidea)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
package io.geekidea.springbootplus.system.service;
import io.geekidea.springbootplus.system.entity.SysUser;
import io.geekidea.springbootplus.common.service.BaseService;
-import io.geekidea.springbootplus.system.web.param.SysUserQueryParam;
-import io.geekidea.springbootplus.system.web.vo.SysUserQueryVo;
-import io.geekidea.springbootplus.common.web.vo.Paging;
+import io.geekidea.springbootplus.system.param.SysUserQueryParam;
+import io.geekidea.springbootplus.system.vo.SysUserQueryVo;
+import io.geekidea.springbootplus.common.vo.Paging;
import java.io.Serializable;
@@ -30,7 +14,7 @@
*