if (isSearchLike(field))
{
StringBuilder valueStr = new StringBuilder(value.toString().toUpperCase());
if (!valueStr.toString().endsWith("%"))
valueStr.append("%");
if (!valueStr.toString().startsWith("%"))
valueStr = new StringBuilder("%").append(valueStr.toString());
===假如是 [搜尋欄位] 文字形式+建議搜尋欄位
private boolean isSearchLike(GridField field)
{
return DisplayType.isText(field.getDisplayType())
&& MColumn.isSuggestSelectionColumn(field.getColumnName(), true);
}
===假如是 [建議搜尋欄位] 自動加上 %
public static boolean isSuggestSelectionColumn(String columnName, boolean caseSensitive)
{
if (Util.isEmpty(columnName, true))
return false;
//
if (columnName.contains("名稱") || columnName.contains("單號")
|| columnName.contains("品號") || columnName.contains("品名")
|| columnName.contains("規格") || columnName.contains("單號"))
return true;
沒有留言:
張貼留言