com.github.wz2cool.dynamic.mybatis.mapper.helper.DynamicQuerySqlHelper Maven / Gradle / Ivy
package com.github.wz2cool.dynamic.mybatis.mapper.helper;
import com.github.wz2cool.dynamic.mybatis.mapper.constant.MapperConstants;
/**
* @author Frank
*/
public class DynamicQuerySqlHelper {
private DynamicQuerySqlHelper() {
throw new UnsupportedOperationException();
}
public static String getBindFilterParams(boolean isMapUnderscoreToCamelCase) {
StringBuilder sql = new StringBuilder();
sql.append(" ");
return sql.toString();
}
public static String getUpdateBindFilterParams(boolean isMapUnderscoreToCamelCase) {
StringBuilder sql = new StringBuilder();
sql.append(" ");
return sql.toString();
}
public static String getSelectColumnsClause() {
return String.format(" ${%s.%s} ", MapperConstants.DYNAMIC_QUERY_PARAMS, MapperConstants.SELECT_COLUMNS_EXPRESSION);
}
public static String getWhereClause() {
String newExpression = String.format("%s.%s", MapperConstants.DYNAMIC_QUERY_PARAMS, MapperConstants.WHERE_EXPRESSION);
return String.format("WHERE ${%s} ",
newExpression, newExpression, newExpression);
}
public static String getSortClause() {
String newExpression = String.format("%s.%s", MapperConstants.DYNAMIC_QUERY_PARAMS, MapperConstants.SORT_EXPRESSION);
return String.format("ORDER BY ${%s} ",
newExpression, newExpression, newExpression);
}
public static String getSetClause() {
String newExpression = String.format("%s.%s", MapperConstants.DYNAMIC_QUERY_PARAMS, MapperConstants.SET_EXPRESSION);
return String.format("SET ${%s} ",
newExpression, newExpression, newExpression);
}
public static String getSelectMax() {
return String.format("SELECT MAX(${%s})", MapperConstants.COLUMN);
}
public static String getSelectMin() {
return String.format("SELECT MIN(${%s})", MapperConstants.COLUMN);
}
public static String getSelectSum() {
return String.format("SELECT SUM(${%s})", MapperConstants.COLUMN);
}
public static String getSelectAvg() {
return String.format("SELECT AVG(${%s})", MapperConstants.COLUMN);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy