sql拼接异常
This commit is contained in:
parent
363325b3af
commit
7dc77d0dab
|
|
@ -7,13 +7,11 @@ import com.cloudstore.eccom.result.WeaResultMsg;
|
|||
import com.engine.common.biz.AbstractCommonCommand;
|
||||
import com.engine.common.entity.BizLogContext;
|
||||
import com.engine.core.interceptor.CommandContext;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.PageIdConst;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
|
@ -75,26 +73,27 @@ public class TaxAgentListCmd extends AbstractCommonCommand<Map<String, Object>>
|
|||
private String makeSqlWhere(Map<String, Object> params) {
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
StringBuilder sqlWhere = new StringBuilder("where delete_Type = 0");
|
||||
Collection<String> ids = (Collection<String>) params.get("ids");
|
||||
if (CollectionUtils.isNotEmpty(ids)) {
|
||||
sqlWhere.append(" AND id in (").append(String.join(",", ids)).append(")");
|
||||
}
|
||||
String sqlWhere = "where delete_Type = 0";
|
||||
// Collection<String> ids = (Collection<String>) params.get("ids");
|
||||
// if (CollectionUtils.isNotEmpty(ids)) {
|
||||
// sqlWhere.append(" AND id in (").append(String.join(",", ids)).append(")");
|
||||
// }
|
||||
//模糊查询
|
||||
String name = (String) params.get("name");
|
||||
if (StringUtils.isNotBlank(name)) {
|
||||
if ("mysql".equalsIgnoreCase(rs.getDBType())) {
|
||||
sqlWhere.append(" AND name like '%").append(name).append("%') ");
|
||||
} else if ("sqlserver".equalsIgnoreCase(rs.getDBType())) {
|
||||
sqlWhere.append(" AND name like CONCAT('%',").append(name).append(",'%') ");
|
||||
} else if ("oracle".equalsIgnoreCase(rs.getDBType())) {
|
||||
sqlWhere.append(" AND name like '%'||").append(name).append("||'%' ");
|
||||
} else {
|
||||
sqlWhere.append(" AND name like '%'").append(name).append("'%' ");
|
||||
}
|
||||
// if ("mysql".equalsIgnoreCase(rs.getDBType())) {
|
||||
// sqlWhere.append(" AND name like '%").append(name).append("%') ");
|
||||
// } else if ("sqlserver".equalsIgnoreCase(rs.getDBType())) {
|
||||
// sqlWhere.append(" AND name like CONCAT('%',").append(name).append(",'%') ");
|
||||
// } else if ("oracle".equalsIgnoreCase(rs.getDBType())) {
|
||||
// sqlWhere.append(" AND name like '%'||").append(name).append("||'%' ");
|
||||
// } else {
|
||||
// sqlWhere.append(" AND name like '%'").append(name).append("'%' ");
|
||||
// }
|
||||
sqlWhere += " AND name like '%"+name+"%'";
|
||||
}
|
||||
|
||||
return sqlWhere.toString();
|
||||
return sqlWhere;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue