数据源表添加数据源状态字段,删除统一接口权限认证
This commit is contained in:
parent
8d9c6e3f73
commit
09fea1c14c
|
@ -0,0 +1,2 @@
|
|||
ALTER TABLE sys_data_source ADD COLUMN data_state char(1) DEFAULT NULL COMMENT '数据源状态 0校验失败 1校验成功';
|
||||
COMMIT;
|
|
@ -30,7 +30,8 @@ public class SysDataSourceEntity extends BaseEntity {
|
|||
private String serviceName;
|
||||
/** 使用状态1启用0锁定 */
|
||||
private Integer useState;
|
||||
|
||||
/** 数据源状态 1校验成功0校验失败 */
|
||||
private Integer dataState;
|
||||
|
||||
public String getSourceCode() {
|
||||
return sourceCode;
|
||||
|
@ -155,5 +156,13 @@ public class SysDataSourceEntity extends BaseEntity {
|
|||
|
||||
return sourceTypeName;
|
||||
}
|
||||
|
||||
public Integer getDataState() {
|
||||
return dataState;
|
||||
}
|
||||
|
||||
public void setDataState(Integer dataState) {
|
||||
this.dataState = dataState;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
<result property="password" column="password" jdbcType="VARCHAR"/>
|
||||
<result property="serviceName" column="service_name" jdbcType="VARCHAR"/>
|
||||
<result property="useState" column="use_state" jdbcType="INTEGER"/>
|
||||
<result property="dataState" column="data_state" jdbcType="INTEGER"/>
|
||||
<result property="sorts" column="sorts" jdbcType="INTEGER"/>
|
||||
<result property="create_user_id" column="create_user_id" jdbcType="VARCHAR"/>
|
||||
<result property="create_time" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
|
@ -35,7 +36,8 @@
|
|||
,password
|
||||
,service_name
|
||||
,use_state
|
||||
,sorts
|
||||
,data_state
|
||||
,sorts
|
||||
,create_user_id
|
||||
,create_time
|
||||
,modify_user_id
|
||||
|
@ -61,6 +63,7 @@
|
|||
<if test="password != null and password != ''">and password = #{password}</if>
|
||||
<if test="serviceName != null and serviceName != ''">and service_name = #{serviceName}</if>
|
||||
<if test="useState != null">and use_state = #{useState}</if>
|
||||
<if test="dataState != null">and data_state = #{dataState}</if>
|
||||
<if test="sorts != null">and sorts = #{sorts}</if>
|
||||
<if test="create_user_id != null and create_user_id != ''">and create_user_id = #{create_user_id}</if>
|
||||
<if test="create_time != null">and create_time = #{create_time}</if>
|
||||
|
@ -92,6 +95,7 @@
|
|||
<if test="password != null and password != ''">and password = #{password}</if>
|
||||
<if test="serviceName != null and serviceName != ''">and service_name = #{serviceName}</if>
|
||||
<if test="useState != null">and use_state = #{useState}</if>
|
||||
<if test="dataState != null">and data_state = #{dataState}</if>
|
||||
<if test="sorts != null">and sorts = #{sorts}</if>
|
||||
<if test="create_user_id != null and create_user_id != ''">and create_user_id = #{create_user_id}</if>
|
||||
<if test="create_time != null">and create_time = #{create_time}</if>
|
||||
|
@ -119,6 +123,7 @@
|
|||
<if test="password != null and password != ''">and password = #{password}</if>
|
||||
<if test="serviceName != null and serviceName != ''">and service_name = #{serviceName}</if>
|
||||
<if test="useState != null">and use_state = #{useState}</if>
|
||||
<if test="dataState != null">and data_state = #{dataState}</if>
|
||||
<if test="sorts != null">and sorts = #{sorts}</if>
|
||||
<if test="create_user_id != null and create_user_id != ''">and create_user_id = #{create_user_id}</if>
|
||||
<if test="create_time != null">and create_time = #{create_time}</if>
|
||||
|
@ -151,6 +156,7 @@
|
|||
<if test="serviceName != null and serviceName != ''">and service_name like concat('%',#{serviceName},'%')
|
||||
</if>
|
||||
<if test="useState != null">and use_state like concat('%',#{useState},'%')</if>
|
||||
<if test="dataState != null">and data_state like concat('%',#{dataState},'%')</if>
|
||||
<if test="sorts != null">and sorts like concat('%',#{sorts},'%')</if>
|
||||
<if test="create_user_id != null and create_user_id != ''">and create_user_id like
|
||||
concat('%',#{create_user_id},'%')
|
||||
|
@ -184,6 +190,7 @@
|
|||
password as password,
|
||||
service_name as serviceName,
|
||||
use_state as useState
|
||||
data_state as dataState
|
||||
from sys_data_source
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="id != null and id != ''">and id like concat('%',#{id},'%')</if>
|
||||
|
@ -198,6 +205,7 @@
|
|||
<if test="serviceName != null and serviceName != ''">and service_name like concat('%',#{serviceName},'%')
|
||||
</if>
|
||||
<if test="useState != null">and use_state like concat('%',#{useState},'%')</if>
|
||||
<if test="dataState != null">and data_state like concat('%',#{dataState},'%')</if>
|
||||
<if test="sorts != null">and sorts like concat('%',#{sorts},'%')</if>
|
||||
<if test="create_user_id != null and create_user_id != ''">and create_user_id like
|
||||
concat('%',#{create_user_id},'%')
|
||||
|
@ -228,6 +236,7 @@
|
|||
password as password,
|
||||
service_name as serviceName,
|
||||
use_state as useState
|
||||
data_state as dataState
|
||||
from sys_data_source
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="id != null and id != ''">and id = #{id}</if>
|
||||
|
@ -241,6 +250,7 @@
|
|||
<if test="password != null and password != ''">and password = #{password}</if>
|
||||
<if test="serviceName != null and serviceName != ''">and service_name = #{serviceName}</if>
|
||||
<if test="useState != null">and use_state = #{useState}</if>
|
||||
<if test="dataState != null">and data_state = #{dataState}</if>
|
||||
<if test="sorts != null">and sorts = #{sorts}</if>
|
||||
<if test="create_user_id != null and create_user_id != ''">and create_user_id = #{create_user_id}</if>
|
||||
<if test="create_time != null">and create_time = #{create_time}</if>
|
||||
|
@ -271,6 +281,7 @@
|
|||
<if test="serviceName != null and serviceName != ''">and service_name like concat('%',#{serviceName},'%')
|
||||
</if>
|
||||
<if test="useState != null">and use_state like concat('%',#{useState},'%')</if>
|
||||
<if test="dataState != null">and data_state like concat('%',#{dataState},'%')</if>
|
||||
<if test="sorts != null">and sorts like concat('%',#{sorts},'%')</if>
|
||||
<if test="create_user_id != null and create_user_id != ''">and create_user_id like
|
||||
concat('%',#{create_user_id},'%')
|
||||
|
@ -304,6 +315,7 @@
|
|||
<if test="password != null and password != ''">or password = #{password}</if>
|
||||
<if test="serviceName != null and serviceName != ''">or service_name = #{serviceName}</if>
|
||||
<if test="useState != null">or use_state = #{useState}</if>
|
||||
<if test="dataState != null">or data_state = #{dataState}</if>
|
||||
<if test="sorts != null">or sorts = #{sorts}</if>
|
||||
<if test="create_user_id != null and create_user_id != ''">or create_user_id = #{create_user_id}</if>
|
||||
<if test="create_time != null">or create_time = #{create_time}</if>
|
||||
|
@ -333,6 +345,7 @@
|
|||
<if test="password != null and password != ''">password ,</if>
|
||||
<if test="serviceName != null and serviceName != ''">service_name ,</if>
|
||||
<if test="useState != null">use_state ,</if>
|
||||
<if test="dataState != null">data_state ,</if>
|
||||
<if test="sorts != null">sorts ,</if>
|
||||
<if test="create_user_id != null and create_user_id != ''">create_user_id ,</if>
|
||||
<if test="create_time != null">create_time ,</if>
|
||||
|
@ -356,6 +369,7 @@
|
|||
<if test="password != null and password != ''">#{password} ,</if>
|
||||
<if test="serviceName != null and serviceName != ''">#{serviceName} ,</if>
|
||||
<if test="useState != null">#{useState} ,</if>
|
||||
<if test="dataState != null">#{dataState} ,</if>
|
||||
<if test="sorts != null">#{sorts} ,</if>
|
||||
<if test="create_user_id != null and create_user_id != ''">#{create_user_id} ,</if>
|
||||
<if test="create_time != null">#{create_time} ,</if>
|
||||
|
@ -373,21 +387,21 @@
|
|||
<!-- 批量新增 -->
|
||||
<insert id="entityInsertBatch" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into sys_data_source(source_code, source_name, source_ip, source_port, db_name, source_type, login_name,
|
||||
password, service_name, use_state, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id,
|
||||
password, service_name, use_state, data_state, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id,
|
||||
sts)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.sourceCode},#{entity.sourceName},#{entity.sourceIp},#{entity.sourcePort},#{entity.dbName},#{entity.sourceType},#{entity.loginName},#{entity.password},#{entity.serviceName},#{entity.useState},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},
|
||||
(#{entity.sourceCode},#{entity.sourceName},#{entity.sourceIp},#{entity.sourcePort},#{entity.dbName},#{entity.sourceType},#{entity.loginName},#{entity.password},#{entity.serviceName},#{entity.useState},#{entity.dataState},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},
|
||||
'Y')
|
||||
</foreach>
|
||||
</insert>
|
||||
<!-- 批量新增或者修改-->
|
||||
<insert id="entityInsertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into sys_data_source(source_code, source_name, source_ip, source_port, db_name, source_type, login_name,
|
||||
password, service_name, use_state, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id)
|
||||
password, service_name, use_state, data_state, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.sourceCode},#{entity.sourceName},#{entity.sourceIp},#{entity.sourcePort},#{entity.dbName},#{entity.sourceType},#{entity.loginName},#{entity.password},#{entity.serviceName},#{entity.useState},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id})
|
||||
(#{entity.sourceCode},#{entity.sourceName},#{entity.sourceIp},#{entity.sourcePort},#{entity.dbName},#{entity.sourceType},#{entity.loginName},#{entity.password},#{entity.serviceName},#{entity.useState},#{entity.dataState},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id})
|
||||
</foreach>
|
||||
on duplicate key update
|
||||
source_code = values(source_code),
|
||||
|
@ -400,6 +414,7 @@
|
|||
password = values(password),
|
||||
service_name = values(service_name),
|
||||
use_state = values(use_state),
|
||||
data_state = values(data_state),
|
||||
sorts = values(sorts),
|
||||
create_user_id = values(create_user_id),
|
||||
create_time = values(create_time),
|
||||
|
@ -422,6 +437,7 @@
|
|||
<if test="password != null and password != ''">password = #{password},</if>
|
||||
<if test="serviceName != null and serviceName != ''">service_name = #{serviceName},</if>
|
||||
<if test="useState != null">use_state = #{useState},</if>
|
||||
<if test="dataState != null">data_state = #{dataState},</if>
|
||||
<if test="sorts != null">sorts = #{sorts},</if>
|
||||
<if test="create_user_id != null and create_user_id != ''">create_user_id = #{create_user_id},</if>
|
||||
<if test="create_time != null">create_time = #{create_time},</if>
|
||||
|
@ -453,6 +469,7 @@ where id = #{id}
|
|||
<if test="password != null and password != ''">and password = #{password}</if>
|
||||
<if test="serviceName != null and serviceName != ''">and service_name = #{serviceName}</if>
|
||||
<if test="useState != null">and use_state = #{useState}</if>
|
||||
<if test="dataState != null">and data_state = #{dataState}</if>
|
||||
<if test="sorts != null">and sorts = #{sorts}</if>
|
||||
<if test="sts != null and sts != ''">and sts = #{sts}</if>
|
||||
and sts='Y'
|
||||
|
|
|
@ -88,40 +88,40 @@ public class EntranceServiceImpl implements IEntranceService {
|
|||
try {
|
||||
StpUtil.checkLogin();
|
||||
//校验当前登陆人是否有权限
|
||||
boolean flag = false;
|
||||
String userId = StpUtil.getLoginIdAsString();
|
||||
//获取接口
|
||||
SysInterfaceEntity sysInterfaceEntity = (SysInterfaceEntity) interfaceCache.get("6","beanName"+service+"interfacName"+serviceMethod);
|
||||
if(sysInterfaceEntity == null || sysInterfaceEntity.getId() == null){
|
||||
//todo 接口权限验证
|
||||
return BaseResult.getFailureMessageEntity("用户无访问权限,请联系管理员");
|
||||
}
|
||||
//查询用户权限
|
||||
if(!flag){
|
||||
SysPopedomInterfaceEntity userPopedomInterfaceEntity = (SysPopedomInterfaceEntity) interfaceCache.get("4","userId"+userId+"interfaceId"+sysInterfaceEntity.getId());
|
||||
if(userPopedomInterfaceEntity != null && userPopedomInterfaceEntity.getId() != null ){
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
//查询用户角色的权限
|
||||
if(!flag){
|
||||
List<SysUserRolesEntity> userRoleMap = (List<SysUserRolesEntity>) interfaceCache.get("3",null);
|
||||
if(userRoleMap != null && userRoleMap.size() > 0){
|
||||
for (SysUserRolesEntity sysUserRolesEntity : userRoleMap) {
|
||||
if(sysUserRolesEntity.getUserId().equals(userId)){
|
||||
SysPopedomInterfaceEntity sysPopedomInterfaceEntity = (SysPopedomInterfaceEntity) interfaceCache.get("5","roleId"+sysUserRolesEntity.getRoleId()+"interfaceId"+sysInterfaceEntity.getId());
|
||||
if(sysPopedomInterfaceEntity != null && sysPopedomInterfaceEntity.getId() != null ){
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!flag){
|
||||
//todo 接口权限验证
|
||||
return BaseResult.getFailureMessageEntity("用户无访问权限,请联系管理员");
|
||||
}
|
||||
// 接口权限验证 开始
|
||||
//boolean flag = false;
|
||||
//String userId = StpUtil.getLoginIdAsString();
|
||||
////获取接口
|
||||
//SysInterfaceEntity sysInterfaceEntity = (SysInterfaceEntity) interfaceCache.get("6","beanName"+service+"interfacName"+serviceMethod);
|
||||
//if(sysInterfaceEntity == null || sysInterfaceEntity.getId() == null){
|
||||
// return BaseResult.getFailureMessageEntity("用户无访问权限,请联系管理员");
|
||||
//}
|
||||
////查询用户权限
|
||||
//if(!flag){
|
||||
// SysPopedomInterfaceEntity userPopedomInterfaceEntity = (SysPopedomInterfaceEntity) interfaceCache.get("4","userId"+userId+"interfaceId"+sysInterfaceEntity.getId());
|
||||
// if(userPopedomInterfaceEntity != null && userPopedomInterfaceEntity.getId() != null ){
|
||||
// flag = true;
|
||||
// }
|
||||
//}
|
||||
////查询用户角色的权限
|
||||
//if(!flag){
|
||||
// List<SysUserRolesEntity> userRoleMap = (List<SysUserRolesEntity>) interfaceCache.get("3",null);
|
||||
// if(userRoleMap != null && userRoleMap.size() > 0){
|
||||
// for (SysUserRolesEntity sysUserRolesEntity : userRoleMap) {
|
||||
// if(sysUserRolesEntity.getUserId().equals(userId)){
|
||||
// SysPopedomInterfaceEntity sysPopedomInterfaceEntity = (SysPopedomInterfaceEntity) interfaceCache.get("5","roleId"+sysUserRolesEntity.getRoleId()+"interfaceId"+sysInterfaceEntity.getId());
|
||||
// if(sysPopedomInterfaceEntity != null && sysPopedomInterfaceEntity.getId() != null ){
|
||||
// flag = true;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//if(!flag){
|
||||
// return BaseResult.getFailureMessageEntity("用户无访问权限,请联系管理员");
|
||||
//}
|
||||
// 接口权限验证 结束
|
||||
} catch (NotLoginException e) {
|
||||
logger.error("token无效");
|
||||
return BaseResult.getFailureMessageEntity("token无效");
|
||||
|
|
Loading…
Reference in New Issue