Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
Smart Hospital
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
李俊
Smart Hospital
Commits
f83b40ba
Commit
f83b40ba
authored
Mar 31, 2022
by
lijun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
将mysql转化成oracle数据库2
parent
d6495c28
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
83 additions
and
206 deletions
+83
-206
doc/hosts.txt
doc/hosts.txt
+5
-0
smart-hospital-common/smart-common-data/src/main/java/com/smart/hospital/common/data/datascope/DataScopeInterceptor.java
.../hospital/common/data/datascope/DataScopeInterceptor.java
+6
-6
smart-hospital-upms/smart-upms-api/src/main/java/com/smart/hospital/admin/api/feign/RemoteTenantService.java
...m/smart/hospital/admin/api/feign/RemoteTenantService.java
+2
-4
smart-hospital-upms/smart-upms-api/src/main/java/com/smart/hospital/admin/api/vo/UserVO.java
...src/main/java/com/smart/hospital/admin/api/vo/UserVO.java
+1
-1
smart-hospital-upms/smart-upms-biz/src/main/java/com/smart/hospital/admin/controller/upms/SysTenantController.java
...t/hospital/admin/controller/upms/SysTenantController.java
+0
-111
smart-hospital-upms/smart-upms-biz/src/main/java/com/smart/hospital/admin/mapper/SysTenantMapper.java
...java/com/smart/hospital/admin/mapper/SysTenantMapper.java
+0
-15
smart-hospital-upms/smart-upms-biz/src/main/resources/mapper/SysDictItemMapper.xml
...-upms-biz/src/main/resources/mapper/SysDictItemMapper.xml
+1
-1
smart-hospital-upms/smart-upms-biz/src/main/resources/mapper/SysDictMapper.xml
...mart-upms-biz/src/main/resources/mapper/SysDictMapper.xml
+1
-1
smart-hospital-upms/smart-upms-biz/src/main/resources/mapper/SysUserMapper.xml
...mart-upms-biz/src/main/resources/mapper/SysUserMapper.xml
+67
-67
No files found.
doc/hosts.txt
0 → 100644
View file @
f83b40ba
10.10.10.112 smart-register
10.10.10.112 smart-redis
10.10.10.112 smart-mq
127.0.0.1 smart-gateway
10.10.10.99 smart-oracle
\ No newline at end of file
smart-hospital-common/smart-common-data/src/main/java/com/smart/hospital/common/data/datascope/DataScopeInterceptor.java
View file @
f83b40ba
...
@@ -77,25 +77,25 @@ public class DataScopeInterceptor extends AbstractSqlParserHandler implements In
...
@@ -77,25 +77,25 @@ public class DataScopeInterceptor extends AbstractSqlParserHandler implements In
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
Entity
query
=
Db
.
use
(
dataSource
)
Entity
query
=
Db
.
use
(
dataSource
)
.
query
(
"SELECT * FROM
sys_role where role_id
IN ("
+
CollUtil
.
join
(
roleIdList
,
","
)
+
")"
)
.
query
(
"SELECT * FROM
SYS_ROLE where ROLE_ID
IN ("
+
CollUtil
.
join
(
roleIdList
,
","
)
+
")"
)
.
stream
().
min
(
Comparator
.
comparingInt
(
o
->
o
.
getInt
(
"
ds_type
"
))).
get
();
.
stream
().
min
(
Comparator
.
comparingInt
(
o
->
o
.
getInt
(
"
DS_TYPE
"
))).
get
();
Integer
dsType
=
query
.
getInt
(
"
ds_type
"
);
Integer
dsType
=
query
.
getInt
(
"
DS_TYPE
"
);
// 查询全部
// 查询全部
if
(
DataScopeTypeEnum
.
ALL
.
getType
()
==
dsType
)
{
if
(
DataScopeTypeEnum
.
ALL
.
getType
()
==
dsType
)
{
return
invocation
.
proceed
();
return
invocation
.
proceed
();
}
}
// 自定义
// 自定义
if
(
DataScopeTypeEnum
.
CUSTOM
.
getType
()
==
dsType
)
{
if
(
DataScopeTypeEnum
.
CUSTOM
.
getType
()
==
dsType
)
{
String
dsScope
=
query
.
getStr
(
"
ds_scope
"
);
String
dsScope
=
query
.
getStr
(
"
DS_SCOPE
"
);
deptIds
.
addAll
(
Arrays
.
stream
(
dsScope
.
split
(
StrUtil
.
COMMA
))
deptIds
.
addAll
(
Arrays
.
stream
(
dsScope
.
split
(
StrUtil
.
COMMA
))
.
map
(
Integer:
:
parseInt
).
collect
(
Collectors
.
toList
()));
.
map
(
Integer:
:
parseInt
).
collect
(
Collectors
.
toList
()));
}
}
// 查询本级及其下级
// 查询本级及其下级
if
(
DataScopeTypeEnum
.
OWN_CHILD_LEVEL
.
getType
()
==
dsType
)
{
if
(
DataScopeTypeEnum
.
OWN_CHILD_LEVEL
.
getType
()
==
dsType
)
{
List
<
Integer
>
deptIdList
=
Db
.
use
(
dataSource
)
List
<
Integer
>
deptIdList
=
Db
.
use
(
dataSource
)
.
findBy
(
"
sys_dept_relation"
,
"ancestor
"
,
user
.
getDeptId
())
.
findBy
(
"
SYS_DEPT_RELATION"
,
"ANCESTOR
"
,
user
.
getDeptId
())
.
stream
().
map
(
entity
->
entity
.
getInt
(
"
descendant
"
))
.
stream
().
map
(
entity
->
entity
.
getInt
(
"
DESCENDANT
"
))
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
deptIds
.
addAll
(
deptIdList
);
deptIds
.
addAll
(
deptIdList
);
}
}
...
...
smart-hospital-upms/smart-upms-api/src/main/java/com/smart/hospital/admin/api/feign/RemoteTenantService.java
View file @
f83b40ba
package
com.smart.hospital.admin.api.feign
;
package
com.smart.hospital.admin.api.feign
;
import
com.smart.hospital.common.core.constant.SecurityConstants
;
import
com.smart.hospital.common.core.constant.SecurityConstants
;
...
@@ -25,7 +23,7 @@ public interface RemoteTenantService {
...
@@ -25,7 +23,7 @@ public interface RemoteTenantService {
* @param from 内部标志
* @param from 内部标志
* @return
* @return
*/
*/
@GetMapping
(
"/tenant/list"
)
//
@GetMapping("/tenant/list")
R
<
List
<
SysTenant
>>
list
(
@RequestHeader
(
SecurityConstants
.
FROM
)
String
from
);
//
R<List<SysTenant>> list(@RequestHeader(SecurityConstants.FROM) String from);
}
}
smart-hospital-upms/smart-upms-api/src/main/java/com/smart/hospital/admin/api/vo/UserVO.java
View file @
f83b40ba
...
@@ -92,7 +92,7 @@ public class UserVO implements Serializable {
...
@@ -92,7 +92,7 @@ public class UserVO implements Serializable {
* 租户ID
* 租户ID
*/
*/
@ApiModelProperty
(
value
=
"所属租户"
)
@ApiModelProperty
(
value
=
"所属租户"
)
private
Integer
tenant
Id
;
private
Integer
hospital
Id
;
/**
/**
* 部门名称
* 部门名称
*/
*/
...
...
smart-hospital-upms/smart-upms-biz/src/main/java/com/smart/hospital/admin/controller/upms/SysTenantController.java
deleted
100644 → 0
View file @
d6495c28
package
com.smart.hospital.admin.controller.upms
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.smart.hospital.common.core.constant.CacheConstants
;
import
com.smart.hospital.common.core.util.R
;
import
com.smart.hospital.common.log.annotation.SysLog
;
import
com.smart.hospital.common.security.annotation.Inner
;
import
io.swagger.annotations.Api
;
import
lombok.AllArgsConstructor
;
import
org.springframework.cache.annotation.CacheEvict
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
/**
* 租户管理
*
* @author giaogiao
* @date 2019-05-15 15:55:41
*/
@RestController
@AllArgsConstructor
@RequestMapping
(
"/tenant"
)
@Api
(
value
=
"tenant"
,
tags
=
"租户管理"
)
public
class
SysTenantController
{
private
final
SysTenantService
sysTenantService
;
/**
* 分页查询
*
* @param page 分页对象
* @param sysTenant 租户
* @return
*/
@GetMapping
(
"/page"
)
public
R
getSysTenantPage
(
Page
page
,
SysTenant
sysTenant
)
{
return
R
.
ok
(
sysTenantService
.
page
(
page
,
Wrappers
.
query
(
sysTenant
)));
}
/**
* 通过id查询租户
*
* @param id id
* @return R
*/
@GetMapping
(
"/{id}"
)
public
R
getById
(
@PathVariable
(
"id"
)
Integer
id
)
{
return
R
.
ok
(
sysTenantService
.
getById
(
id
));
}
/**
* 新增租户
*
* @param sysTenant 租户
* @return R
*/
@SysLog
(
"新增租户"
)
@PostMapping
@PreAuthorize
(
"@pms.hasPermission('admin_systenant_add')"
)
@CacheEvict
(
value
=
CacheConstants
.
TENANT_DETAILS
,
allEntries
=
true
)
public
R
save
(
@RequestBody
SysTenant
sysTenant
)
{
return
R
.
ok
(
sysTenantService
.
saveTenant
(
sysTenant
));
}
/**
* 修改租户
*
* @param sysTenant 租户
* @return R
*/
@SysLog
(
"修改租户"
)
@PutMapping
@PreAuthorize
(
"@pms.hasPermission('admin_systenant_edit')"
)
@CacheEvict
(
value
=
CacheConstants
.
TENANT_DETAILS
,
allEntries
=
true
)
public
R
updateById
(
@RequestBody
SysTenant
sysTenant
)
{
return
R
.
ok
(
sysTenantService
.
updateById
(
sysTenant
));
}
/**
* 通过id删除租户
*
* @param id id
* @return R
*/
@SysLog
(
"删除租户"
)
@DeleteMapping
(
"/{id}"
)
@CacheEvict
(
value
=
CacheConstants
.
TENANT_DETAILS
,
allEntries
=
true
)
@PreAuthorize
(
"@pms.hasPermission('admin_systenant_del')"
)
public
R
removeById
(
@PathVariable
Integer
id
)
{
return
R
.
ok
(
sysTenantService
.
removeById
(
id
));
}
/**
* 查询全部有效的租户
*
* @return
*/
@Inner
(
value
=
false
)
@GetMapping
(
"/list"
)
@Cacheable
(
value
=
CacheConstants
.
TENANT_DETAILS
)
public
R
list
()
{
return
R
.
ok
(
sysTenantService
.
getNormal
());
}
}
smart-hospital-upms/smart-upms-biz/src/main/java/com/smart/hospital/admin/mapper/SysTenantMapper.java
deleted
100644 → 0
View file @
d6495c28
package
com.smart.hospital.admin.mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
/**
* 租户
*
* @author giaogiao
* @date 2019-05-15 15:55:41
*/
public
interface
SysTenantMapper
extends
BaseMapper
<
SysTenant
>
{
}
smart-hospital-upms/smart-upms-biz/src/main/resources/mapper/SysDictItemMapper.xml
View file @
f83b40ba
...
@@ -16,6 +16,6 @@
...
@@ -16,6 +16,6 @@
<result
property=
"updateTime"
column=
"update_time"
/>
<result
property=
"updateTime"
column=
"update_time"
/>
<result
property=
"remarks"
column=
"remarks"
/>
<result
property=
"remarks"
column=
"remarks"
/>
<result
property=
"delFlag"
column=
"del_flag"
/>
<result
property=
"delFlag"
column=
"del_flag"
/>
<result
property=
"
tenantId"
column=
"tenant
_id"
/>
<result
property=
"
hospitalId"
column=
"hospital
_id"
/>
</resultMap>
</resultMap>
</mapper>
</mapper>
smart-hospital-upms/smart-upms-biz/src/main/resources/mapper/SysDictMapper.xml
View file @
f83b40ba
...
@@ -12,6 +12,6 @@
...
@@ -12,6 +12,6 @@
<result
property=
"updateTime"
column=
"update_time"
/>
<result
property=
"updateTime"
column=
"update_time"
/>
<result
property=
"remarks"
column=
"remarks"
/>
<result
property=
"remarks"
column=
"remarks"
/>
<result
property=
"delFlag"
column=
"del_flag"
/>
<result
property=
"delFlag"
column=
"del_flag"
/>
<result
property=
"
tenantId"
column=
"tenant
_id"
/>
<result
property=
"
hospitalId"
column=
"hospital
_id"
/>
</resultMap>
</resultMap>
</mapper>
</mapper>
smart-hospital-upms/smart-upms-biz/src/main/resources/mapper/SysUserMapper.xml
View file @
f83b40ba
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
<result
column=
"lock_flag"
property=
"lockFlag"
/>
<result
column=
"lock_flag"
property=
"lockFlag"
/>
<result
column=
"udel_flag"
property=
"delFlag"
/>
<result
column=
"udel_flag"
property=
"delFlag"
/>
<result
column=
"deptId"
property=
"deptId"
/>
<result
column=
"deptId"
property=
"deptId"
/>
<result
column=
"
tenantId"
property=
"tenant
Id"
/>
<result
column=
"
hospitalId"
property=
"hospital
Id"
/>
<result
column=
"deptName"
property=
"deptName"
/>
<result
column=
"deptName"
property=
"deptName"
/>
<collection
property=
"roleList"
ofType=
"com.smart.hospital.admin.api.entity.SysRole"
<collection
property=
"roleList"
ofType=
"com.smart.hospital.admin.api.entity.SysRole"
select=
"com.smart.hospital.admin.mapper.SysRoleMapper.listRolesByUserId"
column=
"user_id"
>
select=
"com.smart.hospital.admin.mapper.SysRoleMapper.listRolesByUserId"
column=
"user_id"
>
...
@@ -38,7 +38,7 @@
...
@@ -38,7 +38,7 @@
<result
column=
"lock_flag"
property=
"lockFlag"
/>
<result
column=
"lock_flag"
property=
"lockFlag"
/>
<result
column=
"udel_flag"
property=
"delFlag"
/>
<result
column=
"udel_flag"
property=
"delFlag"
/>
<result
column=
"deptId"
property=
"deptId"
/>
<result
column=
"deptId"
property=
"deptId"
/>
<result
column=
"
tenantId"
property=
"tenant
Id"
/>
<result
column=
"
hospitalId"
property=
"hospital
Id"
/>
<result
column=
"deptName"
property=
"deptName"
/>
<result
column=
"deptName"
property=
"deptName"
/>
<collection
property=
"roleList"
ofType=
"com.smart.hospital.admin.api.entity.SysRole"
>
<collection
property=
"roleList"
ofType=
"com.smart.hospital.admin.api.entity.SysRole"
>
<id
column=
"role_id"
property=
"roleId"
/>
<id
column=
"role_id"
property=
"roleId"
/>
...
@@ -51,21 +51,21 @@
...
@@ -51,21 +51,21 @@
</resultMap>
</resultMap>
<sql
id=
"userRoleSql"
>
<sql
id=
"userRoleSql"
>
`user`
.user_id,
u
.user_id,
`user`
.username,
u
.username,
`user`.`password`
,
u.password
,
`user`
.salt,
u
.salt,
`user`
.phone,
u
.phone,
`user`
.avatar,
u
.avatar,
`user`
.wx_openid,
u
.wx_openid,
`user`
.qq_openid,
u
.qq_openid,
`user`
.dept_id,
u
.dept_id,
`user`
.create_time AS ucreate_time,
u
.create_time AS ucreate_time,
`user`
.update_time AS uupdate_time,
u
.update_time AS uupdate_time,
`user`
.del_flag AS udel_flag,
u
.del_flag AS udel_flag,
`user`
.lock_flag AS lock_flag,
u
.lock_flag AS lock_flag,
`user`
.dept_id AS deptId,
u
.dept_id AS deptId,
`user`.tenant_id AS tenant
Id,
u.hospital_id AS hospital
Id,
r.role_id,
r.role_id,
r.role_name,
r.role_name,
r.role_code,
r.role_code,
...
@@ -75,19 +75,19 @@
...
@@ -75,19 +75,19 @@
</sql>
</sql>
<sql
id=
"userRoleDeptSql"
>
<sql
id=
"userRoleDeptSql"
>
`user`
.user_id,
u
.user_id,
`user`
.username,
u
.username,
`user`.`password`
,
u.password
,
`user`
.salt,
u
.salt,
`user`
.phone,
u
.phone,
`user`
.avatar,
u
.avatar,
`user`
.wx_openid,
u
.wx_openid,
`user`
.qq_openid,
u
.qq_openid,
`user`
.create_time AS ucreate_time,
u
.create_time AS ucreate_time,
`user`
.update_time AS uupdate_time,
u
.update_time AS uupdate_time,
`user`
.del_flag AS udel_flag,
u
.del_flag AS udel_flag,
`user`
.lock_flag AS lock_flag,
u
.lock_flag AS lock_flag,
`user`.tenant_id AS tenant
Id,
u.hospital_id AS hospital
Id,
r.role_id,
r.role_id,
r.role_name,
r.role_name,
r.role_code,
r.role_code,
...
@@ -102,53 +102,53 @@
...
@@ -102,53 +102,53 @@
SELECT
SELECT
<include
refid=
"userRoleSql"
/>
<include
refid=
"userRoleSql"
/>
FROM
FROM
sys_user
AS `user`
sys_user
u
LEFT JOIN sys_user_role
AS ur ON ur.user_id = `user`
.user_id
LEFT JOIN sys_user_role
ur ON ur.user_id = u
.user_id
LEFT JOIN sys_role
AS
r ON r.role_id = ur.role_id
LEFT JOIN sys_role r ON r.role_id = ur.role_id
WHERE `user`
.username = #{username}
WHERE u
.username = #{username}
</select>
</select>
<select
id=
"getUserVoById"
resultMap=
"userVoResultMap"
>
<select
id=
"getUserVoById"
resultMap=
"userVoResultMap"
>
SELECT
SELECT
<include
refid=
"userRoleDeptSql"
/>
<include
refid=
"userRoleDeptSql"
/>
FROM
FROM
sys_user AS `user`
sys_user u
LEFT JOIN sys_user_role AS ur ON ur.user_id = `user`
.user_id
LEFT JOIN sys_user_role ur ON ur.user_id = u
.user_id
LEFT JOIN sys_role AS
r ON r.role_id = ur.role_id
LEFT JOIN sys_role
r ON r.role_id = ur.role_id
LEFT JOIN sys_dept AS d ON d.dept_id = `user`
.dept_id
LEFT JOIN sys_dept d ON d.dept_id = u
.dept_id
WHERE
WHERE
`user`
.user_id = #{id}
u
.user_id = #{id}
</select>
</select>
<select
id=
"getUserVosPage"
resultMap=
"baseResultMap"
>
<select
id=
"getUserVosPage"
resultMap=
"baseResultMap"
>
SELECT
SELECT
`user`
.user_id,
u
.user_id,
`user`
.username,
u
.username,
`user`.`password`
,
u.password
,
`user`
.salt,
u
.salt,
`user`
.phone,
u
.phone,
`user`
.avatar,
u
.avatar,
`user`
.wx_openid,
u
.wx_openid,
`user`
.qq_openid,
u
.qq_openid,
`user`
.dept_id AS deptId,
u
.dept_id AS deptId,
`user`
.create_time AS ucreate_time,
u
.create_time AS ucreate_time,
`user`
.update_time AS uupdate_time,
u
.update_time AS uupdate_time,
`user`
.del_flag AS udel_flag,
u
.del_flag AS udel_flag,
`user`
.lock_flag AS lock_flag,
u
.lock_flag AS lock_flag,
`user`.tenant_id AS tenant
Id,
u.hospital_id AS hospital
Id,
d.name AS deptName
d.name AS deptName
FROM
FROM
sys_user
AS `user`
sys_user
u
LEFT JOIN sys_dept
AS d ON d.dept_id = `user`
.dept_id
LEFT JOIN sys_dept
d ON d.dept_id = u
.dept_id
<where>
<where>
`user`
.del_flag = '0'
u
.del_flag = '0'
<if
test=
"query.username != null and query.username != ''"
>
<if
test=
"query.username != null and query.username != ''"
>
AND
`user`
.username LIKE CONCAT('%',#{query.username},'%')
AND
u
.username LIKE CONCAT('%',#{query.username},'%')
</if>
</if>
<if
test=
"query.deptId != null and query.deptId != ''"
>
<if
test=
"query.deptId != null and query.deptId != ''"
>
AND
`user`
.dept_id = #{query.deptId}
AND
u
.dept_id = #{query.deptId}
</if>
</if>
</where>
</where>
ORDER BY
`user`
.create_time DESC
ORDER BY
u
.create_time DESC
</select>
</select>
</mapper>
</mapper>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment