| | |
| | | import com.google.gson.GsonBuilder;
|
| | | import com.google.gson.reflect.TypeToken;
|
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsSubClassLabel;
|
| | | import com.yeshi.fanli.exception.GoodsClassException;
|
| | | import com.yeshi.fanli.exception.goods.GoodsClassException;
|
| | | import com.yeshi.fanli.service.inter.clazz.GoodsSubClassLabelService;
|
| | | import com.yeshi.fanli.tag.PageEntity;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
| | |
|
| | | /**
|
| | | * 标签列表
|
| | | * |
| | | * @param callback
|
| | | * @param classId
|
| | | * @param pageIndex
|
| | |
| | | */
|
| | | @RequestMapping(value = "saveLabel")
|
| | | public void save(String callback, GoodsSubClassLabel label, HttpServletRequest request, PrintWriter out) {
|
| | | if (StringUtil.isNullOrEmpty(label.getName()) || label.getGoodsClass() == null) {
|
| | | if (StringUtil.isNullOrEmpty(label.getName()) || label.getGoodsClass() == null || label.getOrderBy() == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("数据不完整"));
|
| | | return;
|
| | | }
|
| | |
| | |
|
| | | label.setCreateTime(new Date());
|
| | | try {
|
| | | goodsSubClassLabelService.addSubClassLabel(label);
|
| | | String[] names = label.getName().replace(",", ",").split(",");
|
| | | int orderBy = label.getOrderBy();
|
| | | for (String name : names) {
|
| | | label.setId(null);
|
| | | label.setOrderBy(orderBy++);
|
| | | label.setName(name);
|
| | | goodsSubClassLabelService.addSubClassLabel(label);
|
| | | }
|
| | | } catch (GoodsClassException e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMessage()));
|
| | | }
|