⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 productext.java

📁 java阿里巴巴代码
💻 JAVA
字号:
package com.saas.biz.dao.productDAO;

import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import com.saas.sys.dbm.Dbexecute;
import com.saas.sys.log.Logger;
import java.util.ArrayList;
import org.apache.commons.beanutils.PropertyUtils;

public class ProductExt extends ProductDAO 
{

	Logger log;

	ArrayList updArray;

	ArrayList paramArray;

	public ProductExt()
	{
		log = new Logger(this);
		updArray = new ArrayList();
		paramArray = new ArrayList();
	}

	public ArrayList selByList(String selBy)
	{
		Dbexecute exec = new Dbexecute();
		ArrayList dataArray = new ArrayList();
		exec.setStrTable("tf_f_product");
		exec.setStrQuery(selBy);
		exec.setParamList(this.paramArray);
		dataArray = exec.selBizQuery();
		if (dataArray.size() <= 0) return null;
		return dataArray;
	}

	public ProductDAO selByInfo(String selBy)
	{
		Dbexecute exec = new Dbexecute();
		ProductDAO productDAO = new ProductDAO();
		ArrayList dataArray = new ArrayList();
		exec.setStrTable("tf_f_product");
		exec.setStrQuery(selBy);
		exec.setParamList(this.paramArray);
		dataArray = exec.selBizQuery();
		if (dataArray.size() <= 0) return null;
		Field[] fields = productDAO.getClass().getDeclaredFields();
		for (Iterator it = dataArray.iterator(); it.hasNext();) 
		{
			HashMap tradetype = (HashMap) it.next();
			for (int i = 0; i <= fields.length - 1; i++) 
			{
				if (tradetype.containsKey(fields[i].getName())) 
				{
					try {
						if (tradetype.get(fields[i].getName()) != null) 
						{
							if (fields[i].getType().getName() == "java.lang.String") 
							{
								PropertyUtils.setProperty(productDAO,fields[i].getName(), tradetype.get(fields[i].getName()).toString());
							} 
							else if (fields[i].getType().getName() == "java.lang.Integer")
							{
								Integer ivalue = new Integer(tradetype.get(fields[i].getName()).toString());
								PropertyUtils.setProperty(productDAO,fields[i].getName(), ivalue);
							}
						}
					} 
					catch (InvocationTargetException e) 
					{
						throw new RuntimeException(e);
					} 
					catch (NoSuchMethodException e) 
					{
						throw new RuntimeException(e);
					} 
					catch (IllegalAccessException e) 
					{
						throw new RuntimeException(e);
					}
				}
			}
		}
		return productDAO;
	}

	public int selCount(String selBy)
	{
		return 0;
	}

	public void setParam(String paramName, Object paramValue)
	{
		HashMap paramMap = new HashMap();
		paramMap.put("paramName", paramName);
		paramMap.put("paramValue", paramValue);
		this.paramArray.add(paramMap);
	}
	public ArrayList insBy(String insBy)
	{
		ArrayList qInsBy = new ArrayList();
		HashMap paramMap = new HashMap();
		paramMap.put("queryTable", "tf_f_product");
		paramMap.put("queryString", insBy);
		paramMap.put("queryVarMap", this.paramArray);
		qInsBy.add(paramMap);
		return qInsBy;
	}
	//分页
	public ArrayList selByList(String selBy,int iStart,int iCount)
	{
		Dbexecute exec = new Dbexecute();
		ArrayList dataArray = new ArrayList();
		exec.setStrTable("tf_f_product");
		exec.setStrQuery(selBy);
		exec.setParamList(this.paramArray);
		dataArray =  exec.selBizQuery(iStart,iCount);
		if (dataArray.size()<=0) return null;
		//log.LOG_INFO("..."+dataArray);
		return dataArray;
	}	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -