top.wboost.common.boost.handler.PropertiesSqlBoostHandler Maven / Gradle / Ivy
package top.wboost.common.boost.handler;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;
import java.util.concurrent.ConcurrentHashMap;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSONObject;
import top.wboost.common.system.exception.SystemException;
import top.wboost.common.util.Checker;
import top.wboost.common.util.ClassPathDataUtil;
import top.wboost.common.utils.web.utils.HtmlUtil;
import top.wboost.common.utils.web.utils.PropertiesUtil;
//@AutoWebApplicationConfig("propertiesSqlBoostHandler")
public class PropertiesSqlBoostHandler extends AbstractSqlBoostHandler implements InitializingBean {
private String propertiesName;
private Map sqlMap = new ConcurrentHashMap();
private String boostName = "/boost/prosql/**";
public PropertiesSqlBoostHandler(String propertiesName) {
super();
this.propertiesName = propertiesName;
}
@Override
public ModelAndView handleInternal(HttpServletRequest request, HttpServletResponse response) {
Map paramMap = request.getParameterMap();
String requestURI = request.getRequestURI();
String propertiesName = pathMatcher.extractPathWithinPattern(getUrlMapping(), requestURI);
String sql = sqlMap.get(propertiesName);
Checker.notNull(sql, propertiesName + "对应的sql");
Map params = new HashMap<>();
for (Entry entry : paramMap.entrySet()) {
params.put(entry.getKey(), entry.getValue()[0]);
}
List