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

📄 entitypropinfo.java

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

import java.util.ArrayList;
import java.util.HashMap;

import com.saas.biz.commen.commMethodMgr;
import com.saas.biz.dao.entitypropDAO.EntitypropDAO;
import com.saas.biz.dao.entitypropDAO.EntitypropExt;
import com.saas.biz.dao.roleDAO.RoleExt;
import com.saas.sys.buffer.Buffers;
import com.saas.sys.dbm.Dbtable;
import com.saas.sys.exp.SaasApplicationException;
import com.saas.sys.log.Logger;

public class EntitypropInfo{
	Dbtable tradeQuery;

	commMethodMgr comm;

	Logger log;

	Buffers inBuffer;

	Buffers outBuffer;

	ArrayList queryResult = new ArrayList();

	public EntitypropInfo() {
		log = new Logger(this);
		tradeQuery = new Dbtable();
		comm = new commMethodMgr();
	}

	public void setTradeQuery(Dbtable tradeQuery) {
		this.tradeQuery = tradeQuery;
	}

	public Dbtable getTradeQuery() {
		return this.tradeQuery;
	}

	public void setOutBuffer(Buffers outBuffer) {
		this.outBuffer = outBuffer;
	}

	public Buffers getOutBuffer() {
		return this.outBuffer;
	}

	public ArrayList getQueryResult() {
		return this.queryResult;
	}

	public void setQueryResult(ArrayList queryResult) {
		this.queryResult = queryResult;
	}

	// 新增分类属性
	public void addEntityInfo(Buffers inbuffer) {
		log.LOG_INFO("进入addEntityInfo方法...");
		this.outBuffer = inbuffer;
		this.inBuffer = inbuffer;
		int iResult = -1;
		String cust_id = inbuffer.getString("SESSION_CUST_ID");
		String entity_type = inbuffer.getString("ENTITY_TYPE");
		String attr_code = inbuffer.getString("ATTR_CODE");
		String attr_name = inbuffer.getString("ATTR_NAME");
		String attr_desc = inbuffer.getString("ATTR_DESC");
		String default_value = inbuffer.getString("DEFAULT_VALUE");
		String enable_tag = inbuffer.getString("ENABLE_TAG");
		String oper_user_id = inbuffer.getString("SESSION_USER_ID");
		String remark = inbuffer.getString("REMARK");
		try {
			EntitypropDAO entityDao = new EntitypropDAO();
			entityDao.setAttr_code(attr_code);
			entityDao.setCust_id(cust_id);
			entityDao.setEnable_tag(enable_tag);
			entityDao.setEntity_type(entity_type);
			entityDao.setAttr_name(attr_name);
			entityDao.setDefault_value(default_value);
			entityDao.setAttr_desc(attr_desc);
			entityDao.setOper_user_id(oper_user_id);
			entityDao.setRemark(remark);
			iResult = addEntityInfo(entityDao);
		}
		catch (Exception e) {
			log.LOG_INFO(e.getMessage());
		}
		if (iResult != 0) {
			this.outBuffer.setInt("RESULT_CODE", -1);
			this.outBuffer.setString("RESULT_INFO", "业务处理失败!");
		}
		else {
			this.outBuffer.setInt("RESULT_CODE", 0);
			this.outBuffer.setString("RESULT_INFO", "业务处理成功!");
		}
		log.LOG_INFO("退出addEntityInfo方法...");
	}

	public int addEntityInfo(EntitypropDAO entityDao) throws SaasApplicationException {
		EntitypropExt entityExt = new EntitypropExt();
		entityExt.setParam(":VATTR_CODE", entityDao.getAttr_code());
		entityExt.setParam(":VCUST_ID", entityDao.getCust_id());
		entityExt.setParam(":VENABLE_TAG", entityDao.getEnable_tag());
		entityExt.setParam(":VENTITY_TYPE", entityDao.getEntity_type());
		entityExt.setParam(":VATTR_NAME", entityDao.getAttr_name());
		entityExt.setParam(":VATTR_CODE", entityDao.getAttr_code());
		entityExt.setParam(":VDEFAULT_VALUE", entityDao.getDefault_value());
		entityExt.setParam(":VATTR_DESC", entityDao.getAttr_desc());
		entityExt.setParam(":VOPER_USER_ID", entityDao.getOper_user_id());
		entityExt.setParam(":VREMARK", entityDao.getRemark());
		tradeQuery.executeBy(entityExt.insBy("INS_BY_ALL"));
		return 0;
	}

	// 修改分类属性
	public void updateEntityInfo(Buffers inbuffer) {
		log.LOG_INFO("进入updateEntityInfo方法...");
		this.outBuffer = inbuffer;
		this.inBuffer = inbuffer;
		int iResult = -1;
		String cust_id = inbuffer.getString("SESSION_CUST_ID");
		String entity_type = inbuffer.getString("ENTITY_TYPE");
		String attr_code = inbuffer.getString("ATTR_CODE");
		String attr_name = inbuffer.getString("ATTR_NAME");
		String attr_desc = inbuffer.getString("ATTR_DESC");
		String default_value = inbuffer.getString("DEFAULT_VALUE");
		String enable_tag = inbuffer.getString("ENABLE_TAG");
		String oper_user_id = inbuffer.getString("SESSION_USER_ID");
		String remark = inbuffer.getString("REMARK");
		try {
			EntitypropDAO entityDao = new EntitypropDAO();
			entityDao.setAttr_code(attr_code);
			entityDao.setCust_id(cust_id);
			entityDao.setEnable_tag(enable_tag);
			entityDao.setEntity_type(entity_type);
			entityDao.setAttr_name(attr_name);
			entityDao.setDefault_value(default_value);
			entityDao.setAttr_desc(attr_desc);
			entityDao.setOper_user_id(oper_user_id);
			entityDao.setRemark(remark);
			iResult = updateEntityInfo(entityDao);
		}
		catch (Exception e) {
			log.LOG_INFO(e.getMessage());
		}
		if (iResult != 0) {
			this.outBuffer.setInt("RESULT_CODE", -1);
			this.outBuffer.setString("RESULT_INFO", "业务处理失败!");
		}
		else {
			this.outBuffer.setInt("RESULT_CODE", 0);
			this.outBuffer.setString("RESULT_INFO", "业务处理成功!");
		}
		log.LOG_INFO("退出updateEntityInfo方法...");
	}

	public int updateEntityInfo(EntitypropDAO entityDao) throws SaasApplicationException {
		EntitypropExt entityExt = new EntitypropExt();
		entityExt.setParam(":VATTR_CODE", entityDao.getAttr_code());
		entityExt.setParam(":VCUST_ID", entityDao.getCust_id());
		entityExt.setParam(":VENABLE_TAG", entityDao.getEnable_tag());
		entityExt.setParam(":VENTITY_TYPE", entityDao.getEntity_type());
		entityExt.setParam(":VATTR_NAME", entityDao.getAttr_name());
		entityExt.setParam(":VATTR_CODE", entityDao.getAttr_code());
		entityExt.setParam(":VDEFAULT_VALUE", entityDao.getDefault_value());
		entityExt.setParam(":VATTR_DESC", entityDao.getAttr_desc());
		entityExt.setParam(":VOPER_USER_ID", entityDao.getOper_user_id());
		entityExt.setParam(":VREMARK", entityDao.getRemark());
		tradeQuery.executeBy(entityExt.insBy("UPDATE_BY_ALL"));
		return 0;
	}

	// 删除分类属性
	public void deleteEntityInfo(Buffers inbuffer) {
		log.LOG_INFO("进入deleteEntityInfo方法...");
		this.outBuffer = inbuffer;
		this.inBuffer = inbuffer;
		int iResult = -1;
		String cust_id = inbuffer.getString("SESSION_CUST_ID");
		String attr_code = inbuffer.getString("ATTR_CODE");
		String oper_user_id = inbuffer.getString("SESSION_USER_ID");
		try {
			EntitypropDAO entityDao = new EntitypropDAO();
			entityDao.setCust_id(cust_id);
			entityDao.setAttr_code(attr_code);
			entityDao.setOper_user_id(oper_user_id);
			iResult = deleteEntityInfo(entityDao);
		}
		catch (Exception e) {
			log.LOG_INFO(e.getMessage());
		}
		if (iResult != 0) {
			this.outBuffer.setInt("RESULT_CODE", -1);
			this.outBuffer.setString("RESULT_INFO", "业务处理失败!");
		}
		else {
			this.outBuffer.setInt("RESULT_CODE", 0);
			this.outBuffer.setString("RESULT_INFO", "业务处理成功!");
		}
		log.LOG_INFO("退出deleteEntityInfo方法...");
	}

	public int deleteEntityInfo(EntitypropDAO entityDao) throws SaasApplicationException {
		EntitypropExt entityExt = new EntitypropExt();
		entityExt.setParam(":VATTR_CODE", entityDao.getAttr_code());
		entityExt.setParam(":VCUST_ID", entityDao.getCust_id());
		entityExt.setParam(":VENABLE_TAG", "1");
		tradeQuery.executeBy(entityExt.insBy("DEL_BY_ALL"));
		return 0;
	}

	// 通过custid找出分类属性
	public ArrayList getEntityInfoByCustId(String cust_id, String enable) throws SaasApplicationException {
		ArrayList list = new ArrayList();
		EntitypropExt entityExt = new EntitypropExt();
		entityExt.setParam(":VCUST_ID", cust_id);
		entityExt.setParam(":VENABLE_TAG", enable);
		list = entityExt.selByList("SEL_BY_CUST");
		return list;
	}

	// 找出单个分类属性
	public ArrayList getEntityInfoByCode(String cust_id, String code) throws SaasApplicationException {
		ArrayList list = new ArrayList();
		EntitypropExt entityExt = new EntitypropExt();
		entityExt.setParam(":VCUST_ID", cust_id);
		entityExt.setParam(":VATTR_CODE", code);
		list = entityExt.selByList("SEL_BY_ID");
		return list;
	}

	// 分页
	public ArrayList getEntityPageByCustId(int iStart, String cust_id, String enable) throws SaasApplicationException {
		
			iStart = iStart* 20;
		
		ArrayList list = new ArrayList();
		EntitypropExt entityExt = new EntitypropExt();
		entityExt.setParam(":VCUST_ID", cust_id);
		entityExt.setParam(":VENABLE_TAG", enable);
		list = entityExt.selByList("SEL_BY_CUST", iStart, 20);
		return list;
	}

	// 统计
	public int getEntityCount(String cust_id, String enable) throws SaasApplicationException {
		int size = 0;
		ArrayList list = new ArrayList();
		EntitypropExt entityExt = new EntitypropExt();
		entityExt.setParam(":VCUST_ID", cust_id);
		entityExt.setParam(":VENABLE_TAG", enable);
		list = entityExt.selByList("SEL_BY_CT");
		if (list != null && list.size() > 0) {
			HashMap map = (HashMap) list.get(0);
			size = Integer.parseInt(map.get("ct").toString());
		}
		return size;
	}
}

⌨️ 快捷键说明

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