public void ProcessGoodsAttributeTList(List<GoodsAttributeT> list) { rows.clear(); for (Iterator<GoodsAttributeT> it = list.iterator(); it.hasNext(); ) { GoodsAttributeT gat = (GoodsAttributeT) it.next(); if (StaticKey.ZERO.equals(gat.getAttributeType())) { gat.setAttributeType(StaticKey.SELECTITEM); } else { gat.setAttributeType(StaticKey.INPUTITEM); } if (StaticKey.ONE.equals(gat.getIssearch())) { gat.setIssearch(StaticKey.SUPPORT); } else { gat.setIssearch(StaticKey.UNSUPPORT); } if (StaticKey.ONE.equals(gat.getIssametolink())) { gat.setIssametolink(StaticKey.SUPPORT); } else { gat.setIssametolink(StaticKey.UNSUPPORT); } Map<String, Object> cellMap = new HashMap<String, Object>(); cellMap.put("id", gat.getGoodsattributeid()); cellMap.put( "cell", new Object[] { gat.getGoodsattributename(), gat.getAttributeType(), gat.getAttributelist(), gat.getSort(), gat.getGoodsTypeName(), gat.getIssearch(), gat.getIssametolink(), BaseTools.formateDbDate(gat.getCreatetime()), "<a id='editgoodsattribute' name='editgoodsattribute' href='goodsattribute.jsp?operate=edit&folder=goods&goodsTypeName=" + gat.getGoodsTypeName() + "'>[编辑]</a>" }); rows.add(cellMap); } }
/** * 更新商品参数 * * @return */ @Action( value = "updateGoodsAttributeT", results = {@Result(name = "json", type = "json")}) public String updateGoodsAttributeT() { JSONArray ja = (JSONArray) JSONValue.parse(this.getRjson()); int jsonsize = ja.size(); GoodsAttributeT gat = new GoodsAttributeT(); for (int i = 0; i < jsonsize; i++) { gat.setCreatetime(BaseTools.systemtime()); gat.setState(StaticKey.ONE); gat.setCreatorid(BaseTools.adminCreateId()); gat.setGoodsTypeId(this.getGoodsTypeId()); gat.setGoodsTypeName(this.getGoodsTypeName()); gat.setAttributeIndex(this.getAttributeIndex()); JSONObject jo = (JSONObject) ja.get(i); gat.setGoodsattributename(jo.get(StaticKey.GOODSATTRIBUTENAME).toString()); gat.setAttributeType(jo.get(StaticKey.ATTRIBUTETYPE).toString()); gat.setAttributelist(jo.get(StaticKey.ATTRIBUTELIST).toString()); gat.setSort(jo.get(StaticKey.SORT).toString()); gat.setGoodsattributeid(jo.get(StaticKey.GOODSATTRIBUTEID).toString()); if (gat.getGoodsattributeid().length() == 0) { gat.setGoodsattributeid(this.getSerial().Serialid(Serial.GOODSATTRIBUTE)); this.getGoodsAttributeTService().save(gat); } else { this.getGoodsAttributeTService().updateGoodsAttributeT(gat); } } this.setSucflag(true); return "json"; }