diff --git a/pigx-common/pigx-common-core/src/main/java/com/pig4cloud/pigx/common/core/constant/ServiceNameConstants.java b/pigx-common/pigx-common-core/src/main/java/com/pig4cloud/pigx/common/core/constant/ServiceNameConstants.java index 832759f95..2d9855dd9 100644 --- a/pigx-common/pigx-common-core/src/main/java/com/pig4cloud/pigx/common/core/constant/ServiceNameConstants.java +++ b/pigx-common/pigx-common-core/src/main/java/com/pig4cloud/pigx/common/core/constant/ServiceNameConstants.java @@ -33,7 +33,7 @@ public interface ServiceNameConstants { /** * UMPS模块 */ - String UMPS_SERVICE = "pigx-upms-biz"; + String UPMS_SERVICE = "pigx-upms-biz"; /** * 分布式事务协调服务 diff --git a/pigx-gateway/README.md b/pigx-gateway/README.md deleted file mode 100644 index c633bf14e..000000000 --- a/pigx-gateway/README.md +++ /dev/null @@ -1,65 +0,0 @@ -## PigX Gateway - -### 网关跨域支持 - -> 如果不知道什么是跨域(CORS),建议先阅读以下内容 -> -> [跨域资源共享 CORS 详解](http://www.ruanyifeng.com/blog/2016/04/cors.html) -> -> [HTTP访问控制(CORS)](https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Access_control_CORS) - - - -#### 配置方式 - -在网关的配置文件中加入以下内容(请根据实际情况修改) - -```yaml -spring: - cloud: - gateway: - globalcors: - corsConfigurations: - '[/**]': - allowCredentials: true - exposedHeaders: "Content-Disposition,Content-Type,Cache-Control" - allowedHeaders: "*" - allowedOrigins: "*" - allowedMethods: "*" -``` - -> - 以上配置可作为开发环境使用,生成环境建议你根据实际情况修改(请先理解CORS,并参考`org.springframework.cloud.gateway.config.GlobalCorsProperties`) -> - 跨域时会产生预检请求(Pre-Flight Request),这样就会对你的服务器产生额外的网络请求。如果可以通过部署手段解决跨域,则可以关闭跨域支持,方法是把以上配置信息清理掉。 - - - -#### 测试 - -为了演示跨域支持效果,可以修改一下前端项目(`PigX-ui`)的登录代码 - -```javascript -export const loginByUsername = (username, password, code, randomStr) => { - const grant_type = 'password' - - return request({ - // 原来的API接口地址 - //url: '/auth/oauth/token', - // 为了触发造跨域,直接修改为网关的url,这里的IP需要改成你自己的,要用真实IP - url: 'http://10.11.12.7:9999/auth/oauth/token', - headers: { - isToken:false, - 'TENANT_ID': '1', - 'Authorization': 'Basic cGlnOnBpZw==' - }, - method: 'post', - params: { username, password, randomStr, code, grant_type, scope } - }) -} -``` - - - -将前端项目跑起来,打开登录页面,观察点击登录按钮的XHR请求,你会发现浏览器发送了两次请求: - -- 第一次是`OPTIONS`方式,这是因为浏览器检测到有一个请求跨域了,于是发出一个预检请求,问一问服务端"有啥处理意见"。 -- 第二次是`POST`方式,也就是真正的需要执行的请求,这是因为“服务端的回答让浏览器满意”了,所以浏览器执行真正的请求。如果服务端(也就是`PigX Gateway`)没有进行相关配置,浏览器就没法得到它期望的答复,这一步便不会执行。 \ No newline at end of file diff --git a/pigx-upms/pigx-upms-api/src/main/java/com/pig4cloud/pigx/admin/api/feign/RemoteLogService.java b/pigx-upms/pigx-upms-api/src/main/java/com/pig4cloud/pigx/admin/api/feign/RemoteLogService.java index b542e0de9..08e2a0093 100644 --- a/pigx-upms/pigx-upms-api/src/main/java/com/pig4cloud/pigx/admin/api/feign/RemoteLogService.java +++ b/pigx-upms/pigx-upms-api/src/main/java/com/pig4cloud/pigx/admin/api/feign/RemoteLogService.java @@ -32,7 +32,7 @@ import org.springframework.web.bind.annotation.RequestHeader; * @author lengleng * @date 2018/6/28 */ -@FeignClient(contextId = "remoteLogService", value = ServiceNameConstants.UMPS_SERVICE) +@FeignClient(contextId = "remoteLogService", value = ServiceNameConstants.UPMS_SERVICE) public interface RemoteLogService { /** * 保存日志 diff --git a/pigx-upms/pigx-upms-api/src/main/java/com/pig4cloud/pigx/admin/api/feign/RemoteTenantService.java b/pigx-upms/pigx-upms-api/src/main/java/com/pig4cloud/pigx/admin/api/feign/RemoteTenantService.java index 49d935a7f..b1066f5f7 100644 --- a/pigx-upms/pigx-upms-api/src/main/java/com/pig4cloud/pigx/admin/api/feign/RemoteTenantService.java +++ b/pigx-upms/pigx-upms-api/src/main/java/com/pig4cloud/pigx/admin/api/feign/RemoteTenantService.java @@ -35,7 +35,7 @@ import java.util.List; *

* 租户接口 */ -@FeignClient(contextId = "remoteTenantService", value = ServiceNameConstants.UMPS_SERVICE) +@FeignClient(contextId = "remoteTenantService", value = ServiceNameConstants.UPMS_SERVICE) public interface RemoteTenantService { /** * 查询全部有效租户 diff --git a/pigx-upms/pigx-upms-api/src/main/java/com/pig4cloud/pigx/admin/api/feign/RemoteUserService.java b/pigx-upms/pigx-upms-api/src/main/java/com/pig4cloud/pigx/admin/api/feign/RemoteUserService.java index e45bc597b..f1493b4a7 100644 --- a/pigx-upms/pigx-upms-api/src/main/java/com/pig4cloud/pigx/admin/api/feign/RemoteUserService.java +++ b/pigx-upms/pigx-upms-api/src/main/java/com/pig4cloud/pigx/admin/api/feign/RemoteUserService.java @@ -35,7 +35,7 @@ import java.util.List; * @author lengleng * @date 2018/6/22 */ -@FeignClient(contextId = "remoteUserService", value = ServiceNameConstants.UMPS_SERVICE) +@FeignClient(contextId = "remoteUserService", value = ServiceNameConstants.UPMS_SERVICE) public interface RemoteUserService { /** * 通过用户名查询用户、角色信息 diff --git a/pigx-upms/pigx-upms-biz/src/main/resources/mapper/SysUserMapper.xml b/pigx-upms/pigx-upms-biz/src/main/resources/mapper/SysUserMapper.xml index 4a265e6f6..d3c943dd2 100644 --- a/pigx-upms/pigx-upms-biz/src/main/resources/mapper/SysUserMapper.xml +++ b/pigx-upms/pigx-upms-biz/src/main/resources/mapper/SysUserMapper.xml @@ -160,11 +160,12 @@ sys_user AS `user` LEFT JOIN sys_dept AS d ON d.dept_id = `user`.dept_id + `user`.del_flag = '0' - and `user`.username LIKE CONCAT('%',#{query.username},'%') + AND `user`.username LIKE CONCAT('%',#{query.username},'%') - and `user`.dept_id = #{query.deptId} + AND `user`.dept_id = #{query.deptId} ORDER BY `user`.create_time DESC