From 64bd2204be459b47e008b79073a143684140ff24 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期六, 04 七月 2020 18:20:45 +0800 Subject: [PATCH] mapper xml文件位置移动 --- fanli/src/main/java/com/yeshi/fanli/controller/admin/GoodsSubClassAdminController.java | 76 +++++++++++++++++++++++--------------- 1 files changed, 46 insertions(+), 30 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/admin/GoodsSubClassAdminController.java b/fanli/src/main/java/com/yeshi/fanli/controller/admin/GoodsSubClassAdminController.java index 7373ca7..df1d275 100644 --- a/fanli/src/main/java/com/yeshi/fanli/controller/admin/GoodsSubClassAdminController.java +++ b/fanli/src/main/java/com/yeshi/fanli/controller/admin/GoodsSubClassAdminController.java @@ -8,6 +8,7 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; +import com.yeshi.fanli.entity.accept.AdminAcceptData; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.multipart.MultipartHttpServletRequest; @@ -18,8 +19,10 @@ import com.google.gson.reflect.TypeToken; import com.yeshi.fanli.entity.bus.clazz.GoodsClass; import com.yeshi.fanli.entity.bus.clazz.GoodsSubClass; +import com.yeshi.fanli.entity.bus.clazz.GoodsSubClassLabelMap; import com.yeshi.fanli.entity.bus.clazz.TaoBaoClass; -import com.yeshi.fanli.exception.FloatADException; +import com.yeshi.fanli.exception.goods.GoodsSubClassException; +import com.yeshi.fanli.service.inter.clazz.GoodsSubClassLabelService; import com.yeshi.fanli.service.inter.goods.GoodsSubClassService; import com.yeshi.fanli.service.inter.goods.TaoBaoClassService; import com.yeshi.fanli.service.inter.lable.LabelClassService; @@ -39,31 +42,56 @@ @Resource private TaoBaoClassService taoBaoClassService; + @Resource + private GoodsSubClassLabelService goodsSubClassLabelService; + /** * 淇濆瓨淇℃伅 * * @param callback - * @param special * @param out */ @RequestMapping(value = "save") - public void save(String callback, GoodsSubClass goodsSubClass, Long pid, Integer type, HttpServletRequest request, - PrintWriter out) { + public void save(AdminAcceptData acceptData, String callback, GoodsSubClass goodsSubClass, Long pid, Integer type, Long labelId, + HttpServletRequest request, PrintWriter out) { + if (goodsSubClass.getTaobaoCids() != null) + goodsSubClass.setTaobaoCids(goodsSubClass.getTaobaoCids().replace("锛�", ",")); + try { // 1. 鍏堝垽鏂環ttpRequest 鏄惁鍚湁鏂囦欢绫诲瀷 if (request instanceof MultipartHttpServletRequest) { MultipartHttpServletRequest fileRequest = (MultipartHttpServletRequest) request; goodsSubClassService.saveObject(fileRequest.getFile("file"), fileRequest.getFile("file2"), - goodsSubClass, type, pid); + goodsSubClass, type, pid, labelId); } else { - goodsSubClassService.saveObject(null, null, goodsSubClass, type, pid); + goodsSubClassService.saveObject(null, null, goodsSubClass, type, pid, labelId); } JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("淇濆瓨鎴愬姛")); - } catch (FloatADException e) { + } catch (GoodsSubClassException e) { JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg())); } catch (Exception e) { JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("淇濆瓨澶辫触")); + e.printStackTrace(); + } + } + + + /** + * 淇敼鐘舵�� + * @param callback + * @param id + * @param out + */ + @RequestMapping(value = "switchState") + public void switchState(AdminAcceptData acceptData,String callback, Long id, PrintWriter out) { + try { + goodsSubClassService.switchState(id); + JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("鎿嶄綔鎴愬姛")); + } catch (GoodsSubClassException e) { + JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg())); + } catch (Exception e) { + JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鎿嶄綔澶辫触")); e.printStackTrace(); } } @@ -76,10 +104,8 @@ * @param out */ @RequestMapping(value = "deleteBatch") - public void deleteBatch(String callback, String ids, PrintWriter out) { - + public void deleteBatch(AdminAcceptData acceptData,String callback, String ids, PrintWriter out) { Gson gson = new Gson(); - try { List<String> recordIds = gson.fromJson(ids, new TypeToken<ArrayList<String>>() { }.getType()); @@ -91,7 +117,6 @@ goodsSubClassService.deleteByPrimaryKeyBatch(recordIds); out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult("鍒犻櫎鎴愬姛"))); } - } catch (Exception e) { out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("鎿嶄綔寮傚父"))); e.printStackTrace(); @@ -102,13 +127,10 @@ * 鍒犻櫎鍥剧墖 * * @param callback - * @param file * @param out - * @param response */ @RequestMapping(value = "removePicture") - public void removePicture(String callback, Long id, PrintWriter out) { - + public void removePicture(AdminAcceptData acceptData,String callback, Long id, PrintWriter out) { try { GoodsSubClass goodsSubClass = goodsSubClassService.selectByPrimaryKey(id); @@ -126,26 +148,21 @@ } else { out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("鍥剧墖鍒犻櫎鎴愬姛,鏁版嵁鏇存柊澶辫触"))); } - } catch (Exception e) { e.printStackTrace(); out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("鎿嶄綔寮傚父"))); } - } /** * 鏌ヨ涓�绾т笅鐨勬墍鏈変簩绾х被鍒� * * @param callback - * @param rootId * @param out */ @RequestMapping(value = "querySub") - public void querySub(String callback, Long pid, Integer type, PrintWriter out) { - + public void querySub(AdminAcceptData acceptData,String callback, Long pid, Integer type, PrintWriter out) { try { - if (pid == null) { out.print(JsonUtil.loadFalseResult("涓婄骇id涓虹┖")); return; @@ -209,6 +226,12 @@ } goodsSubClass.setTaobaoCids(taobaoCids); } + + // 鏌ヨ鏍囩 + GoodsSubClassLabelMap map = goodsSubClassLabelService.selectBySubClassId(goodsSubClass.getId()); + if (map != null) + goodsSubClass.setClassLabel(map.getLabel()); + } GsonBuilder gsonBuilder = new GsonBuilder(); @@ -218,7 +241,6 @@ JSONObject data = new JSONObject(); data.put("subClassList", gson.toJson(goodsSubClassList)); out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data))); - } catch (Exception e) { e.printStackTrace(); out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("鎿嶄綔寮傚父"))); @@ -232,8 +254,7 @@ * @param out */ @RequestMapping(value = "queryOverSecond") - public void queryOverSecond(String callback, Long pid, PrintWriter out) { - + public void queryOverSecond(AdminAcceptData acceptData,String callback, Long pid, PrintWriter out) { try { Integer state = null; List<GoodsSubClass> goodsSubClassList = goodsSubClassService.queryByPid(pid, state); @@ -250,7 +271,6 @@ JSONObject data = new JSONObject(); data.put("subClassList", gson.toJson(goodsSubClassList)); out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data))); - } catch (Exception e) { e.printStackTrace(); out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("鎿嶄綔寮傚父"))); @@ -261,13 +281,11 @@ * 淇敼鎺掑簭 * * @param callback - * @param goodsClass * @param out */ @RequestMapping(value = "saveOrder") - public void saveOrder(String callback, Long id, Integer type, Integer moveType, PrintWriter out) { + public void saveOrder(AdminAcceptData acceptData,String callback, Long id, Integer type, Integer moveType, PrintWriter out) { try { - if (moveType == null || (!moveType.equals(1) && !moveType.equals(-1))) { JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("浼犻�掔殑绫诲瀷涓嶆纭�")); return; @@ -303,9 +321,7 @@ resultObj.setUpdatetime(new Date()); goodsSubClassService.updateByPrimaryKeySelective(resultObj); - JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("鎿嶄綔鎴愬姛")); - } catch (Exception e) { e.printStackTrace(); JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鎿嶄綔寮傚父")); -- Gitblit v1.8.0