1.给菜单类添加类型转换器功能解决mysql迁库pg的问题
This commit is contained in:
parent
e5ad6fd156
commit
061f8d8211
|
@ -0,0 +1,59 @@
|
|||
package org.jeecg.config.mybatis;
|
||||
|
||||
import lombok.val;
|
||||
import org.apache.ibatis.type.BaseTypeHandler;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
|
||||
import java.sql.CallableStatement;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class CustomBooleanToInt2TypeHandler extends BaseTypeHandler<Boolean> {
|
||||
|
||||
/**
|
||||
* @param ps
|
||||
* @param i
|
||||
* @param parameter
|
||||
* @param jdbcType
|
||||
* @throws SQLException
|
||||
*/
|
||||
@Override
|
||||
public void setNonNullParameter(PreparedStatement ps, int i, Boolean parameter, JdbcType jdbcType) throws SQLException {
|
||||
ps.setInt(i,parameter==true?1:0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param rs
|
||||
* @param columnName
|
||||
* @return
|
||||
* @throws SQLException
|
||||
*/
|
||||
@Override
|
||||
public Boolean getNullableResult(ResultSet rs, String columnName) throws SQLException {
|
||||
int value = rs.getInt(columnName);
|
||||
return value==1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param rs
|
||||
* @param columnIndex
|
||||
* @return
|
||||
* @throws SQLException
|
||||
*/
|
||||
@Override
|
||||
public Boolean getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cs
|
||||
* @param columnIndex
|
||||
* @return
|
||||
* @throws SQLException
|
||||
*/
|
||||
@Override
|
||||
public Boolean getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -1,16 +1,10 @@
|
|||
package org.jeecg.config;
|
||||
|
||||
import feign.Feign;
|
||||
import feign.RequestTemplate;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import org.apache.http.HttpHeaders;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
import feign.Logger;
|
||||
import feign.RequestInterceptor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ import lombok.Data;
|
|||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import org.jeecg.config.mybatis.CustomBooleanToInt2TypeHandler;
|
||||
import org.jeecg.modules.system.constant.DefIndexConst;
|
||||
|
||||
/**
|
||||
|
@ -89,20 +90,20 @@ public class SysPermission implements Serializable {
|
|||
/**
|
||||
* 是否叶子节点: 1:是 0:不是
|
||||
*/
|
||||
@TableField(value="is_leaf")
|
||||
@TableField(value="is_leaf",typeHandler = CustomBooleanToInt2TypeHandler.class)
|
||||
private boolean leaf;
|
||||
|
||||
/**
|
||||
* 是否路由菜单: 0:不是 1:是(默认值1)
|
||||
*/
|
||||
@TableField(value="is_route")
|
||||
@TableField(value="is_route",typeHandler = CustomBooleanToInt2TypeHandler.class)
|
||||
private boolean route;
|
||||
|
||||
|
||||
/**
|
||||
* 是否缓存页面: 0:不是 1:是(默认值1)
|
||||
*/
|
||||
@TableField(value="keep_alive")
|
||||
@TableField(value="keep_alive",typeHandler = CustomBooleanToInt2TypeHandler.class)
|
||||
private boolean keepAlive;
|
||||
|
||||
/**
|
||||
|
@ -128,11 +129,13 @@ public class SysPermission implements Serializable {
|
|||
/**
|
||||
* 是否隐藏路由菜单: 0否,1是(默认值0)
|
||||
*/
|
||||
@TableField(value="hidden",typeHandler = CustomBooleanToInt2TypeHandler.class)
|
||||
private boolean hidden;
|
||||
|
||||
/**
|
||||
* 是否隐藏Tab: 0否,1是(默认值0)
|
||||
*/
|
||||
@TableField(value="hide_tab",typeHandler = CustomBooleanToInt2TypeHandler.class)
|
||||
private boolean hideTab;
|
||||
|
||||
/**
|
||||
|
@ -154,10 +157,12 @@ public class SysPermission implements Serializable {
|
|||
private java.lang.String status;
|
||||
|
||||
/**alwaysShow*/
|
||||
@TableField(value = "always_show",typeHandler = CustomBooleanToInt2TypeHandler.class)
|
||||
private boolean alwaysShow;
|
||||
|
||||
/*update_begin author:wuxianquan date:20190908 for:实体增加字段 */
|
||||
/** 外链菜单打开方式 0/内部打开 1/外部打开 */
|
||||
@TableField(value = "internal_or_external",typeHandler = CustomBooleanToInt2TypeHandler.class)
|
||||
private boolean internalOrExternal;
|
||||
/*update_end author:wuxianquan date:20190908 for:实体增加字段 */
|
||||
|
||||
|
|
|
@ -311,7 +311,7 @@ public class SysPermissionServiceImpl extends ServiceImpl<SysPermissionMapper, S
|
|||
@Override
|
||||
public boolean checkPermDuplication(String id, String url,Boolean alwaysShow) {
|
||||
QueryWrapper<SysPermission> qw=new QueryWrapper();
|
||||
qw.lambda().eq(true,SysPermission::getUrl,url).ne(oConvertUtils.isNotEmpty(id),SysPermission::getId,id).eq(true,SysPermission::isAlwaysShow,alwaysShow);
|
||||
qw.lambda().eq(true,SysPermission::getUrl,url).ne(oConvertUtils.isNotEmpty(id),SysPermission::getId,id).eq(true,SysPermission::isAlwaysShow,alwaysShow==true?1:0);
|
||||
return count(qw)==0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user