stringutils类_emptystring

stringutils类_emptystring本文整理匯總了Java中com.baomidou.mybatisplus.toolkit.StringUtils.isNotEmpty方法的典型用法代碼示例。如果您正苦於以下問題:JavaStringUtils.isNotEmpty方法的具體用法?JavaStringUtils.isNotEmpty怎麽用?JavaStringUtils.isNotEmpty使用的例子?那麽恭喜您,這裏精選…

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE稳定放心使用

本文整理匯總了Java中com.baomidou.mybatisplus.toolkit.StringUtils.isNotEmpty方法的典型用法代碼示例。如果您正苦於以下問題:Java StringUtils.isNotEmpty方法的具體用法?Java StringUtils.isNotEmpty怎麽用?Java StringUtils.isNotEmpty使用的例子?那麽恭喜您, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.baomidou.mybatisplus.toolkit.StringUtils的用法示例。

在下文中一共展示了StringUtils.isNotEmpty方法的38個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於我們的係統推薦出更棒的Java代碼示例。

示例1: getiDialect

​點讚 3

import com.baomidou.mybatisplus.toolkit.StringUtils; //導入方法依賴的package包/類

/**

*

* 獲取數據庫方言

*

*

* @param dbType 數據庫類型

* @param dialectClazz 自定義方言實現類

* @return

* @throws Exception

*/

private static IDialect getiDialect(DBType dbType, String dialectClazz) throws Exception {

IDialect dialect = null;

if (Objects.nonNull(dbType)) {

dialect = getDialectByDbtype(dbType);

} else {

if (StringUtils.isNotEmpty(dialectClazz)) {

try {

Class> clazz = Class.forName(dialectClazz);

if (IDialect.class.isAssignableFrom(clazz)) {

dialect = (IDialect) clazz.newInstance();

}

} catch (ClassNotFoundException e) {

throw new MybatisPlusException(“Class :” + dialectClazz + ” is not found”);

}

}

}

/* 未配置方言則拋出異常 */

if (dialect == null) {

throw new MybatisPlusException(“The value of the dialect property in mybatis configuration.xml is not defined.”);

}

return dialect;

}

開發者ID:Caratacus,項目名稱:mybatis-plus-mini,代碼行數:33,

示例2: sqlWhere

​點讚 3

import com.baomidou.mybatisplus.toolkit.StringUtils; //導入方法依賴的package包/類

/**

*

* SQL 查詢條件

*

*/

protected String sqlWhere(TableInfo table) {

StringBuilder where = new StringBuilder();

where.append(“\n”);

if (StringUtils.isNotEmpty(table.getKeyProperty())) {

where.append(“\n\n”);

where.append(table.getKeyColumn()).append(“=#{ew.”).append(table.getKeyProperty()).append(“}”);

where.append(“\n”);

}

List fieldList = table.getFieldList();

for (TableFieldInfo fieldInfo : fieldList) {

where.append(convertIfTag(fieldInfo, “ew.”, false));

where.append(” AND “).append(fieldInfo.getColumn()).append(“=#{ew.”).append(fieldInfo.getEl()).append(“}”);

where.append(convertIfTag(fieldInfo, true));

}

where.append(“\n”);

return where.toString();

}

開發者ID:Caratacus,項目名稱:mybatis-plus-mini,代碼行數:23,

示例3: insertOrUpdate

​點讚 3

import com.baomidou.mybatisplus.toolkit.StringUtils; //導入方法依賴的package包/類

/**

*

* TableId 注解存在更新記錄,否插入一條記錄

*

*

* @param entity 實體對象

* @return boolean

*/

@Transactional

public boolean insertOrUpdate(T entity) {

if (null != entity) {

Class> cls = entity.getClass();

TableInfo tableInfo = TableInfoHelper.getTableInfo(cls);

if (null != tableInfo && StringUtils.isNotEmpty(tableInfo.getKeyProperty())) {

Object idVal = ReflectionKit.getMethodValue(cls, entity, tableInfo.getKeyProperty());

if (StringUtils.checkValNull(idVal)) {

return insert(entity);

} else {

/*

* 更新成功直接返回,失敗執行插入邏輯

*/

return updateById(entity) || insert(entity);

}

} else {

throw new MybatisPlusException(“Error: Can not execute. Could not find @TableId.”);

}

}

return false;

}

開發者ID:Caratacus,項目名稱:mybatis-plus-mini,代碼行數:30,

示例4: inExpression

​點讚 3

import com.baomidou.mybatisplus.toolkit.StringUtils; //導入方法依賴的package包/類

/**

* 獲取in表達式

*

* @param column 字段名稱

* @param value 集合List

* @param isNot 是否為NOT IN操作

*/

private String inExpression(String column, Collection> value, boolean isNot) {

if (StringUtils.isNotEmpty(column) && CollectionUtils.isNotEmpty(value)) {

StringBuilder inSql = new StringBuilder();

inSql.append(column);

if (isNot) {

inSql.append(” NOT”);

}

inSql.append(” IN “);

inSql.append(“(“);

int size = value.size();

for (int i = 0; i < size; i++) {

inSql.append(String.format(PLACE_HOLDER, i));

if (i + 1 < size) {

inSql.append(“,”);

}

}

inSql.append(“)”);

return inSql.toString();

}

return null;

}

開發者ID:Caratacus,項目名稱:mybatis-plus-mini,代碼行數:29,

示例5: sqlWhereEntityWrapper

​點讚 3

import com.baomidou.mybatisplus.toolkit.StringUtils; //導入方法依賴的package包/類

/**

*

* EntityWrapper方式獲取select where

*

*

* @param table 表信息

* @return String

*/

protected String sqlWhereEntityWrapper(TableInfo table) {

StringBuilder where = new StringBuilder(128);

where.append(“\n”);

where.append(“\n”);

where.append(“\n”);

if (StringUtils.isNotEmpty(table.getKeyProperty())) {

where.append(“\n\n”);

where.append(table.getKeyColumn()).append(“=#{ew.entity.”).append(table.getKeyProperty()).append(“}”);

where.append(“\n”);

}

List fieldList = table.getFieldList();

for (TableFieldInfo fieldInfo : fieldList) {

where.append(convertIfTag(fieldInfo, “ew.entity.”, false));

where.append(” AND “).append(this.sqlCondition(fieldInfo.getCondition(),

fieldInfo.getColumn(), “ew.entity.” + fieldInfo.getEl()));

where.append(convertIfTag(fieldInfo, true));

}

where.append(“\n”);

where.append(“\n\n${ew.sqlSegment}\n”);

where.append(“\n”);

where.append(“\n”);

where.append(“\n\n${ew.sqlSegment}\n”);

return where.toString();

}

開發者ID:baomidou,項目名稱:mybatis-plus,代碼行數:33,

示例6: setProperties

​點讚 3

import com.baomidou.mybatisplus.toolkit.StringUtils; //導入方法依賴的package包/類

@Override

public void setProperties(Properties prop) {

String dialectType = prop.getProperty(“dialectType”);

String dialectClazz = prop.getProperty(“dialectClazz”);

String localPage = prop.getProperty(“localPage”);

if (StringUtils.isNotEmpty(dialectType)) {

this.dialectType = dialectType;

}

if (StringUtils.isNotEmpty(dialectClazz)) {

this.dialectClazz = dialectClazz;

}

if (StringUtils.isNotEmpty(localPage)) {

this.localPage = Boolean.valueOf(localPage);

}

}

開發者ID:baomidou,項目名稱:mybatis-plus,代碼行數:17,

示例7: getDialect

​點讚 3

import com.baomidou.mybatisplus.toolkit.StringUtils; //導入方法依賴的package包/類

/**

*

* 獲取數據庫方言

*

*

* @param dbType 數據庫類型

* @param dialectClazz 自定義方言實現類

* @return

* @throws Exception

*/

private static IDialect getDialect(DBType dbType, String dialectClazz) throws Exception {

IDialect dialect = null;

if (StringUtils.isNotEmpty(dialectClazz)) {

try {

Class> clazz = Class.forName(dialectClazz);

if (IDialect.class.isAssignableFrom(clazz)) {

dialect = (IDialect) clazz.newInstance();

}

} catch (ClassNotFoundException e) {

throw new MybatisPlusException(“Class :” + dialectClazz + ” is not found”);

}

} else if (null != dbType) {

dialect = getDialectByDbtype(dbType);

}

/* 未配置方言則拋出異常 */

if (dialect == null) {

throw new MybatisPlusException(“The value of the dialect property in mybatis configuration.xml is not defined.”);

}

return dialect;

}

開發者ID:baomidou,項目名稱:mybatis-plus,代碼行數:31,

示例8: sqlWhere

​點讚 3

import com.baomidou.mybatisplus.toolkit.StringUtils; //導入方法依賴的package包/類

/**

*

* SQL 查詢條件

*

*/

protected String sqlWhere(TableInfo table) {

StringBuilder where = new StringBuilder();

where.append(“\n”);

if (StringUtils.isNotEmpty(table.getKeyProperty())) {

where.append(“\n\n”);

where.append(table.getKeyColumn()).append(“=#{ew.”).append(table.getKeyProperty()).append(“}”);

where.append(“\n”);

}

List fieldList = table.getFieldList();

for (TableFieldInfo fieldInfo : fieldList) {

where.append(convertIfTag(fieldInfo, “ew.”, false));

where.append(” AND “).append(this.sqlCondition(fieldInfo.getCondition(),

fieldInfo.getColumn(), “ew.” + fieldInfo.getEl()));

where.append(convertIfTag(fieldInfo, true));

}

where.append(“\n”);

return where.toString();

}

開發者ID:baomidou,項目名稱:mybatis-plus,代碼行數:24,

示例9: insertOrUpdate

​點讚 3

import com.baomidou.mybatisplus.toolkit.StringUtils; //導入方法依賴的package包/類

/**

*

* TableId 注解存在更新記錄,否插入一條記錄

*

*

* @param entity 實體對象

* @return boolean

*/

@Transactional(rollbackFor = Exception.class)

@Override

public boolean insertOrUpdate(T entity) {

if (null != entity) {

Class> cls = entity.getClass();

TableInfo tableInfo = TableInfoHelper.getTableInfo(cls);

if (null != tableInfo && StringUtils.isNotEmpty(tableInfo.getKeyProperty())) {

Object idVal = ReflectionKit.getMethodValue(cls, entity, tableInfo.getKeyProperty());

if (StringUtils.checkValNull(idVal)) {

return insert(entity);

} else {

/*

* 更新成功直接返回,失敗執行插入邏輯

*/

return updateById(entity) || insert(entity);

}

} else {

throw new MybatisPlusException(“Error: Can not execute. Could not find @TableId.”);

}

}

return false;

}

開發者ID:baomidou,項目名稱:mybatis-plus,代碼行數:31,

示例10: insertOrUpdateAllColumn

​點讚 3

import com.baomidou.mybatisplus.toolkit.StringUtils; //導入方法依賴的package包/類

@Transactional(rollbackFor = Exception.class)

@Override

public boolean insertOrUpdateAllColumn(T entity) {

if (null != entity) {

Class> cls = entity.getClass();

TableInfo tableInfo = TableInfoHelper.getTableInfo(cls);

if (null != tableInfo && StringUtils.isNotEmpty(tableInfo.getKeyProperty())) {

Object idVal = ReflectionKit.getMethodValue(cls, entity, tableInfo.getKeyProperty());

if (StringUtils.checkValNull(idVal)) {

return insertAllColumn(entity);

} else {

/*

* 更新成功直接返回,失敗執行插入邏輯

*/

return updateAllColumnById(entity) || insertAllColumn(entity);

}

} else {

throw new MybatisPlusException(“Error: Can not execute. Could not find @TableId.”);

}

}

return false;

}

開發者ID:baomidou,項目名稱:mybatis-plus,代碼行數:23,

示例11: convertGlobalConfiguration

​點讚 2

import com.baomidou.mybatisplus.toolkit.StringUtils; //導入方法依賴的package包/類

public GlobalConfiguration convertGlobalConfiguration() throws ClassNotFoundException, IllegalAccessException, InstantiationException {

GlobalConfiguration globalConfiguration = new GlobalConfiguration();

if (StringUtils.isNotEmpty(this.getIdentifierQuote())) {

globalConfiguration.setIdentifierQuote(this.getIdentifierQuote());

}

if (StringUtils.isNotEmpty(this.getLogicDeleteValue())) {

globalConfiguration.setLogicDeleteValue(this.getLogicDeleteValue());

}

if (StringUtils.isNotEmpty(this.getLogicNotDeleteValue())) {

globalConfiguration.setLogicNotDeleteValue(this.getLogicNotDeleteValue());

}

if (StringUtils.isNotEmpty(this.getSqlInjector())) {

globalConfiguration.setSqlInjector((ISqlInjector) Class.forName(this.getSqlInjector()).newInstance());

}

if (StringUtils.isNotEmpty(this.getMetaObjectHandler())) {

globalConfiguration.setMetaObjectHandler((MetaObjectHandler) Class.forName(this.getMetaObjectHandler()).newInstance());

}

if (StringUtils.isNotEmpty(this.getKeyGenerator())) {

globalConfiguration.setKeyGenerator((IKeyGenerator) Class.forName(this.getKeyGenerator()).newInstance());

}

if (StringUtils.checkValNotNull(this.getIdType())) {

globalConfiguration.setIdType(this.getIdType());

}

if (StringUtils.checkValNotNull(this.getDbColumnUnderline())) {

globalConfiguration.setDbColumnUnderline(this.getDbColumnUnderline());

}

if (StringUtils.checkValNotNull(this.getFieldStrategy())) {

globalConfiguration.setFieldStrategy(this.getFieldStrategy());

}

if (StringUtils.checkValNotNull(this.getRefreshMapper())) {

globalConfiguration.setRefresh(this.getRefreshMapper());

}

if (StringUtils.checkValNotNull(this.getCapitalMode())) {

globalConfiguration.setCapitalMode(this.getCapitalMode());

}

return globalConfiguration;

}

開發者ID:baomidou,項目名稱:mybatisplus-boot-starter,代碼行數:38,

示例12: getAs

​點讚 2

import com.baomidou.mybatisplus.toolkit.StringUtils; //導入方法依賴的package包/類

public String getAs() {

if (StringUtils.isEmpty(getColumn()) || StringUtils.isEmpty(as)) {

return StringUtils.EMPTY;

}

String quote = null;

if (isEscape() && FACTORY != null) {

GlobalConfiguration globalConfig = GlobalConfigUtils.getGlobalConfig(FACTORY.getConfiguration());

quote = globalConfig.getIdentifierQuote() == null ? DBType.getQuote(globalConfig.getDbType()) : globalConfig.getIdentifierQuote();

}

return AS + (StringUtils.isNotEmpty(quote) ? String.format(quote, as) : as);

}

開發者ID:Caratacus,項目名稱:mybatis-plus-mini,代碼行數:12,

示例13: sqlSelectObjsColumns

​點讚 2

import com.baomidou.mybatisplus.toolkit.StringUtils; //導入方法依賴的package包/類

/**

*

* SQL 設置selectObj sqlselect

*

*

* @param table 是否為包裝類型查詢

* @return

*/

protected String sqlSelectObjsColumns(TableInfo table) {

StringBuilder columns = new StringBuilder();

/*

* 普通查詢

*/

columns.append(“${ew.sqlSelect}”);

// 主鍵處理

if (StringUtils.isNotEmpty(table.getKeyProperty())) {

if (table.isKeyRelated()) {

columns.append(table.getKeyColumn()).append(” AS “).append(sqlWordConvert(table.getKeyProperty()));

} else {

columns.append(sqlWordConvert(table.getKeyProperty()));

}

} else {

// 表字段處理

List fieldList = table.getFieldList();

if (CollectionUtils.isNotEmpty(fieldList)) {

TableFieldInfo fieldInfo = fieldList.get(0);

// 匹配轉換內容

String wordConvert = sqlWordConvert(fieldInfo.getProperty());

if (fieldInfo.getColumn().equals(wordConvert)) {

columns.append(wordConvert);

} else {

// 字段屬性不一致

columns.append(fieldInfo.getColumn());

columns.append(” AS “).append(wordConvert);

}

}

}

columns.append(“”);

return columns.toString();

}

開發者ID:Caratacus,項目名稱:mybatis-plus-mini,代碼行數:41,

示例14: buildSQL

​點讚 2

import com.baomidou.mybatisplus.toolkit.StringUtils; //導入方法依賴的package包/類

/**

* 按標準順序連接並構建SQL

*

* @param builder 連接器

* @return

*/

private String buildSQL(SafeAppendable builder) {

sqlClause(builder, “WHERE”, where, “(“, “)”, AND);

sqlClause(builder, “GROUP BY”, groupBy, “”, “”, “, “);

sqlClause(builder, “HAVING”, having, “(“, “)”, AND);

sqlClause(builder, “ORDER BY”, orderBy, “”, “”, “, “);

if (StringUtils.isNotEmpty(last)) {

builder.append(” “);

builder.append(last);

}

return builder.toString();

}

開發者ID:Caratacus,項目名稱:mybatis-plus-mini,代碼行數:18,

示例15: toString

​點讚 2

import com.baomidou.mybatisplus.toolkit.StringUtils; //導入方法依賴的package包/類

public String toString() {

StringBuilder sb = new StringBuilder(“Wrapper:”);

String sqlSegment = getSqlSegment();

if (StringUtils.isNotEmpty(sqlSegment)) {

sb.append(getSqlSegment().replaceAll(“#\\{” + getParamAlias() + “.paramNameValuePairs.MPGENVAL[0-9]+}”, “\\?”)).append(“\n”);

}

Object entity = getEntity();

if (entity != null) {

sb.append(“entity=”).append(entity.toString());

}

return sb.toString();

}

開發者ID:Caratacus,項目名稱:mybatis-plus-mini,代碼行數:13,

示例16: handerLike

​點讚 2

import com.baomidou.mybatisplus.toolkit.StringUtils; //導入方法依賴的package包/類

/**

* 處理LIKE操作

*

* @param column 字段名稱

* @param value like匹配值

* @param isNot 是否為NOT LIKE操作

*/

private void handerLike(String column, String value, SqlLike type, boolean isNot) {

if (StringUtils.isNotEmpty(column) && StringUtils.isNotEmpty(value)) {

StringBuilder inSql = new StringBuilder();

inSql.append(column);

if (isNot) {

inSql.append(” NOT”);

}

inSql.append(” LIKE {0}”);

sql.WHERE(formatSql(inSql.toString(), SqlUtils.concatLike(value, type)));

}

}

開發者ID:Caratacus,項目名稱:mybatis-plus-mini,代碼行數:19,

示例17: setProperties

​點讚 2

import com.baomidou.mybatisplus.toolkit.StringUtils; //導入方法依賴的package包/類

@Override

public void setProperties(Properties prop) {

String overflowCurrent = prop.getProperty(“overflowCurrent”);

if (StringUtils.isNotEmpty(overflowCurrent)) {

this.overflowCurrent = Boolean.TRUE.toString().equals(overflowCurrent);

}

}

開發者ID:Caratacus,項目名稱:mybatis-plus-mini,代碼行數:8,

示例18: handerNull

​點讚 2

import com.baomidou.mybatisplus.toolkit.StringUtils; //導入方法依賴的package包/類

/**

* 以相同的方式處理null和notnull

*

* @param columns 以逗號分隔的字段名稱

* @param sqlPart SQL部分

*/

private void handerNull(String columns, String sqlPart) {

if (StringUtils.isNotEmpty(columns)) {

String[] cols = columns.split(“,”);

for (String col : cols) {

if (StringUtils.isNotEmpty(col.trim())) {

WHERE(col + sqlPart);

}

}

}

}

開發者ID:Caratacus,項目名稱:mybatis-plus-mini,代碼行數:17,

示例19: handerLike

​點讚 2

import com.baomidou.mybatisplus.toolkit.StringUtils; //導入方法依賴的package包/類

/**

*

* 處理LIKE操作

*

*

* @param column 字段名稱

* @param value like匹配值

* @param isNot 是否為NOT LIKE操作

*/

private void handerLike(String column, String value, SqlLike type, boolean isNot) {

if (StringUtils.isNotEmpty(column) && StringUtils.isNotEmpty(value)) {

StringBuilder inSql = new StringBuilder();

inSql.append(column);

if (isNot) {

inSql.append(” NOT”);

}

inSql.append(” LIKE {0}”);

sql.WHERE(formatSql(inSql.toString(), SqlUtils.concatLike(value, type)));

}

}

開發者ID:baomidou,項目名稱:mybatis-plus,代碼行數:21,

示例20: setProperties

​點讚 2

import com.baomidou.mybatisplus.toolkit.StringUtils; //導入方法依賴的package包/類

@Override

public void setProperties(Properties prop) {

String stopProceed = prop.getProperty(“stopProceed”);

if (StringUtils.isNotEmpty(stopProceed)) {

this.stopProceed = Boolean.valueOf(stopProceed);

}

}

開發者ID:baomidou,項目名稱:mybatis-plus,代碼行數:8,

示例21: convertGlobalConfiguration

​點讚 2

import com.baomidou.mybatisplus.toolkit.StringUtils; //導入方法依賴的package包/類

public GlobalConfiguration convertGlobalConfiguration() throws ClassNotFoundException, IllegalAccessException, InstantiationException {

GlobalConfiguration globalConfiguration = new GlobalConfiguration();

if (StringUtils.isNotEmpty(this.getIdentifierQuote())) {

globalConfiguration.setIdentifierQuote(this.getIdentifierQuote());

}

if (StringUtils.isNotEmpty(this.getLogicDeleteValue())) {

globalConfiguration.setLogicDeleteValue(this.getLogicDeleteValue());

}

if (StringUtils.isNotEmpty(this.getLogicNotDeleteValue())) {

globalConfiguration.setLogicNotDeleteValue(this.getLogicNotDeleteValue());

}

if (StringUtils.isNotEmpty(this.getSqlInjector())) {

globalConfiguration.setSqlInjector((ISqlInjector) Class.forName(this.getSqlInjector()).newInstance());

}

if (StringUtils.isNotEmpty(this.getMetaObjectHandler())) {

globalConfiguration.setMetaObjectHandler((MetaObjectHandler) Class.forName(this.getMetaObjectHandler()).newInstance());

}

if (StringUtils.isNotEmpty(this.getKeyGenerator())) {

globalConfiguration.setKeyGenerator((IKeyGenerator) Class.forName(this.getKeyGenerator()).newInstance());

}

if (StringUtils.checkValNotNull(this.getIdType())) {

globalConfiguration.setIdType(this.getIdType());

}

if (null != this.getDbColumnUnderline()) {

globalConfiguration.setDbColumnUnderline(this.getDbColumnUnderline());

}

if (StringUtils.checkValNotNull(this.getFieldStrategy())) {

globalConfiguration.setFieldStrategy(this.getFieldStrategy());

}

if (StringUtils.checkValNotNull(this.getRefreshMapper())) {

globalConfiguration.setRefresh(this.getRefreshMapper());

}

if (StringUtils.checkValNotNull(this.getCapitalMode())) {

globalConfiguration.setCapitalMode(this.getCapitalMode());

}

if (null != this.getSqlParserCache()) {

globalConfiguration.setSqlParserCache(this.getSqlParserCache());

}

return globalConfiguration;

}

開發者ID:baomidou,項目名稱:mybatis-plus,代碼行數:41,

示例22: sqlSet

​點讚 2

import com.baomidou.mybatisplus.toolkit.StringUtils; //導入方法依賴的package包/類

/**

*

* SQL 更新 set 語句

*

*

* @param selective 是否選擇判斷

* @param table 表信息

* @param prefix 前綴

* @return

*/

protected String sqlSet(boolean selective, TableInfo table, String prefix) {

StringBuilder set = new StringBuilder();

set.append(“”);

// 是否 IF 標簽判斷

boolean ifTag;

List fieldList = table.getFieldList();

for (TableFieldInfo fieldInfo : fieldList) {

// 判斷是否更新忽略,在FieldIgnore,UPDATE,INSERT_UPDATE設置為false

ifTag = !(FieldFill.UPDATE == fieldInfo.getFieldFill()

|| FieldFill.INSERT_UPDATE == fieldInfo.getFieldFill());

if (selective && ifTag) {

if (StringUtils.isNotEmpty(fieldInfo.getUpdate())) {

set.append(fieldInfo.getColumn()).append(“=”);

set.append(String.format(fieldInfo.getUpdate(), fieldInfo.getColumn())).append(“,”);

} else {

set.append(convertIfTag(true, fieldInfo, prefix, false));

set.append(fieldInfo.getColumn()).append(“=#{“);

if (null != prefix) {

set.append(prefix);

}

set.append(fieldInfo.getEl()).append(“},”);

set.append(convertIfTag(true, fieldInfo, null, true));

}

} else if (FieldFill.INSERT != fieldInfo.getFieldFill()) {

// 排除填充注解字段

set.append(fieldInfo.getColumn()).append(“=#{“);

if (null != prefix) {

set.append(prefix);

}

set.append(fieldInfo.getEl()).append(“},”);

}

}

set.append(“\n”);

return set.toString();

}

開發者ID:baomidou,項目名稱:mybatis-plus,代碼行數:47,

示例23: handerExists

​點讚 2

import com.baomidou.mybatisplus.toolkit.StringUtils; //導入方法依賴的package包/類

/**

*

* 處理EXISTS操作

*

*

* @param value

* @param isNot 是否為NOT EXISTS操作

*/

private void handerExists(String value, boolean isNot) {

if (StringUtils.isNotEmpty(value)) {

StringBuilder inSql = new StringBuilder();

if (isNot) {

inSql.append(” NOT”);

}

inSql.append(” EXISTS (“).append(value).append(“)”);

WHERE(inSql.toString());

}

}

開發者ID:baomidou,項目名稱:mybatis-plus,代碼行數:19,

示例24: getAs

​點讚 2

import com.baomidou.mybatisplus.toolkit.StringUtils; //導入方法依賴的package包/類

public String getAs() {

if (StringUtils.isEmpty(getColumn()) || StringUtils.isEmpty(as)) {

return StringUtils.EMPTY;

}

String quote = null;

if (isEscape() && SqlRunner.FACTORY != null) {

GlobalConfiguration globalConfig = GlobalConfigUtils.getGlobalConfig(SqlRunner.FACTORY.getConfiguration());

quote = globalConfig.getIdentifierQuote() == null ? globalConfig.getDbType().getQuote() : globalConfig.getIdentifierQuote();

}

return AS + (StringUtils.isNotEmpty(quote) ? String.format(quote, as) : as);

}

開發者ID:baomidou,項目名稱:mybatis-plus,代碼行數:12,

示例25: setSqlKeywords

​點讚 2

import com.baomidou.mybatisplus.toolkit.StringUtils; //導入方法依賴的package包/類

public void setSqlKeywords(String sqlKeywords) {

if (StringUtils.isNotEmpty(sqlKeywords)) {

SqlReservedWords.RESERVED_WORDS.addAll(StringUtils.splitWorker(sqlKeywords.toUpperCase(), “,”, -1, false));

}

}

開發者ID:Caratacus,項目名稱:mybatis-plus-mini,代碼行數:6,

示例26: injectSql

​點讚 2

import com.baomidou.mybatisplus.toolkit.StringUtils; //導入方法依賴的package包/類

/**

*

* 注入SQL

*

*

* @param builderAssistant

* @param mapperClass

* @param modelClass

* @param table

*/

protected void injectSql(MapperBuilderAssistant builderAssistant, Class> mapperClass, Class> modelClass, TableInfo table) {

/**

* #148 表信息包含主鍵,注入主鍵相關方法

*/

if (StringUtils.isNotEmpty(table.getKeyProperty())) {

/* 刪除 */

this.injectDeleteByIdSql(false, mapperClass, modelClass, table);

this.injectDeleteByIdSql(true, mapperClass, modelClass, table);

/* 修改 */

this.injectUpdateByIdSql(true, mapperClass, modelClass, table);

this.injectUpdateByIdSql(false, mapperClass, modelClass, table);

/* 查詢 */

this.injectSelectByIdSql(false, mapperClass, modelClass, table);

this.injectSelectByIdSql(true, mapperClass, modelClass, table);

} else {

// 表不包含主鍵時 給予警告

logger.warn(String.format(“%s ,Not found @TableId annotation, Cannot use Mybatis-Plus ‘xxById’ Method.”,

modelClass.toString()));

}

/**

* 正常注入無需主鍵方法

*/

/* 插入 */

this.injectInsertOneSql(true, mapperClass, modelClass, table);

this.injectInsertOneSql(false, mapperClass, modelClass, table);

/* 刪除 */

this.injectDeleteSql(mapperClass, modelClass, table);

/* 修改 */

this.injectUpdateSql(mapperClass, modelClass, table);

/* 查詢 */

this.injectSelectOneSql(mapperClass, modelClass, table);

this.injectSelectCountSql(mapperClass, modelClass, table);

this.injectSelectListSql(SqlMethod.SELECT_LIST, mapperClass, modelClass, table);

this.injectSelectListSql(SqlMethod.SELECT_PAGE, mapperClass, modelClass, table);

this.injectSelectMapsSql(SqlMethod.SELECT_MAPS, mapperClass, modelClass, table);

this.injectSelectMapsSql(SqlMethod.SELECT_MAPS_PAGE, mapperClass, modelClass, table);

this.injectSelectObjsSql(SqlMethod.SELECT_OBJS, mapperClass, modelClass, table);

/* 自定義方法 */

this.inject(configuration, builderAssistant, mapperClass, modelClass, table);

}

開發者ID:Caratacus,項目名稱:mybatis-plus-mini,代碼行數:51,

示例27: sqlSelectColumns

​點讚 2

import com.baomidou.mybatisplus.toolkit.StringUtils; //導入方法依賴的package包/類

/**

*

* SQL 查詢所有表字段

*

*

* @param table

* @param entityWrapper 是否為包裝類型查詢

* @return

*/

protected String sqlSelectColumns(TableInfo table, boolean entityWrapper) {

StringBuilder columns = new StringBuilder();

if (null != table.getResultMap()) {

/*

* 存在 resultMap 映射返回

*/

if (entityWrapper) {

columns.append(“${ew.sqlSelect}”);

}

columns.append(“*”);

if (entityWrapper) {

columns.append(“”);

}

} else {

/*

* 普通查詢

*/

if (entityWrapper) {

columns.append(“${ew.sqlSelect}”);

}

List fieldList = table.getFieldList();

int _size = 0;

if (null != fieldList) {

_size = fieldList.size();

}

// 主鍵處理

if (StringUtils.isNotEmpty(table.getKeyProperty())) {

if (table.isKeyRelated()) {

columns.append(table.getKeyColumn()).append(” AS “).append(sqlWordConvert(table.getKeyProperty()));

} else {

columns.append(sqlWordConvert(table.getKeyProperty()));

}

if (_size >= 1) {

// 判斷其餘字段是否存在

columns.append(“,”);

}

}

if (_size >= 1) {

// 字段處理

int i = 0;

Iterator iterator = fieldList.iterator();

while (iterator.hasNext()) {

TableFieldInfo fieldInfo = iterator.next();

// 匹配轉換內容

String wordConvert = sqlWordConvert(fieldInfo.getProperty());

if (fieldInfo.getColumn().equals(wordConvert)) {

columns.append(wordConvert);

} else {

// 字段屬性不一致

columns.append(fieldInfo.getColumn());

columns.append(” AS “).append(wordConvert);

}

if (i + 1 < _size) {

columns.append(“,”);

}

i++;

}

}

if (entityWrapper) {

columns.append(“”);

}

}

/*

* 返回所有查詢字段內容

*/

return columns.toString();

}

開發者ID:Caratacus,項目名稱:mybatis-plus-mini,代碼行數:80,

示例28: sqlSelectColumns

​點讚 2

import com.baomidou.mybatisplus.toolkit.StringUtils; //導入方法依賴的package包/類

/**

*

* SQL 查詢所有表字段

*

*

* @param table

* @param entityWrapper 是否為包裝類型查詢

* @return

*/

protected String sqlSelectColumns(TableInfo table, boolean entityWrapper) {

StringBuilder columns = new StringBuilder();

if (null != table.getResultMap()) {

/*

* 存在 resultMap 映射返回

*/

if (entityWrapper) {

columns.append(“${ew.sqlSelect}”);

}

columns.append(“*”);

if (entityWrapper) {

columns.append(“”);

}

} else {

/*

* 普通查詢

*/

if (entityWrapper) {

columns.append(“${ew.sqlSelect}”);

}

List fieldList = table.getFieldList();

int _size = 0;

if (null != fieldList) {

_size = fieldList.size();

}

// 主鍵處理

if (StringUtils.isNotEmpty(table.getKeyProperty())) {

if (table.isKeyRelated()) {

columns.append(table.getKeyColumn()).append(” AS “).append(asSqlWordConvert(table.getKeyProperty()));

} else {

columns.append(sqlWordConvert(table.getKeyProperty()));

}

if (_size >= 1) {

// 判斷其餘字段是否存在

columns.append(“,”);

}

}

if (_size >= 1) {

// 字段處理

int i = 0;

Iterator iterator = fieldList.iterator();

while (iterator.hasNext()) {

TableFieldInfo fieldInfo = iterator.next();

// 匹配轉換內容

String wordConvert = sqlWordConvert(fieldInfo.getProperty());

if (fieldInfo.getColumn().equals(wordConvert)) {

columns.append(wordConvert);

} else {

// 字段屬性不一致

columns.append(fieldInfo.getColumn());

columns.append(” AS “).append(asSqlWordConvert(wordConvert));

}

if (i + 1 < _size) {

columns.append(“,”);

}

i++;

}

}

if (entityWrapper) {

columns.append(“”);

}

}

/*

* 返回所有查詢字段內容

*/

return columns.toString();

}

開發者ID:Caratacus,項目名稱:mybatis-plus-mini,代碼行數:80,

示例29: setProperties

​點讚 2

import com.baomidou.mybatisplus.toolkit.StringUtils; //導入方法依賴的package包/類

public void setProperties(Properties prop) {

String format = prop.getProperty(“format”);

if (StringUtils.isNotEmpty(format)) {

this.format = Boolean.valueOf(format);

}

}

開發者ID:Caratacus,項目名稱:mybatis-plus-mini,代碼行數:7,

示例30: setProperties

​點讚 2

import com.baomidou.mybatisplus.toolkit.StringUtils; //導入方法依賴的package包/類

public void setProperties(Properties prop) {

String stopProceed = prop.getProperty(“stopProceed”);

if (StringUtils.isNotEmpty(stopProceed)) {

this.stopProceed = Boolean.valueOf(stopProceed);

}

}

開發者ID:Caratacus,項目名稱:mybatis-plus-mini,代碼行數:7,

示例31: intercept

​點讚 2

import com.baomidou.mybatisplus.toolkit.StringUtils; //導入方法依賴的package包/類

/**

* Physical Pagination Interceptor for all the queries with parameter {@link org.apache.ibatis.session.RowBounds}

*/

@Override

public Object intercept(Invocation invocation) throws Throwable {

StatementHandler statementHandler = (StatementHandler) PluginUtils.realTarget(invocation.getTarget());

MetaObject metaObject = SystemMetaObject.forObject(statementHandler);

this.sqlParser(metaObject);

// 先判斷是不是SELECT操作

MappedStatement mappedStatement = (MappedStatement) metaObject.getValue(“delegate.mappedStatement”);

if (!SqlCommandType.SELECT.equals(mappedStatement.getSqlCommandType())) {

return invocation.proceed();

}

RowBounds rowBounds = (RowBounds) metaObject.getValue(“delegate.rowBounds”);

/* 不需要分頁的場合 */

if (rowBounds == null || rowBounds == RowBounds.DEFAULT) {

// 本地線程分頁

if (localPage) {

// 采用ThreadLocal變量處理的分頁

rowBounds = PageHelper.getPagination();

if (rowBounds == null) {

return invocation.proceed();

}

} else {

// 無需分頁

return invocation.proceed();

}

}

// 針對定義了rowBounds,做為mapper接口方法的參數

BoundSql boundSql = (BoundSql) metaObject.getValue(“delegate.boundSql”);

String originalSql = boundSql.getSql();

Connection connection = (Connection) invocation.getArgs()[0];

DBType dbType = StringUtils.isNotEmpty(dialectType) ? DBType.getDBType(dialectType) : JdbcUtils.getDbType(connection.getMetaData().getURL());

if (rowBounds instanceof Pagination) {

Pagination page = (Pagination) rowBounds;

boolean orderBy = true;

if (page.isSearchCount()) {

SqlInfo sqlInfo = SqlUtils.getCountOptimize(sqlParser, originalSql);

orderBy = sqlInfo.isOrderBy();

this.queryTotal(overflowCurrent, sqlInfo.getSql(), mappedStatement, boundSql, page, connection);

if (page.getTotal() <= 0) {

return invocation.proceed();

}

}

String buildSql = SqlUtils.concatOrderBy(originalSql, page, orderBy);

originalSql = DialectFactory.buildPaginationSql(page, buildSql, dbType, dialectClazz);

} else {

// support physical Pagination for RowBounds

originalSql = DialectFactory.buildPaginationSql(rowBounds, originalSql, dbType, dialectClazz);

}

/*

*

禁用內存分頁

*

內存分頁會查詢所有結果出來處理(這個很嚇人的),如果結果變化頻繁這個數據還會不準。

*/

metaObject.setValue(“delegate.boundSql.sql”, originalSql);

metaObject.setValue(“delegate.rowBounds.offset”, RowBounds.NO_ROW_OFFSET);

metaObject.setValue(“delegate.rowBounds.limit”, RowBounds.NO_ROW_LIMIT);

return invocation.proceed();

}

開發者ID:baomidou,項目名稱:mybatis-plus,代碼行數:61,

示例32: pretreatmentConfigBuilder

​點讚 2

import com.baomidou.mybatisplus.toolkit.StringUtils; //導入方法依賴的package包/類

/**

*

* 預處理配置

*

*

* @param config 總配置信息

* @return 解析數據結果集

*/

protected ConfigBuilder pretreatmentConfigBuilder(ConfigBuilder config) {

/**

* 注入自定義配置

*/

if (null != injectionConfig) {

injectionConfig.initMap();

config.setInjectionConfig(injectionConfig);

}

/**

* 表信息列表

*/

List tableList = this.getAllTableInfoList(config);

for (TableInfo tableInfo : tableList) {

/* ———- 添加導入包 ———- */

if (config.getGlobalConfig().isActiveRecord()) {

// 開啟 ActiveRecord 模式

tableInfo.setImportPackages(Model.class.getCanonicalName());

}

if (tableInfo.isConvert()) {

// 表注解

tableInfo.setImportPackages(TableName.class.getCanonicalName());

}

if (tableInfo.isLogicDelete(config.getStrategyConfig().getLogicDeleteFieldName())) {

// 邏輯刪除注解

tableInfo.setImportPackages(TableLogic.class.getCanonicalName());

}

if (StringUtils.isNotEmpty(config.getStrategyConfig().getVersionFieldName())) {

// 樂觀鎖注解

tableInfo.setImportPackages(Version.class.getCanonicalName());

}

if (StringUtils.isNotEmpty(config.getSuperEntityClass())) {

// 父實體

tableInfo.setImportPackages(config.getSuperEntityClass());

} else {

tableInfo.setImportPackages(Serializable.class.getCanonicalName());

}

// Boolean類型is前綴處理

if (config.getStrategyConfig().isEntityBooleanColumnRemoveIsPrefix()) {

for (TableField field : tableInfo.getFields()) {

if (field.getPropertyType().equalsIgnoreCase(“boolean”)) {

if (field.getPropertyName().startsWith(“is”)) {

field.setPropertyName(config.getStrategyConfig(),

StringUtils.removePrefixAfterPrefixToLower(field.getPropertyName(), 2));

}

}

}

}

}

return config.setTableInfoList(tableList);

}

開發者ID:baomidou,項目名稱:mybatis-plus,代碼行數:59,

示例33: setSqlSelect

​點讚 2

import com.baomidou.mybatisplus.toolkit.StringUtils; //導入方法依賴的package包/類

public Wrapper setSqlSelect(String sqlSelect) {

if (StringUtils.isNotEmpty(sqlSelect)) {

this.sqlSelect = sqlSelect;

}

return this;

}

開發者ID:baomidou,項目名稱:mybatis-plus,代碼行數:7,

示例34: injectSql

​點讚 2

import com.baomidou.mybatisplus.toolkit.StringUtils; //導入方法依賴的package包/類

/**

*

* 注入SQL

*

*

* @param builderAssistant

* @param mapperClass

* @param modelClass

* @param table

*/

protected void injectSql(MapperBuilderAssistant builderAssistant, Class> mapperClass, Class> modelClass, TableInfo table) {

/**

* #148 表信息包含主鍵,注入主鍵相關方法

*/

if (StringUtils.isNotEmpty(table.getKeyProperty())) {

/** 刪除 */

this.injectDeleteByIdSql(false, mapperClass, modelClass, table);

this.injectDeleteByIdSql(true, mapperClass, modelClass, table);

/** 修改 */

this.injectUpdateByIdSql(true, mapperClass, modelClass, table);

this.injectUpdateByIdSql(false, mapperClass, modelClass, table);

/** 查詢 */

this.injectSelectByIdSql(false, mapperClass, modelClass, table);

this.injectSelectByIdSql(true, mapperClass, modelClass, table);

} else {

// 表不包含主鍵時 給予警告

logger.warn(String.format(“%s ,Not found @TableId annotation, Cannot use Mybatis-Plus ‘xxById’ Method.”,

modelClass.toString()));

}

/**

* 正常注入無需主鍵方法

*/

/** 插入 */

this.injectInsertOneSql(true, mapperClass, modelClass, table);

this.injectInsertOneSql(false, mapperClass, modelClass, table);

/** 刪除 */

this.injectDeleteSql(mapperClass, modelClass, table);

this.injectDeleteByMapSql(mapperClass, table);

/** 修改 */

this.injectUpdateSql(mapperClass, modelClass, table);

/** 查詢 */

this.injectSelectByMapSql(mapperClass, modelClass, table);

this.injectSelectOneSql(mapperClass, modelClass, table);

this.injectSelectCountSql(mapperClass, modelClass, table);

this.injectSelectListSql(SqlMethod.SELECT_LIST, mapperClass, modelClass, table);

this.injectSelectListSql(SqlMethod.SELECT_PAGE, mapperClass, modelClass, table);

this.injectSelectMapsSql(SqlMethod.SELECT_MAPS, mapperClass, modelClass, table);

this.injectSelectMapsSql(SqlMethod.SELECT_MAPS_PAGE, mapperClass, modelClass, table);

this.injectSelectObjsSql(SqlMethod.SELECT_OBJS, mapperClass, modelClass, table);

/** 自定義方法 */

this.inject(configuration, builderAssistant, mapperClass, modelClass, table);

}

開發者ID:baomidou,項目名稱:mybatis-plus,代碼行數:53,

示例35: in

​點讚 1

import com.baomidou.mybatisplus.toolkit.StringUtils; //導入方法依賴的package包/類

/**

* IN 條件語句,目前適配mysql及oracle

*

* @param expression

* @param column 字段名稱

* @param value 逗號拚接的字符串

* @return this

*/

public Wrapper in(boolean expression, String column, String value) {

if (expression && StringUtils.isNotEmpty(value)) {

in(column, StringUtils.splitWorker(value, “,”, -1, false));

}

return this;

}

開發者ID:Caratacus,項目名稱:mybatis-plus-mini,代碼行數:15,

示例36: notIn

​點讚 1

import com.baomidou.mybatisplus.toolkit.StringUtils; //導入方法依賴的package包/類

/**

* NOT IN條件語句

*

* @param expression

* @param column 字段名稱

* @param value 逗號拚接的字符串

* @return this

*/

public Wrapper notIn(boolean expression, String column, String value) {

if (expression && StringUtils.isNotEmpty(value)) {

notIn(column, StringUtils.splitWorker(value, “,”, -1, false));

}

return this;

}

開發者ID:Caratacus,項目名稱:mybatis-plus-mini,代碼行數:15,

示例37: orderBy

​點讚 1

import com.baomidou.mybatisplus.toolkit.StringUtils; //導入方法依賴的package包/類

/**

*

* SQL中orderby關鍵字跟的條件語句,可根據變更動態排序

*

*

* @param condition 拚接的前置條件

* @param columns SQL 中的 order by 語句,無需輸入 Order By 關鍵字

* @param isAsc 是否為升序

* @return this

*/

public Wrapper orderBy(boolean condition, String columns, boolean isAsc) {

if (condition && StringUtils.isNotEmpty(columns)) {

sql.ORDER_BY(columns + (isAsc ? ” ASC” : ” DESC”));

}

return this;

}

開發者ID:baomidou,項目名稱:mybatis-plus,代碼行數:17,

示例38: in

​點讚 1

import com.baomidou.mybatisplus.toolkit.StringUtils; //導入方法依賴的package包/類

/**

*

* IN 條件語句,目前適配mysql及oracle

*

*

* @param condition 拚接的前置條件

* @param column 字段名稱

* @param value 逗號拚接的字符串

* @return this

*/

public Wrapper in(boolean condition, String column, String value) {

if (condition && StringUtils.isNotEmpty(value)) {

in(column, StringUtils.splitWorker(value, “,”, -1, false));

}

return this;

}

開發者ID:baomidou,項目名稱:mybatis-plus,代碼行數:17,

注:本文中的com.baomidou.mybatisplus.toolkit.StringUtils.isNotEmpty方法示例整理自Github/MSDocs等源碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/185224.html原文链接:https://javaforall.cn

【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛

【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...

(0)


相关推荐

  • 服务器安装linux系统安装教程_linux服务器重装系统

    服务器安装linux系统安装教程_linux服务器重装系统一、linux镜像的刻录1.首先打开电脑上面任意浏览器(IE、MicrosoftEdge、chrome、Firefox),输入网址https://www.centos.org/我们可以看到如下界面选择立即获取centos下载最新的安装镜像,复制下载链接(http://isoredirect.centos.org/centos/7/isos/x86_64/CentOS-7-x86_64…

  • vue-router 详解

    vue-router 详解文章目录1、认识vue-router2、安装和使用vue-router1、认识vue-router目前前端流行的三大框架,都有自己的路由实现:Angular的ngRouterReact的ReactRouterVue的vue-routervue-router是Vue.js官方的路由插件,它和vue.js是深度集成的,适合用于构建单页面应用。我们可以访问其官方网站对其进行学习:https://router.vuejs.org/zh/vue-router是基于路由和组件的路由用户设定访问

  • oracle创建用户 授权表,oracle创建用户及授权创建表

    oracle创建用户 授权表,oracle创建用户及授权创建表–================================–Oracle用户、对象权限、系统权限–================================建立表空间和用户的步骤:用户建立:createuser用户名identifiedby”密码”;授权:grantcreatesessionto用户名;grantcreatetableto用户名;g…

  • rsync服务的三种模式测试[通俗易懂]

    rsync服务的三种模式测试[通俗易懂]目录1什么是rsync1.1rsync简介rsync特性1.3rsync的企业工作场景说明2rsync三种模式:2.1rsync常用参数选项2.2rsync本地模式2.3rsyncshell模式2.4rsyncdaemon模式3rsync服务故障模拟4rsync多模块实战5rsync排除及无差异同步实战6rsync优缺点6….

    2022年10月13日
  • ramdisk tmpfs_RAMDISK

    ramdisk tmpfs_RAMDISK原文地址:http://blog.csdn.net/michaelwubo/article/details/47418639为了自己方便记忆学习,将自己重点地方进行标注,感谢作者!目录第一部分:ramfs、tmpfs、rootfs、ramdisk一、什么是ramfs二、什么是tmpfs三、什么是rootfs四、什么是ramdisk第二部分:initrd、in

发表回复

您的电子邮箱地址不会被公开。

关注全栈程序员社区公众号