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

📄 indexlinkinfo.java

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

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import com.saas.biz.commen.Charset;
import com.saas.biz.commen.commMethodMgr;
import com.saas.biz.dao.indexLinkDAO.IndexLinkDAO;
import com.saas.biz.dao.indexLinkDAO.IndexLinkExt;
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 IndexlinkInfo {

  Dbtable tradeQuery;

  Logger log;

  Buffers inBuffer;

  Buffers outBuffer;

  ArrayList queryResult = new ArrayList();

  commMethodMgr commen;
  
 Charset charset;
 
  public IndexlinkInfo() {
	log = new Logger(this);
	tradeQuery = new Dbtable();
	commen = new commMethodMgr();
	charset=new Charset();
  }

  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 getIndexLinkInfo(Buffers inbuffer)
  {
	log.LOG_INFO("进入getIndexLinkInfo方法...");
	this.outBuffer = inbuffer;
	try
	  {
		this.queryResult = getIndexLinkInfo();
	  }
	catch(SaasApplicationException e)
	  {
		log.LOG_INFO(e.getMessage());
	  }
	log.LOG_INFO("退出getIndexLinkInfo方法...");
  }

  public ArrayList getIndexLinkInfo() throws SaasApplicationException
  {
	ArrayList resultList = new ArrayList();
	IndexLinkExt indexLinkExt = new IndexLinkExt();
	resultList = indexLinkExt.selByList("SEL_INDEXLINK_ALL");
	return resultList;
  }

  // 取出一级分类
  public void getGradeOneLinkInfo(Buffers inbuffer)
  {
	log.LOG_INFO("进入getGradeOneLinkInfo方法...");
	this.outBuffer = inbuffer;
	try
	  {
		this.queryResult = getGradeOneLinkInfo();
	  }
	catch(SaasApplicationException e)
	  {
		log.LOG_INFO(e.getMessage());
	  }
	log.LOG_INFO("退出getGradeOneLinkInfo方法...");
  }

  public ArrayList getGradeOneLinkInfo() throws SaasApplicationException
  {
	ArrayList resultList = new ArrayList();
	IndexLinkExt indexLinkExt = new IndexLinkExt();
	indexLinkExt.setParam(":VLINK_TYPE", "0");
	resultList = indexLinkExt.selByList("SEL_INDEXLINK_ONE");
	return resultList;
  }

  // 给出一级分类,取出下级分类
  public void getOneLinkInfoAndDowns(Buffers inbuffer)
  {
	log.LOG_INFO("进入getOneLinkInfoAndDowns方法...");
	this.outBuffer = inbuffer;
	String link_id = inbuffer.getString("LINK_ID");
	try
	  {
		this.queryResult = getOneLinkInfoAndDowns(link_id);
	  }
	catch(SaasApplicationException e)
	  {
		log.LOG_INFO(e.getMessage());
	  }
	log.LOG_INFO("退出getOneLinkInfoAndDowns方法...");
  }

  public ArrayList getOneLinkInfoAndDowns(String link_id) throws SaasApplicationException
  {
	ArrayList upList = new ArrayList();
	ArrayList resultList = new ArrayList();
	IndexLinkExt indexLinkExt = new IndexLinkExt();
	indexLinkExt.setParam(":VLINK_ID", link_id);
	upList = indexLinkExt.selByList("SEL_INDEXLINK_BY_ID");
	if (upList != null && upList.size() > 0)
	  {
		for (Iterator iter = upList.iterator(); iter.hasNext();)
		  {
			HashMap upOjb = (HashMap) iter.next();
			ArrayList list = getDownLinkInfoByupLink(upOjb.get("link_id").toString());
			HashMap map = new HashMap();
			map.put(upOjb, list);
			resultList.add(map);
		  }
	  }
	return resultList;
  }

  // 通过上级的ID找出所有下级
  public void getDownLinkInfoByupLink(Buffers inbuffer)
  {
	log.LOG_INFO("进入getDownLinkInfoByupLink方法...");
	this.outBuffer = inbuffer;
	String link_id = inbuffer.getString("LINK_ID");
	try
	  {
		this.queryResult = getDownLinkInfoByupLink(link_id);
	  }
	catch(SaasApplicationException e)
	  {
		log.LOG_INFO(e.getMessage());
	  }
	log.LOG_INFO("退出getDownLinkInfoByupLink方法...");
  }

  public ArrayList getDownLinkInfoByupLink(String link_id) throws SaasApplicationException
  {
	ArrayList resultList = new ArrayList();
	IndexLinkExt indexLinkExt = new IndexLinkExt();
	indexLinkExt.setParam(":VUP_LINK_ID", link_id);
	resultList = indexLinkExt.selByList("SEL_INDEXLINK_BY_UP");
	return resultList;
  }

  // 取出所有一级分类和下级
  public ArrayList getDefaultIndexLinkInfo() throws SaasApplicationException
  {
	ArrayList resultList = new ArrayList();
	ArrayList ongList = new ArrayList();
	ongList = getGradeOneLinkInfo();
	if (ongList != null && ongList.size() > 0)
	  {
		for (Iterator iter = ongList.iterator(); iter.hasNext();)
		  {
			HashMap upOjb = (HashMap) iter.next();
			ArrayList list = getDownLinkInfoByupLink(upOjb.get("link_id").toString());
			HashMap map = new HashMap();
			map.put(upOjb, list);
			resultList.add(map);
		  }
	  }
	return resultList;
  }

  // 增加页面导航一级分类
  public void addIndexLinkInfoUp(Buffers inbuffer)
  {
	log.LOG_INFO("进入addIndexLinkInfo方法...");
	this.outBuffer = inbuffer;
	this.inBuffer = inbuffer;
	int iResult = -1;
	commMethodMgr comm = new commMethodMgr();
	String link_id = comm.GenTradeId();
	IndexLinkDAO indexDao = new IndexLinkDAO();
	indexDao.setLink_id(link_id);
	indexDao.setLink_name(inbuffer.getString("LINK_NAME"));
	indexDao.setLink_no(inbuffer.getString("LINK_NO"));
	indexDao.setWeb_id("111111111111111");
	indexDao.setLink_type(inbuffer.getString("LINK_TYPE"));
	indexDao.setLink_desc(inbuffer.getString("LINK_DESC"));
	indexDao.setLink_url(inbuffer.getString("LINK_URL"));
	indexDao.setUp_link_id("000000000000000");
	try
	  {
		iResult = addIndexLinkInfoUp(indexDao);
	  }
	    catch(SaasApplicationException 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("退出addIndexLinkInfo方法...");
  }

  public int addIndexLinkInfoUp(IndexLinkDAO indexDao) throws SaasApplicationException
  {
      	try
      	{
        	IndexLinkExt indexExt = new IndexLinkExt();
        	indexExt.setParam(":VLINK_ID", indexDao.getLink_id());
        	indexExt.setParam(":VLINK_NAME",(indexDao.getLink_name()));
        	indexExt.setParam(":VLINK_NO", indexDao.getLink_no());
        	indexExt.setParam(":VWEB_ID", indexDao.getWeb_id());
        	indexExt.setParam(":VLINK_TYPE", indexDao.getLink_type());
        	indexExt.setParam(":VLINK_DESC",indexDao.getLink_desc());
        	indexExt.setParam(":VLINK_URL", indexDao.getLink_url());
        	indexExt.setParam(":VUP_LINK_ID", indexDao.getUp_link_id());
        	tradeQuery.executeBy(indexExt.insBy("INS_INDEXLINK_ONE"));
        }
        catch(Exception e)
        {
    	    log.LOG_INFO(e.getMessage());
        }
    	return 0;
  }
//增加页面导航下级分类
  public void addIndexLinkInfoDown(Buffers inbuffer)
  {
	log.LOG_INFO("进入addIndexLinkInfoDown方法...");
	this.outBuffer = inbuffer;
	this.inBuffer = inbuffer;
	int iResult = -1;
	commMethodMgr comm = new commMethodMgr();
	String link_id = comm.GenTradeId();
	IndexLinkDAO indexDao = new IndexLinkDAO();
	indexDao.setLink_id(link_id);
	indexDao.setLink_name(inbuffer.getString("LINK_NAME"));
	indexDao.setLink_no(inbuffer.getString("LINK_NO"));
	indexDao.setWeb_id("111111111111111");
	indexDao.setLink_desc(inbuffer.getString("LINK_DESC"));
	indexDao.setLink_type(inbuffer.getString("LINK_TYPE"));
	indexDao.setLink_url(inbuffer.getString("LINK_URL"));
	indexDao.setUp_link_id(inbuffer.getString("GRP_ID"));
	try
	  {
		iResult = addIndexLinkInfoDown(indexDao);
	  }
	catch(SaasApplicationException 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("退出addIndexLinkInfoDown方法...");
  }

  public int addIndexLinkInfoDown(IndexLinkDAO indexDao) throws SaasApplicationException
  {
	IndexLinkExt indexExt = new IndexLinkExt();
	indexExt.setParam(":VLINK_ID", indexDao.getLink_id());
	indexExt.setParam(":VLINK_NAME", indexDao.getLink_name());
	log.LOG_INFO( indexDao.getLink_name());///////////////////////
	indexExt.setParam(":VLINK_NO", indexDao.getLink_no());
	indexExt.setParam(":VWEB_ID", indexDao.getWeb_id());
	indexExt.setParam(":VLINK_TYPE", indexDao.getLink_type());
	indexExt.setParam(":VLINK_DESC", (indexDao.getLink_desc()));
	log.LOG_INFO( indexDao.getLink_desc());/////////////////////
	indexExt.setParam(":VLINK_URL", indexDao.getLink_url());
	indexExt.setParam(":VUP_LINK_ID", indexDao.getUp_link_id());
	tradeQuery.executeBy(indexExt.insBy("INS_INDEXLINK_ONE"));
	return 0;
  }
  //删除页面导航分类
  public void deleteIndexLinkInfo(Buffers inbuffer)
  {
	log.LOG_INFO("进入deleteIndexLinkInfo方法...");
	this.outBuffer = inbuffer;
	this.inBuffer = inbuffer;
	int iResult = -1;
	String link_id=inbuffer.getString("LINK_ID");
	try
	  {
		iResult = deleteIndexLinkInfo(link_id);
	  }
	catch(SaasApplicationException 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("退出deleteIndexLinkInfo方法...");
  }

  public int deleteIndexLinkInfo(String link_id) throws SaasApplicationException
  {
	IndexLinkExt indexExt = new IndexLinkExt();
	indexExt.setParam(":VLINK_ID", link_id);
	tradeQuery.executeBy(indexExt.insBy("DELETE_INDEX_BY_IDX"));
	return 0;
  }
  //修改页面导航
  public void updateLinkInfo(Buffers inbuffer)
  {
	log.LOG_INFO("进入updateLinkInfo方法...");
	this.outBuffer = inbuffer;
	this.inBuffer = inbuffer;
	int iResult = -1;
	String link_name=inbuffer.getString("LINK_NAME");
	String link_no=inbuffer.getString("LINK_NO");
	String link_type=inbuffer.getString("LINK_TYPE");
	String link_desc=inbuffer.getString("LINK_DESC");
	String link_url=inbuffer.getString("LINK_URL");
    String link_id=inbuffer.getString("LINK_ID");
	try
	  {
		iResult = updateLinkInfo(link_name, link_no, link_type, link_desc, link_url, link_id);
	  }
	    catch(SaasApplicationException 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("退出addIndexLinkInfo方法...");
  }
  
   public int updateLinkInfo(String link_name,String link_no,String link_type,String link_desc,String link_url,String link_id)throws SaasApplicationException
   {
   	   try
      	{
        	IndexLinkExt indexExt = new IndexLinkExt();
        	indexExt.setParam(":VLINK_ID",link_id);
        	indexExt.setParam(":VLINK_NAME",link_name);
        	indexExt.setParam(":VLINK_NO", link_no);
        	indexExt.setParam(":VLINK_TYPE", link_type);
        	indexExt.setParam(":VLINK_DESC",link_desc);
        	indexExt.setParam(":VLINK_URL", link_url);
        	tradeQuery.executeBy(indexExt.insBy("UPDATE_BY_ID"));
        }
        catch(Exception e)
        {
    	    log.LOG_INFO(e.getMessage());
        }
    	return 0;
   }
  
  /**
     *取出所有导航
     *分页查询
    **/
	public ArrayList getLinkListByAll(int iStart) throws SaasApplicationException
	{
		iStart=iStart*30;
		ArrayList linkList = new ArrayList();
		IndexLinkExt indexExt = new IndexLinkExt();
		linkList = indexExt.selByList("SEL_BY_All",iStart,30);			
		return linkList;
	}
	//统计总数
	public int getLinkNumber() throws SaasApplicationException
	{
	    ArrayList linkList = new ArrayList();
		IndexLinkExt indexExt = new IndexLinkExt();
		linkList = indexExt.selByList("SEL_BY_All");			
		if(linkList != null)
		{
			return linkList.size();
		}	 
		else 
		{
			return 0;
		}
	}	    
	//取出单个链接
	public ArrayList getLinkInfoById(String link_id)throws SaasApplicationException
	{
		ArrayList resultList = new ArrayList();
		IndexLinkExt indexLinkExt = new IndexLinkExt();
		indexLinkExt.setParam(":VLINK_ID", link_id);
		resultList = indexLinkExt.selByList("SEL_INDEXLINK_BY_ID");
		return resultList;
	}
}

⌨️ 快捷键说明

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