| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- package com.util;
- import com.model.bo.Screen;
- import org.springframework.stereotype.Component;
- import java.util.Iterator;
- import java.util.List;
- /*
- 解析筛选信息
- */
- @Component
- public class ScreenUtil {
- public String screensUtil(List<Screen> screenList){
- //返回值
- if (screenList.size() == 0){
- return "";
- }
- String ret = "";
- Iterator isList = screenList.iterator();
- while (isList.hasNext()){
- Screen screen = (Screen) isList.next();
- String columnName = screen.getColumnName();
- String columnType = screen.getColumnType();
- String symbol = screen.getSymbol();
- String value = screen.getValue();
- if (columnType != "time"){
- String symbVal = getSymbAndVal(symbol, value);
- ret = ret + " and " + columnName + " " + symbVal;
- System.out.println("ret:" + ret);
- }if(columnType == "time" || "time".equals(columnType)){
- String symbVal ;
- }
- }
- return ret;
- }
- public String getSymbAndVal(String symbol, String value){
- String values = "'" + value;
- String tar = "";
- if ("contain".equals(symbol)){
- tar = "like %" + values + "%'";
- }else if("notContain".equals(symbol)){
- tar = "not like %" + values + "%'";
- }else if("startsWith".equals(symbol)){
- tar = "like " + values + "%'";
- }else if("endsWith".equals(symbol)){
- tar = "like %" + values +"'";
- }else if("null".equals(symbol)){
- tar = "is null";
- }else if ("notNull".equals(symbol)){
- tar = "is not null";
- }else {
- tar = symbol + " " + values + "'";
- }
- return tar;
- }
- public String getTimeSybVal(String symbol, String value){
- return "";
- }
- }
|