org.jeecg.common.constant.DataBaseConstant Java Examples

The following examples show how to use org.jeecg.common.constant.DataBaseConstant. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: QueryGenerator.java    From jeecg-boot with Apache License 2.0 6 votes vote down vote up
private static String getInConditionValue(Object value,boolean isString) {
	if(isString) {
		String temp[] = value.toString().split(",");
		String res="";
		for (String string : temp) {
			if(DataBaseConstant.DB_TYPE_SQLSERVER.equals(getDbType())){
				res+=",N'"+string+"'";
			}else{
				res+=",'"+string+"'";
			}
		}
		return "("+res.substring(1)+")";
	}else {
		return "("+value.toString()+")";
	}
}
 
Example #2
Source File: QueryGenerator.java    From jeecg-boot with Apache License 2.0 6 votes vote down vote up
private static String getFieldConditionValue(Object value,boolean isString) {
	String str = value.toString().trim();
	if(str.startsWith("!")) {
		str = str.substring(1);
	}else if(str.startsWith(">=")) {
		str = str.substring(2);
	}else if(str.startsWith("<=")) {
		str = str.substring(2);
	}else if(str.startsWith(">")) {
		str = str.substring(1);
	}else if(str.startsWith("<")) {
		str = str.substring(1);
	}
	if(isString) {
		if(DataBaseConstant.DB_TYPE_SQLSERVER.equals(getDbType())){
			return " N'"+str+"' ";
		}else{
			return " '"+str+"' ";
		}
	}else {
		return value.toString();
	}
}
 
Example #3
Source File: QueryGenerator.java    From jeecg-cloud with Apache License 2.0 6 votes vote down vote up
private static String getFieldConditionValue(Object value,boolean isString) {
	String str = value.toString().trim();
	if(str.startsWith("!")) {
		str = str.substring(1);
	}else if(str.startsWith(">=")) {
		str = str.substring(2);
	}else if(str.startsWith("<=")) {
		str = str.substring(2);
	}else if(str.startsWith(">")) {
		str = str.substring(1);
	}else if(str.startsWith("<")) {
		str = str.substring(1);
	}
	if(isString) {
		if(DataBaseConstant.DB_TYPE_SQLSERVER.equals(CommonUtils.getDatabaseType())){
			return " N'"+str+"' ";
		}else{
			return " '"+str+"' ";
		}
	}else {
		return value.toString();
	}
}
 
Example #4
Source File: QueryGenerator.java    From jeecg-cloud with Apache License 2.0 6 votes vote down vote up
private static String getInConditionValue(Object value,boolean isString) {
	if(isString) {
		String temp[] = value.toString().split(",");
		String res="";
		for (String string : temp) {
			if(DataBaseConstant.DB_TYPE_SQLSERVER.equals(CommonUtils.getDatabaseType())){
				res+=",N'"+string+"'";
			}else{
				res+=",'"+string+"'";
			}
		}
		return "("+res.substring(1)+")";
	}else {
		return "("+value.toString()+")";
	}
}
 
Example #5
Source File: QueryGenerator.java    From teaching with Apache License 2.0 6 votes vote down vote up
private static String getInConditionValue(Object value,boolean isString) {
	if(isString) {
		String temp[] = value.toString().split(",");
		String res="";
		for (String string : temp) {
			if(DataBaseConstant.DB_TYPE_SQLSERVER.equals(getDbType())){
				res+=",N'"+string+"'";
			}else{
				res+=",'"+string+"'";
			}
		}
		return "("+res.substring(1)+")";
	}else {
		return "("+value.toString()+")";
	}
}
 
Example #6
Source File: QueryGenerator.java    From teaching with Apache License 2.0 6 votes vote down vote up
private static String getFieldConditionValue(Object value,boolean isString) {
	String str = value.toString().trim();
	if(str.startsWith("!")) {
		str = str.substring(1);
	}else if(str.startsWith(">=")) {
		str = str.substring(2);
	}else if(str.startsWith("<=")) {
		str = str.substring(2);
	}else if(str.startsWith(">")) {
		str = str.substring(1);
	}else if(str.startsWith("<")) {
		str = str.substring(1);
	}
	if(isString) {
		if(DataBaseConstant.DB_TYPE_SQLSERVER.equals(getDbType())){
			return " N'"+str+"' ";
		}else{
			return " '"+str+"' ";
		}
	}else {
		return value.toString();
	}
}
 
Example #7
Source File: CommonUtils.java    From jeecg-cloud with Apache License 2.0 5 votes vote down vote up
/**
 * 获取数据库类型
 * @param dataSource
 * @return
 * @throws SQLException
 */
private static String getDatabaseTypeByDataSource(DataSource dataSource) throws SQLException{
    if("".equals(DB_TYPE)) {
        Connection connection = dataSource.getConnection();
        try {
            DatabaseMetaData md = connection.getMetaData();
            String dbType = md.getDatabaseProductName().toLowerCase();
            if(dbType.indexOf("mysql")>=0) {
                DB_TYPE = DataBaseConstant.DB_TYPE_MYSQL;
            }else if(dbType.indexOf("oracle")>=0) {
                DB_TYPE = DataBaseConstant.DB_TYPE_ORACLE;
            }else if(dbType.indexOf("sqlserver")>=0||dbType.indexOf("sql server")>=0) {
                DB_TYPE = DataBaseConstant.DB_TYPE_SQLSERVER;
            }else if(dbType.indexOf("postgresql")>=0) {
                DB_TYPE = DataBaseConstant.DB_TYPE_POSTGRESQL;
            }else {
                throw new JeecgBootException("数据库类型:["+dbType+"]不识别!");
            }
        } catch (Exception e) {
            log.error(e.getMessage(), e);
        }finally {
            connection.close();
        }
    }
    return DB_TYPE;

}
 
Example #8
Source File: SysBaseApiImpl.java    From jeecg-boot with Apache License 2.0 5 votes vote down vote up
/**
 * 获取数据库类型
 * @param dataSource
 * @return
 * @throws SQLException
 */
private String getDatabaseTypeByDataSource(DataSource dataSource) throws SQLException{
	if("".equals(DB_TYPE)) {
		Connection connection = dataSource.getConnection();
		try {
			DatabaseMetaData md = connection.getMetaData();
			String dbType = md.getDatabaseProductName().toLowerCase();
			if(dbType.indexOf("mysql")>=0) {
				DB_TYPE = DataBaseConstant.DB_TYPE_MYSQL;
			}else if(dbType.indexOf("oracle")>=0) {
				DB_TYPE = DataBaseConstant.DB_TYPE_ORACLE;
			}else if(dbType.indexOf("sqlserver")>=0||dbType.indexOf("sql server")>=0) {
				DB_TYPE = DataBaseConstant.DB_TYPE_SQLSERVER;
			}else if(dbType.indexOf("postgresql")>=0) {
				DB_TYPE = DataBaseConstant.DB_TYPE_POSTGRESQL;
			}else {
				throw new JeecgBootException("数据库类型:["+dbType+"]不识别!");
			}
		} catch (Exception e) {
			log.error(e.getMessage(), e);
		}finally {
			connection.close();
		}
	}
	return DB_TYPE;
	
}
 
Example #9
Source File: SysBaseApiImpl.java    From teaching with Apache License 2.0 5 votes vote down vote up
/**
 * 获取数据库类型
 * @param dataSource
 * @return
 * @throws SQLException
 */
private String getDatabaseTypeByDataSource(DataSource dataSource) throws SQLException{
	if("".equals(DB_TYPE)) {
		Connection connection = dataSource.getConnection();
		try {
			DatabaseMetaData md = connection.getMetaData();
			String dbType = md.getDatabaseProductName().toLowerCase();
			if(dbType.indexOf("mysql")>=0) {
				DB_TYPE = DataBaseConstant.DB_TYPE_MYSQL;
			}else if(dbType.indexOf("oracle")>=0) {
				DB_TYPE = DataBaseConstant.DB_TYPE_ORACLE;
			}else if(dbType.indexOf("sqlserver")>=0||dbType.indexOf("sql server")>=0) {
				DB_TYPE = DataBaseConstant.DB_TYPE_SQLSERVER;
			}else if(dbType.indexOf("postgresql")>=0) {
				DB_TYPE = DataBaseConstant.DB_TYPE_POSTGRESQL;
			}else {
				throw new JeecgBootException("数据库类型:["+dbType+"]不识别!");
			}
		} catch (Exception e) {
			log.error(e.getMessage(), e);
		}finally {
			connection.close();
		}
	}
	return DB_TYPE;
	
}
 
Example #10
Source File: QueryGenerator.java    From teaching with Apache License 2.0 5 votes vote down vote up
private static String getLikeConditionValue(Object value) {
	String str = value.toString().trim();
	if(str.startsWith("*") && str.endsWith("*")) {
		if(DataBaseConstant.DB_TYPE_SQLSERVER.equals(getDbType())){
			return "N'%"+str.substring(1,str.length()-1)+"%'";
		}else{
			return "'%"+str.substring(1,str.length()-1)+"%'";
		}
	}else if(str.startsWith("*")) {
		if(DataBaseConstant.DB_TYPE_SQLSERVER.equals(getDbType())){
			return "N'%"+str.substring(1)+"'";
		}else{
			return "'%"+str.substring(1)+"'";
		}
	}else if(str.endsWith("*")) {
		if(DataBaseConstant.DB_TYPE_SQLSERVER.equals(getDbType())){
			return "N'"+str.substring(0,str.length()-1)+"%'";
		}else{
			return "'"+str.substring(0,str.length()-1)+"%'";
		}
	}else {
		if(str.indexOf("%")>=0) {
			if(DataBaseConstant.DB_TYPE_SQLSERVER.equals(getDbType())){
				return "N"+str;
			}else{
				return str;
			}
		}else {
			if(DataBaseConstant.DB_TYPE_SQLSERVER.equals(getDbType())){
				return "N'%"+str+"%'";
			}else{
				return "'%"+str+"%'";
			}
		}
	}
}
 
Example #11
Source File: SysBaseApiImpl.java    From jeecg-boot-with-activiti with MIT License 5 votes vote down vote up
/**
 * 获取数据库类型
 * @param dataSource
 * @return
 * @throws SQLException
 */
private String getDatabaseTypeByDataSource(DataSource dataSource) throws SQLException{
	if("".equals(DB_TYPE)) {
		Connection connection = dataSource.getConnection();
		try {
			DatabaseMetaData md = connection.getMetaData();
			String dbType = md.getDatabaseProductName().toLowerCase();
			if(dbType.indexOf("mysql")>=0) {
				DB_TYPE = DataBaseConstant.DB_TYPE_MYSQL;
			}else if(dbType.indexOf("oracle")>=0) {
				DB_TYPE = DataBaseConstant.DB_TYPE_ORACLE;
			}else if(dbType.indexOf("sqlserver")>=0||dbType.indexOf("sql server")>=0) {
				DB_TYPE = DataBaseConstant.DB_TYPE_SQLSERVER;
			}else if(dbType.indexOf("postgresql")>=0) {
				DB_TYPE = DataBaseConstant.DB_TYPE_POSTGRESQL;
			}else {
				throw new JeecgBootException("数据库类型:["+dbType+"]不识别!");
			}
		} catch (Exception e) {
			log.error(e.getMessage(), e);
		}finally {
			connection.close();
		}
	}
	return DB_TYPE;
	
}
 
Example #12
Source File: SysBaseApiImpl.java    From jeecg-cloud with Apache License 2.0 5 votes vote down vote up
/**
 * 获取数据库类型
 * @param dataSource
 * @return
 * @throws SQLException
 */
private String getDatabaseTypeByDataSource(DataSource dataSource) throws SQLException{
	if("".equals(DB_TYPE)) {
		Connection connection = dataSource.getConnection();
		try {
			DatabaseMetaData md = connection.getMetaData();
			String dbType = md.getDatabaseProductName().toLowerCase();
			if(dbType.indexOf("mysql")>=0) {
				DB_TYPE = DataBaseConstant.DB_TYPE_MYSQL;
			}else if(dbType.indexOf("oracle")>=0) {
				DB_TYPE = DataBaseConstant.DB_TYPE_ORACLE;
			}else if(dbType.indexOf("sqlserver")>=0||dbType.indexOf("sql server")>=0) {
				DB_TYPE = DataBaseConstant.DB_TYPE_SQLSERVER;
			}else if(dbType.indexOf("postgresql")>=0) {
				DB_TYPE = DataBaseConstant.DB_TYPE_POSTGRESQL;
			}else {
				throw new JeecgBootException("数据库类型:["+dbType+"]不识别!");
			}
		} catch (Exception e) {
			log.error(e.getMessage(), e);
		}finally {
			connection.close();
		}
	}
	return DB_TYPE;
	
}
 
Example #13
Source File: SqlUtils.java    From jeecg-cloud with Apache License 2.0 4 votes vote down vote up
public static boolean dbTypeIsSQLServer(String dbType) {
    return dbTypeIf(dbType, DATABSE_TYPE_SQLSERVER, DataBaseConstant.DB_TYPE_SQLSERVER_NUM);
}
 
Example #14
Source File: JwtUtil.java    From jeecg-boot with Apache License 2.0 4 votes vote down vote up
/**
  * 从当前用户中获取变量
 * @param key
 * @param user
 * @return
 */
//TODO 急待改造 sckjkdsjsfjdk
public static String getUserSystemData(String key,SysUserCacheInfo user) {
	if(user==null) {
		user = JeecgDataAutorUtils.loadUserInfo();
	}
	//#{sys_user_code}%
	
	// 获取登录用户信息
	LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
	
	String moshi = "";
	if(key.indexOf("}")!=-1){
		 moshi = key.substring(key.indexOf("}")+1);
	}
	String returnValue = null;
	//针对特殊标示处理#{sysOrgCode},判断替换
	if (key.contains("#{")) {
		key = key.substring(2,key.indexOf("}"));
	} else {
		key = key;
	}
	//替换为系统登录用户帐号
	if (key.equals(DataBaseConstant.SYS_USER_CODE)|| key.toLowerCase().equals(DataBaseConstant.SYS_USER_CODE_TABLE)) {
		if(user==null) {
			returnValue = sysUser.getUsername();
		}else {
			returnValue = user.getSysUserCode();
		}
	}
	//替换为系统登录用户真实名字
	else if (key.equals(DataBaseConstant.SYS_USER_NAME)|| key.toLowerCase().equals(DataBaseConstant.SYS_USER_NAME_TABLE)) {
		if(user==null) {
			returnValue = sysUser.getRealname();
		}else {
			returnValue = user.getSysUserName();
		}
	}
	
	//替换为系统用户登录所使用的机构编码
	else if (key.equals(DataBaseConstant.SYS_ORG_CODE)|| key.toLowerCase().equals(DataBaseConstant.SYS_ORG_CODE_TABLE)) {
		if(user==null) {
			returnValue = sysUser.getOrgCode();
		}else {
			returnValue = user.getSysOrgCode();
		}
	}
	//替换为系统用户所拥有的所有机构编码
	else if (key.equals(DataBaseConstant.SYS_MULTI_ORG_CODE)|| key.toLowerCase().equals(DataBaseConstant.SYS_MULTI_ORG_CODE_TABLE)) {
		if(user.isOneDepart()) {
			returnValue = user.getSysMultiOrgCode().get(0);
		}else {
			returnValue = Joiner.on(",").join(user.getSysMultiOrgCode());
		}
	}
	//替换为当前系统时间(年月日)
	else if (key.equals(DataBaseConstant.SYS_DATE)|| key.toLowerCase().equals(DataBaseConstant.SYS_DATE_TABLE)) {
		returnValue = user.getSysDate();
	}
	//替换为当前系统时间(年月日时分秒)
	else if (key.equals(DataBaseConstant.SYS_TIME)|| key.toLowerCase().equals(DataBaseConstant.SYS_TIME_TABLE)) {
		returnValue = user.getSysTime();
	}
	//流程状态默认值(默认未发起)
	else if (key.equals(DataBaseConstant.BPM_STATUS)|| key.toLowerCase().equals(DataBaseConstant.BPM_STATUS_TABLE)) {
		returnValue = "1";
	}
	if(returnValue!=null){returnValue = returnValue + moshi;}
	return returnValue;
}
 
Example #15
Source File: QueryGenerator.java    From jeecg-boot with Apache License 2.0 4 votes vote down vote up
private static String getLikeConditionValue(Object value) {
	String str = value.toString().trim();
	if(str.startsWith("*") && str.endsWith("*")) {
		if(DataBaseConstant.DB_TYPE_SQLSERVER.equals(getDbType())){
			return "N'%"+str.substring(1,str.length()-1)+"%'";
		}else{
			return "'%"+str.substring(1,str.length()-1)+"%'";
		}
	}else if(str.startsWith("*")) {
		if(DataBaseConstant.DB_TYPE_SQLSERVER.equals(getDbType())){
			return "N'%"+str.substring(1)+"'";
		}else{
			return "'%"+str.substring(1)+"'";
		}
	}else if(str.endsWith("*")) {
		if(DataBaseConstant.DB_TYPE_SQLSERVER.equals(getDbType())){
			return "N'"+str.substring(0,str.length()-1)+"%'";
		}else{
			return "'"+str.substring(0,str.length()-1)+"%'";
		}
	}else {
		if(str.indexOf("%")>=0) {
			if(DataBaseConstant.DB_TYPE_SQLSERVER.equals(getDbType())){
				if(str.startsWith("'") && str.endsWith("'")){
					return "N"+str;
				}else{
					return "N"+"'"+str+"'";
				}
			}else{
				if(str.startsWith("'") && str.endsWith("'")){
					return str;
				}else{
					return "'"+str+"'";
				}
			}
		}else {
			if(DataBaseConstant.DB_TYPE_SQLSERVER.equals(getDbType())){
				return "N'%"+str+"%'";
			}else{
				return "'%"+str+"%'";
			}
		}
	}
}
 
Example #16
Source File: SqlUtils.java    From jeecg-cloud with Apache License 2.0 4 votes vote down vote up
public static boolean dbTypeIsMySQL(String dbType) {
    return dbTypeIf(dbType, DATABSE_TYPE_MYSQL, DataBaseConstant.DB_TYPE_MYSQL_NUM);
}
 
Example #17
Source File: SqlUtils.java    From jeecg-cloud with Apache License 2.0 4 votes vote down vote up
public static boolean dbTypeIsOracle(String dbType) {
    return dbTypeIf(dbType, DATABSE_TYPE_ORACLE, DataBaseConstant.DB_TYPE_ORACLE_NUM);
}
 
Example #18
Source File: SqlUtils.java    From jeecg-boot with Apache License 2.0 4 votes vote down vote up
public static boolean dbTypeIsPostgre(String dbType) {
    return dbTypeIf(dbType, DATABSE_TYPE_POSTGRE, DataBaseConstant.DB_TYPE_POSTGRESQL_NUM);
}
 
Example #19
Source File: SqlUtils.java    From jeecg-boot with Apache License 2.0 4 votes vote down vote up
public static boolean dbTypeIsSQLServer(String dbType) {
    return dbTypeIf(dbType, DATABSE_TYPE_SQLSERVER, DataBaseConstant.DB_TYPE_SQLSERVER_NUM);
}
 
Example #20
Source File: SqlUtils.java    From jeecg-boot with Apache License 2.0 4 votes vote down vote up
public static boolean dbTypeIsOracle(String dbType) {
    return dbTypeIf(dbType, DATABSE_TYPE_ORACLE, DataBaseConstant.DB_TYPE_ORACLE_NUM);
}
 
Example #21
Source File: SqlUtils.java    From jeecg-boot with Apache License 2.0 4 votes vote down vote up
public static boolean dbTypeIsMySQL(String dbType) {
    return dbTypeIf(dbType, DATABSE_TYPE_MYSQL, DataBaseConstant.DB_TYPE_MYSQL_NUM);
}
 
Example #22
Source File: JwtUtil.java    From jeecg-boot-with-activiti with MIT License 4 votes vote down vote up
/**
  * 从当前用户中获取变量
 * @param key
 * @param user
 * @return
 */
//TODO 急待改造 sckjkdsjsfjdk
public static String getUserSystemData(String key,SysUserCacheInfo user) {
	if(user==null) {
		user = JeecgDataAutorUtils.loadUserInfo();
	}
	//#{sys_user_code}%
	
	// 获取登录用户信息
	LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
	
	String moshi = "";
	if(key.indexOf("}")!=-1){
		 moshi = key.substring(key.indexOf("}")+1);
	}
	String returnValue = null;
	//针对特殊标示处理#{sysOrgCode},判断替换
	if (key.contains("#{")) {
		key = key.substring(2,key.indexOf("}"));
	} else {
		key = key;
	}
	//替换为系统登录用户帐号
	if (key.equals(DataBaseConstant.SYS_USER_CODE)|| key.equals(DataBaseConstant.SYS_USER_CODE_TABLE)) {
		if(user==null) {
			returnValue = sysUser.getUsername();
		}else {
			returnValue = user.getSysUserCode();
		}
	}
	//替换为系统登录用户真实名字
	else if (key.equals(DataBaseConstant.SYS_USER_NAME)|| key.equals(DataBaseConstant.SYS_USER_NAME_TABLE)) {
		if(user==null) {
			returnValue = sysUser.getRealname();
		}else {
			returnValue = user.getSysUserName();
		}
	}
	
	//替换为系统用户登录所使用的机构编码
	else if (key.equals(DataBaseConstant.SYS_ORG_CODE)|| key.equals(DataBaseConstant.SYS_ORG_CODE_TABLE)) {
		if(user==null) {
			returnValue = sysUser.getOrgCode();
		}else {
			returnValue = user.getSysOrgCode();
		}
	}
	//替换为系统用户所拥有的所有机构编码
	else if (key.equals(DataBaseConstant.SYS_MULTI_ORG_CODE)|| key.equals(DataBaseConstant.SYS_MULTI_ORG_CODE_TABLE)) {
		if(user.isOneDepart()) {
			returnValue = user.getSysMultiOrgCode().get(0);
		}else {
			returnValue = Joiner.on(",").join(user.getSysMultiOrgCode());
		}
	}
	//替换为当前系统时间(年月日)
	else if (key.equals(DataBaseConstant.SYS_DATE)|| key.equals(DataBaseConstant.SYS_DATE_TABLE)) {
		returnValue = user.getSysDate();
	}
	//替换为当前系统时间(年月日时分秒)
	else if (key.equals(DataBaseConstant.SYS_TIME)|| key.equals(DataBaseConstant.SYS_TIME_TABLE)) {
		returnValue = user.getSysTime();
	}
	//流程状态默认值(默认未发起)
	else if (key.equals(DataBaseConstant.BPM_STATUS)|| key.equals(DataBaseConstant.BPM_STATUS_TABLE)) {
		returnValue = "1";
	}
	if(returnValue!=null){returnValue = returnValue + moshi;}
	return returnValue;
}
 
Example #23
Source File: JwtUtil.java    From teaching with Apache License 2.0 4 votes vote down vote up
/**
  * 从当前用户中获取变量
 * @param key
 * @param user
 * @return
 */
//TODO 急待改造 sckjkdsjsfjdk
public static String getUserSystemData(String key,SysUserCacheInfo user) {
	if(user==null) {
		user = JeecgDataAutorUtils.loadUserInfo();
	}
	//#{sys_user_code}%
	
	// 获取登录用户信息
	LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
	
	String moshi = "";
	if(key.indexOf("}")!=-1){
		 moshi = key.substring(key.indexOf("}")+1);
	}
	String returnValue = null;
	//针对特殊标示处理#{sysOrgCode},判断替换
	if (key.contains("#{")) {
		key = key.substring(2,key.indexOf("}"));
	} else {
		key = key;
	}
	//替换为系统登录用户帐号
	if (key.equals(DataBaseConstant.SYS_USER_CODE)|| key.equals(DataBaseConstant.SYS_USER_CODE_TABLE)) {
		if(user==null) {
			returnValue = sysUser.getUsername();
		}else {
			returnValue = user.getSysUserCode();
		}
	}
	//替换为系统登录用户真实名字
	else if (key.equals(DataBaseConstant.SYS_USER_NAME)|| key.equals(DataBaseConstant.SYS_USER_NAME_TABLE)) {
		if(user==null) {
			returnValue = sysUser.getRealname();
		}else {
			returnValue = user.getSysUserName();
		}
	}
	
	//替换为系统用户登录所使用的机构编码
	else if (key.equals(DataBaseConstant.SYS_ORG_CODE)|| key.equals(DataBaseConstant.SYS_ORG_CODE_TABLE)) {
		if(user==null) {
			returnValue = sysUser.getOrgCode();
		}else {
			returnValue = user.getSysOrgCode();
		}
	}
	//替换为系统用户所拥有的所有机构编码
	else if (key.equals(DataBaseConstant.SYS_MULTI_ORG_CODE)|| key.equals(DataBaseConstant.SYS_MULTI_ORG_CODE_TABLE)) {
		if(user.isOneDepart()) {
			returnValue = user.getSysMultiOrgCode().get(0);
		}else {
			returnValue = Joiner.on(",").join(user.getSysMultiOrgCode());
		}
	}
	//替换为当前系统时间(年月日)
	else if (key.equals(DataBaseConstant.SYS_DATE)|| key.equals(DataBaseConstant.SYS_DATE_TABLE)) {
		returnValue = user.getSysDate();
	}
	//替换为当前系统时间(年月日时分秒)
	else if (key.equals(DataBaseConstant.SYS_TIME)|| key.equals(DataBaseConstant.SYS_TIME_TABLE)) {
		returnValue = user.getSysTime();
	}
	//流程状态默认值(默认未发起)
	else if (key.equals(DataBaseConstant.BPM_STATUS)|| key.equals(DataBaseConstant.BPM_STATUS_TABLE)) {
		returnValue = "1";
	}
	if(returnValue!=null){returnValue = returnValue + moshi;}
	return returnValue;
}
 
Example #24
Source File: SqlUtils.java    From jeecg-cloud with Apache License 2.0 4 votes vote down vote up
public static boolean dbTypeIsPostgre(String dbType) {
    return dbTypeIf(dbType, DATABSE_TYPE_POSTGRE, DataBaseConstant.DB_TYPE_POSTGRESQL_NUM);
}
 
Example #25
Source File: QueryGenerator.java    From jeecg-cloud with Apache License 2.0 4 votes vote down vote up
private static String getLikeConditionValue(Object value) {
	String str = value.toString().trim();
	if(str.startsWith("*") && str.endsWith("*")) {
		if(DataBaseConstant.DB_TYPE_SQLSERVER.equals(CommonUtils.getDatabaseType())){
			return "N'%"+str.substring(1,str.length()-1)+"%'";
		}else{
			return "'%"+str.substring(1,str.length()-1)+"%'";
		}
	}else if(str.startsWith("*")) {
		if(DataBaseConstant.DB_TYPE_SQLSERVER.equals(CommonUtils.getDatabaseType())){
			return "N'%"+str.substring(1)+"'";
		}else{
			return "'%"+str.substring(1)+"'";
		}
	}else if(str.endsWith("*")) {
		if(DataBaseConstant.DB_TYPE_SQLSERVER.equals(CommonUtils.getDatabaseType())){
			return "N'"+str.substring(0,str.length()-1)+"%'";
		}else{
			return "'"+str.substring(0,str.length()-1)+"%'";
		}
	}else {
		if(str.indexOf("%")>=0) {
			if(DataBaseConstant.DB_TYPE_SQLSERVER.equals(CommonUtils.getDatabaseType())){
				if(str.startsWith("'") && str.endsWith("'")){
					return "N"+str;
				}else{
					return "N"+"'"+str+"'";
				}
			}else{
				if(str.startsWith("'") && str.endsWith("'")){
					return str;
				}else{
					return "'"+str+"'";
				}
			}
		}else {
			if(DataBaseConstant.DB_TYPE_SQLSERVER.equals(CommonUtils.getDatabaseType())){
				return "N'%"+str+"%'";
			}else{
				return "'%"+str+"%'";
			}
		}
	}
}
 
Example #26
Source File: JwtUtil.java    From jeecg-cloud with Apache License 2.0 4 votes vote down vote up
/**
  * 从当前用户中获取变量
 * @param key
 * @param user
 * @return
 */
//TODO 急待改造 sckjkdsjsfjdk
public static String getUserSystemData(String key,SysUserCacheInfo user) {
	if(user==null) {
		user = JeecgDataAutorUtils.loadUserInfo();
	}
	//#{sys_user_code}%
	// 获取登录用户信息
	LoginUser sysUser = JwtUtil.getLoginUser();
	
	String moshi = "";
	if(key.indexOf("}")!=-1){
		 moshi = key.substring(key.indexOf("}")+1);
	}
	String returnValue = null;
	//针对特殊标示处理#{sysOrgCode},判断替换
	if (key.contains("#{")) {
		key = key.substring(2,key.indexOf("}"));
	} else {
		key = key;
	}
	//替换为系统登录用户帐号
	if (key.equals(DataBaseConstant.SYS_USER_CODE)|| key.toLowerCase().equals(DataBaseConstant.SYS_USER_CODE_TABLE)) {
		if(user==null) {
			returnValue = sysUser.getUsername();
		}else {
			returnValue = user.getSysUserCode();
		}
	}
	//替换为系统登录用户真实名字
	else if (key.equals(DataBaseConstant.SYS_USER_NAME)|| key.toLowerCase().equals(DataBaseConstant.SYS_USER_NAME_TABLE)) {
		if(user==null) {
			returnValue = sysUser.getRealname();
		}else {
			returnValue = user.getSysUserName();
		}
	}
	
	//替换为系统用户登录所使用的机构编码
	else if (key.equals(DataBaseConstant.SYS_ORG_CODE)|| key.toLowerCase().equals(DataBaseConstant.SYS_ORG_CODE_TABLE)) {
		if(user==null) {
			returnValue = sysUser.getOrgCode();
		}else {
			returnValue = user.getSysOrgCode();
		}
	}
	//替换为系统用户所拥有的所有机构编码
	else if (key.equals(DataBaseConstant.SYS_MULTI_ORG_CODE)|| key.toLowerCase().equals(DataBaseConstant.SYS_MULTI_ORG_CODE_TABLE)) {
		if(user.isOneDepart()) {
			returnValue = user.getSysMultiOrgCode().get(0);
		}else {
			returnValue = Joiner.on(",").join(user.getSysMultiOrgCode());
		}
	}
	//替换为当前系统时间(年月日)
	else if (key.equals(DataBaseConstant.SYS_DATE)|| key.toLowerCase().equals(DataBaseConstant.SYS_DATE_TABLE)) {
		returnValue = user.getSysDate();
	}
	//替换为当前系统时间(年月日时分秒)
	else if (key.equals(DataBaseConstant.SYS_TIME)|| key.toLowerCase().equals(DataBaseConstant.SYS_TIME_TABLE)) {
		returnValue = user.getSysTime();
	}
	//流程状态默认值(默认未发起)
	else if (key.equals(DataBaseConstant.BPM_STATUS)|| key.toLowerCase().equals(DataBaseConstant.BPM_STATUS_TABLE)) {
		returnValue = "1";
	}
	if(returnValue!=null){returnValue = returnValue + moshi;}
	return returnValue;
}
 
Example #27
Source File: SqlUtils.java    From teaching with Apache License 2.0 4 votes vote down vote up
public static boolean dbTypeIsPostgre(String dbType) {
    return dbTypeIf(dbType, DATABSE_TYPE_POSTGRE, DataBaseConstant.DB_TYPE_POSTGRESQL_NUM);
}
 
Example #28
Source File: SqlUtils.java    From teaching with Apache License 2.0 4 votes vote down vote up
public static boolean dbTypeIsSQLServer(String dbType) {
    return dbTypeIf(dbType, DATABSE_TYPE_SQLSERVER, DataBaseConstant.DB_TYPE_SQLSERVER_NUM);
}
 
Example #29
Source File: SqlUtils.java    From teaching with Apache License 2.0 4 votes vote down vote up
public static boolean dbTypeIsOracle(String dbType) {
    return dbTypeIf(dbType, DATABSE_TYPE_ORACLE, DataBaseConstant.DB_TYPE_ORACLE_NUM);
}
 
Example #30
Source File: SqlUtils.java    From teaching with Apache License 2.0 4 votes vote down vote up
public static boolean dbTypeIsMySQL(String dbType) {
    return dbTypeIf(dbType, DATABSE_TYPE_MYSQL, DataBaseConstant.DB_TYPE_MYSQL_NUM);
}