📄 productclass.java
字号:
package com.saas.biz.productclassMgr;
import java.util.*;
import com.saas.biz.dao.repositoryDAO.RepositoryExt;
import com.saas.biz.commen.commMethodMgr;
import com.saas.biz.dao.productclassDAO.ProductclassDAO;
import com.saas.biz.dao.productclassDAO.ProductclassExt;
import com.saas.sys.buffer.Buffers;
import com.saas.sys.dbm.Dbtable;
import com.saas.sys.exp.SaasApplicationException;
import com.saas.sys.log.Logger;
import net.sf.json.JSONArray;
import com.saas.biz.JavaScriptObject.TreeNode;
import com.saas.biz.JavaScriptObject.TreeObject;
import com.saas.biz.commen.commMethodMgr;
public class Productclass {
Dbtable tradeQuery;
Logger log;
Buffers inBuffer;
Buffers outBuffer;
ArrayList queryResult = new ArrayList();
commMethodMgr comm;
public Productclass() {
log = new Logger(this);
comm = new commMethodMgr();
tradeQuery = new Dbtable();
}
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 addClassInfo(Buffers inbuffer) {
log.LOG_INFO("进入addClassInfo方法...");
this.outBuffer = inbuffer;
this.inBuffer = inbuffer;
int iResult = -1;
ProductclassDAO productclassDAO = new ProductclassDAO();
productclassDAO.setClass_level(inbuffer.getString("CLASS_LEVEL"));
productclassDAO.setClass_name(inbuffer.getString("CLASS_NAME"));
productclassDAO.setClass_type(inbuffer.getString("CLASS_TYPE"));
productclassDAO.setEnable_tag(inbuffer.getString("ENABLE_TAG"));
productclassDAO.setUp_class_id(inbuffer.getString("UP_CLASS_ID"));
productclassDAO.setClass_desc(inbuffer.getString("CLASS_DESC"));
productclassDAO.setRsrv_str1("");// inbuffer.getString("RSRV_STR")刘阳@2008.6.18.16:25
try {
iResult = addClassInfo(productclassDAO);
}
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("退出addClassInfo方法...");
}
public int addClassInfo(ProductclassDAO productclassDAO) throws SaasApplicationException {
ProductclassExt productclassExt = new ProductclassExt();
commMethodMgr comm = new commMethodMgr();
String class_id = comm.GenTradeId();
productclassExt.setParam(":VCLASS_LEVEL", productclassDAO.getClass_level());
productclassExt.setParam(":VCLASS_NAME", productclassDAO.getClass_name());
productclassExt.setParam(":VCLASS_TYPE", productclassDAO.getClass_type());
productclassExt.setParam(":VUP_CLASS_ID", productclassDAO.getUp_class_id());
productclassExt.setParam(":VENABLE_TAG", productclassDAO.getEnable_tag());
productclassExt.setParam(":VCLASS_DESC", productclassDAO.getClass_desc());
productclassExt.setParam(":VCLASS_ID", class_id);
productclassExt.setParam(":VRSRV_STR1", productclassDAO.getRsrv_str1());
productclassExt.setParam(":VRSRV_STR2", "");
productclassExt.setParam(":VRSRV_STR3", "");
productclassExt.setParam(":VRSRV_STR4", "");
productclassExt.setParam(":VRSRV_STR5", "");
productclassExt.setParam(":VRSRV_STR6", "");
productclassExt.setParam(":VRSRV_STR7", "");
productclassExt.setParam(":VRSRV_STR8", "");
productclassExt.setParam(":VRSRV_STR9", "");
productclassExt.setParam(":VRSRV_STR10", "");
productclassExt.setParam(":VREMARK", "");
tradeQuery.executeBy(productclassExt.insBy("INS_BY_ALL"));
return 0;
}
public void addNewsClassInfo(Buffers inbuffer) {
log.LOG_INFO("进入addClassInfo方法...");
this.outBuffer = inbuffer;
this.inBuffer = inbuffer;
int iResult = -1;
ProductclassDAO productclassDAO = new ProductclassDAO();
productclassDAO.setClass_level(inbuffer.getString("CLASS_LEVEL"));
productclassDAO.setClass_name(inbuffer.getString("CLASS_NAME"));
productclassDAO.setClass_type(inbuffer.getString("CLASS_TYPE"));
productclassDAO.setEnable_tag(inbuffer.getString("ENABLE_TAG"));
productclassDAO.setUp_class_id(inbuffer.getString("UP_CLASS_ID"));
productclassDAO.setClass_desc(inbuffer.getString("CLASS_DESC"));
productclassDAO.setRsrv_str1(inbuffer.getString("RSRV_STR1"));
try {
iResult = addClassInfo(productclassDAO);
}
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("退出addClassInfo方法...");
}
public void delByClassId(Buffers inbuffer) {
log.LOG_INFO("进入delByClassId方法...");
this.outBuffer = inbuffer;
this.inBuffer = inbuffer;
int iResult = -1;
String classId = inbuffer.getString("CLASS_ID");
try {
iResult = delByClassId(classId);
}
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("退出delByClassId方法...");
}
public int delByClassId(String classId) throws SaasApplicationException {
ProductclassExt productclassExt = new ProductclassExt();
productclassExt.setParam(":VCLASS_ID", classId);
tradeQuery.executeBy(productclassExt.insBy("DEL_BY_CLASSID"));
return 0;
}
/*
* 按显示方式找出新闻类型
*/
public ArrayList genClassByRsrv_str1(String rsrv_str1, int num) throws SaasApplicationException {
ProductclassExt productclassExt = new ProductclassExt();
ArrayList classList = new ArrayList();
productclassExt.setParam(":VRSRV_STR1", rsrv_str1);
classList = productclassExt.selByList("SEL_CLASS_BYRSRV_STR1", 0, num);
if (classList == null || !(classList.size() > 0)) {
classList = null;
}
return classList;
}
public ArrayList genClassNameByRsrv_str1(String rsrv_str1, String class_name) throws SaasApplicationException {
ProductclassExt productclassExt = new ProductclassExt();
ArrayList classList = new ArrayList();
productclassExt.setParam(":VRSRV_STR1", rsrv_str1);
productclassExt.setParam(":VCLASS_NAME", class_name);
classList = productclassExt.selByList("SEL_CLASSNAME_BYRSRV_STR1");
if (classList == null || !(classList.size() > 0)) {
classList = null;
}
return classList;
}
/**
* 通过当前的Class_Id找出所有上一级分类型
*/
public void genUpclassByClassId(Buffers inbuffer) {
log.LOG_INFO("进入genUpclassByClassId方法...");
this.outBuffer = inbuffer;
String class_id = inbuffer.getString("CLASS_ID");
try {
this.queryResult = genUpclassByClassId(class_id);
}
catch (SaasApplicationException e) {
log.LOG_INFO(e.getMessage());
}
log.LOG_INFO("退出genUpclassByClassId方法...");
}
public ArrayList genUpclassByClassId(String classId) throws SaasApplicationException {
ProductclassExt productclassExt = new ProductclassExt();
ArrayList classList = new ArrayList();
productclassExt.setParam(":VCLASS_ID", classId);
classList = productclassExt.selByList("SEL_CLASSUP_BYDOWN");
if (classList == null || !(classList.size() > 0)) {
classList = null;
}
return classList;
}
/**
* 通过当前的Class_Id找出所有下一级分类型
*/
public void genDownclassByClassId(Buffers inbuffer) {
log.LOG_INFO("进入genDownclassByClassId方法...");
this.outBuffer = inbuffer;
String class_id = inbuffer.getString("CLASS_ID");
try {
this.queryResult = genDownclassByClassId(class_id);
}
catch (SaasApplicationException e) {
log.LOG_INFO(e.getMessage());
}
log.LOG_INFO("退出genDownclassByClassId方法...");
}
public ArrayList genDownclassByClassId(String classId) throws SaasApplicationException {
ProductclassExt productclassExt = new ProductclassExt();
ArrayList classList = new ArrayList();
productclassExt.setParam(":VCLASS_ID", classId);
classList = productclassExt.selByList("SEL_CLASSDOWN_BYUP");
if (classList == null || !(classList.size() > 0)) {
classList = null;
}
return classList;
}
public Map getProductClassByUpId(String upclass, String type) throws SaasApplicationException {
Map<String, String> classMap = new HashMap<String, String>();
String class_id = "", class_name = "";
ArrayList list = new ArrayList();
ProductclassExt productclassExt = new ProductclassExt();
productclassExt.setParam(":VUP_CLASS_ID", upclass);
productclassExt.setParam(":VCLASS_TYPE", type);
list = productclassExt.selByList("SEL_CLASS_BY_UP");
if (list != null && list.size() > 0) {
for (int i = 0; i < list.size(); i++) {
HashMap map = (HashMap) list.get(i);
if (map.get("class_name") != null) {
class_name = map.get("class_name").toString();
}
if (map.get("class_id") != null) {
class_id = map.get("class_id").toString();
}
classMap.put(class_id, class_name);
}
}
log.LOG_INFO("wwwwwwwww...");
return classMap;
}
/**
* @param classId
* @return
* @throws SaasApplicationException
*/
public Map getclassByClassId(String classId) throws SaasApplicationException {
ProductclassExt productclassExt = new ProductclassExt();
ArrayList classList = new ArrayList();
Map resultMap = new HashMap();
String class_name = "", class_desc = "";
productclassExt.setParam(":VCLASS_ID", classId);
classList = productclassExt.selByList("SEL_BY_CLASSID");
if (classList != null && classList.size() > 0) {
HashMap map = (HashMap) classList.get(0);
if (map.get("class_name") != null)
class_name = map.get("class_name").toString();
if (map.get("class_desc") != null)
class_desc = map.get("class_desc").toString();
}
resultMap.put("class_name", class_name);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -