From cdcbed9af813b2a02cdc01eefa24db8bec6b51a9 Mon Sep 17 00:00:00 2001 From: yujian <yujian> Date: 星期三, 27 三月 2019 12:17:33 +0800 Subject: [PATCH] 主分类 + 子分类 DAO改造 --- fanli/src/main/java/com/yeshi/fanli/controller/h5/H5SearchController.java | 15 fanli/src/main/java/com/yeshi/fanli/mapping/SuperGoodsClassMapper.xml | 76 + fanli/src/main/java/com/yeshi/fanli/controller/admin/GoodsClassAdminCotroller.java | 217 ---- fanli/src/main/java/com/yeshi/fanli/entity/bus/lable/QualityFlashSale.java | 8 fanli/src/main/java/com/yeshi/fanli/mapping/order/CommonOrderMapper.xml | 4 fanli/src/main/java/com/yeshi/fanli/mapping/GoodsClassMapper.xml | 125 ++ fanli/src/main/java/com/yeshi/fanli/entity/bus/lable/BoutiqueAutoRule.java | 8 fanli/src/main/java/com/yeshi/fanli/service/impl/goods/GoodsSecondClassServiceImpl.java | 62 - fanli/src/main/java/com/yeshi/fanli/exception/GoodsClassException.java | 32 fanli/src/main/java/com/yeshi/fanli/util/taobao/DaTaoKeUtil.java | 2 fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/FloatADServiceImpl.java | 2 fanli/src/main/java/com/yeshi/fanli/service/impl/goods/GoodsClassServiceImpl.java | 536 ++++------- fanli/src/main/java/com/yeshi/fanli/entity/bus/su/clazz/SuperGoodsClass.java | 47 fanli/src/main/java/com/yeshi/fanli/service/inter/goods/GoodsClassService.java | 52 fanli/src/main/java/com/yeshi/fanli/controller/ClientJspController.java | 16 fanli/src/main/java/com/yeshi/fanli/entity/bus/lable/MergeClass.java | 44 fanli/src/main/java/com/yeshi/fanli/entity/bus/clazz/GoodsSubClass.java | 90 - fanli/src/main/java/com/yeshi/fanli/controller/admin/GoodsSubClassAdminController.java | 256 ----- fanli/src/main/java/com/yeshi/fanli/entity/bus/clazz/TaoBaoClass.java | 21 fanli/src/main/java/com/yeshi/fanli/service/inter/goods/GoodsSecondClassService.java | 4 fanli/src/main/java/com/yeshi/fanli/service/impl/user/AccountMessageServiceImpl.java | 24 fanli/src/main/java/com/yeshi/fanli/service/inter/goods/SuperGoodsClassService.java | 15 fanli/src/main/java/com/yeshi/fanli/service/inter/goods/GoodsSubClassService.java | 45 fanli/src/main/java/com/yeshi/fanli/exception/GoodsSubClassException.java | 32 fanli/src/main/java/com/yeshi/fanli/entity/bus/clazz/GoodsClass.java | 123 +- fanli/src/main/java/com/yeshi/fanli/entity/bus/clazz/TaoBaoClassRelation.java | 29 fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserInfoServiceImpl.java | 16 fanli/src/main/java/com/yeshi/fanli/dao/mybatis/GoodsClassMapper.java | 44 fanli/src/main/java/com/yeshi/fanli/controller/client/GoodsClassController.java | 9 /dev/null | 11 fanli/src/main/java/com/yeshi/fanli/entity/bus/lable/QualityFactory.java | 8 fanli/src/main/java/com/yeshi/fanli/entity/bus/lable/Label.java | 8 fanli/src/main/java/com/yeshi/fanli/entity/bus/homemodule/SuperHomeNavbar.java | 26 fanli/src/main/java/com/yeshi/fanli/mapping/GoodsSecondClassMapper.xml | 73 + fanli/src/main/java/com/yeshi/fanli/service/impl/goods/SuperGoodsClassServiceImpl.java | 101 - fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/SwiperPictureServiceImpl.java | 2 fanli/src/main/java/com/yeshi/fanli/dao/mybatis/GoodsSecondClassMapper.java | 31 fanli/src/main/java/com/yeshi/fanli/dao/mybatis/SuperGoodsClassMapper.java | 58 + fanli/src/main/java/com/yeshi/fanli/entity/bus/clazz/GoodsSecondClass.java | 87 +- fanli/src/main/java/com/yeshi/fanli/service/impl/goods/GoodsSubClassServiceImpl.java | 189 ++- 40 files changed, 1,154 insertions(+), 1,394 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/ClientJspController.java b/fanli/src/main/java/com/yeshi/fanli/controller/ClientJspController.java index 8283eba..9077c8b 100644 --- a/fanli/src/main/java/com/yeshi/fanli/controller/ClientJspController.java +++ b/fanli/src/main/java/com/yeshi/fanli/controller/ClientJspController.java @@ -42,6 +42,8 @@ import com.yeshi.fanli.log.LogHelper; import com.yeshi.fanli.service.inter.config.BusinessSystemService; import com.yeshi.fanli.service.inter.config.ConfigService; +import com.yeshi.fanli.service.inter.config.CustomerContentService; +import com.yeshi.fanli.service.inter.config.CustomerNameService; import com.yeshi.fanli.service.inter.config.SystemClientParamsService; import com.yeshi.fanli.service.inter.config.SystemConfigService; import com.yeshi.fanli.service.inter.goods.GoodsSecondClassService; @@ -118,6 +120,12 @@ @Resource private TaoBaoUnionConfigService taoBaoUnionConfigService; + + @Resource + private CustomerNameService customerNameService; + + @Resource + private CustomerContentService customerContentService; private static final String DOWNURL = "http://sj.qq.com/myapp/detail.htm?apkName=" + Constant.systemCommonConfig.getAndroidPackageName(); @@ -609,20 +617,20 @@ public void getHelpList(PrintWriter out) { List<CustomerName> totalList = new ArrayList<>(); int page = 0; - List<CustomerName> customerNameList = systemClientParamsService.customerNameList(page, "", 1); + List<CustomerName> customerNameList = customerNameService.customerNameList(page, "", 1); if (customerNameList != null && customerNameList.size() > 0) totalList.addAll(customerNameList); while (customerNameList != null && customerNameList.size() == Constant.PAGE_SIZE) { page++; - customerNameList = systemClientParamsService.customerNameList(page, "", 1); + customerNameList = customerNameService.customerNameList(page, "", 1); if (customerNameList != null && customerNameList.size() > 0) totalList.addAll(customerNameList); } // 鑾峰彇姣忎釜涓嬮潰鐨勮鎯� for (CustomerName cn : totalList) { - List<CustomerContent> contentList = systemClientParamsService.getSecondProblemList(0, "", cn.getId()); + List<CustomerContent> contentList = customerContentService.getSecondProblemList(0, "", cn.getId()); cn.setCustomerContentList(contentList); } out.print(JsonUtil.loadTrueResult(JsonUtil.getSimpleGson().toJson(totalList))); @@ -631,7 +639,7 @@ @RequestMapping("getHelpDetail") public void getHelpDetail(long id, PrintWriter out) { List<CustomerName> totalList = new ArrayList<>(); - CustomerContent customerContent = systemClientParamsService.getCustomerContent(id); + CustomerContent customerContent = customerContentService.getCustomerContent(id); out.print(JsonUtil.loadTrueResult(customerContent.getContent().replace("\n", "<br>"))); } diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/admin/GoodsClassAdminCotroller.java b/fanli/src/main/java/com/yeshi/fanli/controller/admin/GoodsClassAdminCotroller.java index 195619b..2114953 100644 --- a/fanli/src/main/java/com/yeshi/fanli/controller/admin/GoodsClassAdminCotroller.java +++ b/fanli/src/main/java/com/yeshi/fanli/controller/admin/GoodsClassAdminCotroller.java @@ -2,36 +2,28 @@ import java.io.PrintWriter; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; -import java.util.Map; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartHttpServletRequest; -import org.springframework.web.multipart.commons.CommonsMultipartFile; import org.yeshi.utils.JsonUtil; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; -import com.yeshi.fanli.entity.admin.GoodsClassAdmin; import com.yeshi.fanli.entity.bus.clazz.GoodsClass; -import com.yeshi.fanli.entity.system.BusinessSystem; +import com.yeshi.fanli.exception.FloatADException; +import com.yeshi.fanli.exception.GoodsClassException; import com.yeshi.fanli.service.inter.config.BusinessSystemService; import com.yeshi.fanli.service.inter.goods.GoodsClassService; import com.yeshi.fanli.service.inter.goods.GoodsSecondClassService; import com.yeshi.fanli.service.inter.goods.GoodsSubClassService; import com.yeshi.fanli.service.inter.goods.SuperGoodsClassService; import com.yeshi.fanli.service.inter.lable.LabelClassService; -import com.yeshi.fanli.tag.PageEntity; import com.yeshi.fanli.util.Constant; -import com.yeshi.fanli.util.StringUtil; import com.yeshi.fanli.util.Utils; import net.sf.json.JSONObject; @@ -59,28 +51,6 @@ @Resource private BusinessSystemService businessSystemService; - @RequestMapping(value = "getGoodsClassList") - public void getGoodsClassList(String callback, Integer pageIndex, String platform, String packages, String key, PrintWriter out) { - - List<GoodsClassAdmin> goodsClassList = goodsClassService.getGoodsClassAdmins(pageIndex - 1, platform, packages, key); - - int count = goodsClassService.getCount(platform, packages, key); - int totalPage = count % Constant.PAGE_SIZE == 0 ? count / Constant.PAGE_SIZE : count / Constant.PAGE_SIZE + 1; - PageEntity pe = new PageEntity(pageIndex, Constant.PAGE_SIZE, count, totalPage); - Map<String, String> map = new HashMap<String, String>(); - map.put("platform", platform); - map.put("packages", packages); - map.put("key", key); - pe.setParams(map); - JSONObject data = new JSONObject(); - data.put("pe", pe); - List<BusinessSystem> systemList = businessSystemService.getBusinessSystems(); - - data.put("systemList", systemList); - data.put("goodsClassList", goodsClassList); - - JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); - } @RequestMapping(value = "queryAll") public void queryAll(String callback, String platform, String packages, PrintWriter out) { @@ -119,150 +89,55 @@ } } - - @RequestMapping(value = "getGoodsClass", method = RequestMethod.POST) - public void getGoodsClass(long id, PrintWriter out) { - GoodsClass rb = goodsClassService.getGoodsClass(id); - if (rb != null) { - out.print(JsonUtil.loadTrueResult(rb)); - return; - } - out.print(JsonUtil.loadFalseResult("涓嶅瓨鍦ㄨGoodsClass")); - } - - + /** - * 娣诲姞绫诲埆 + * 淇濆瓨淇℃伅 * * @param callback - * @param goodsClass - * @param request + * @param special * @param out */ - @RequestMapping(value = "saveAdd", method = RequestMethod.POST) - public void saveAdd(String callback, GoodsClass goodsClass, HttpServletRequest request, PrintWriter out) { + @RequestMapping(value = "save") + public void save(String callback, GoodsClass goodsClass, String jumpType, HttpServletRequest request,PrintWriter out) { try { - - String name = goodsClass.getName(); - if (StringUtil.isNullOrEmpty(name)) { - JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("绫诲埆鍚嶇О涓嶈兘涓虹┖")); - return; - } - + // 1. 鍏堝垽鏂環ttpRequest 鏄惁鍚湁鏂囦欢绫诲瀷 if (request instanceof MultipartHttpServletRequest) { - - long result; - List<MultipartFile> files = ((MultipartHttpServletRequest) request).getFiles("file"); - - goodsClass.setAndroidClick(0L); - goodsClass.setIosClick(0L); - // 鎼滅储鏉′欢:鏈夊埜銆佸湪鍞环20-200銆佺墰鐨櫍杞诲井 - goodsClass.setSearchParam("{\"quan\":1,\"endPrice\":220,\"includeGoodRate\":true,\"baoYou\":true,\"ip\":\"218.72.111.105\"}"); - - if (files != null && files.size() > 0) { - // 鍥剧墖鏂囦欢涓婁紶 - result = goodsClassService.saveAdd(goodsClass, files.get(0)); - } else { - // 鏃犲浘淇濆瓨 - result = goodsClassService.saveAdd(goodsClass, null); - } - - if (result > 0) { - JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("淇濆瓨鎴愬姛")); - } else { - JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("淇濆瓨澶辫触")); - } - - } else { - JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("璇蜂紶閫掓纭殑鍙傛暟")); - } - + MultipartHttpServletRequest fileRequest = (MultipartHttpServletRequest) request; + goodsClassService.saveObject(fileRequest.getFile("file"), goodsClass); + }else{ + goodsClassService.saveObject(null, goodsClass); + } + + JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("淇濆瓨鎴愬姛")); + } catch (FloatADException e) { + JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg())); } catch (Exception e) { - JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鎿嶄綔寮傚父")); + JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("淇濆瓨澶辫触")); e.printStackTrace(); } - } + /** - * 淇濆瓨淇敼淇℃伅 + * 淇敼鎺掑簭 * * @param callback * @param goodsClass * @param out */ - @RequestMapping(value = "saveModify") - public void saveModify(String callback, GoodsClass goodsClass, PrintWriter out) { - + @RequestMapping(value = "updateOrder") + public void updateOrder(String callback, Long id, Integer moveType, PrintWriter out) { try { - - Long id = goodsClass.getId(); - - GoodsClass resultObj = goodsClassService.getGoodsClass(id); - - if (resultObj == null) { - JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("璇ョ被鍒笉瀛樺湪鎴栧凡琚垹闄�")); - } else { - String name = goodsClass.getName(); - if (!StringUtil.isNullOrEmpty(name)) { - resultObj.setName(name); - } - - String key = goodsClass.getKey(); - if (!StringUtil.isNullOrEmpty(key)) { - resultObj.setKey(key); - } - - goodsClassService.updateGoodsClass(resultObj); - - JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("淇敼鎴愬姛")); - } - + goodsClassService.updateOrder(id, moveType); + JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("鎿嶄綔鎴愬姛")); + } catch (GoodsClassException e) { + JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg())); } catch (Exception e) { + JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鎿嶄綔澶辫触")); e.printStackTrace(); - JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鎿嶄綔寮傚父")); } - } - - /** - * 淇濆瓨淇敼淇℃伅 - * - * @param callback - * @param goodsClass - * @param out - */ - @RequestMapping(value = "saveOrderby") - public void saveOrderby(String callback, Long id, int orderby, PrintWriter out) { - - try { - - GoodsClass resultObj = goodsClassService.getGoodsClass(id); - - if (resultObj == null) { - JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("璇ョ被鍒笉瀛樺湪鎴栧凡琚垹闄�")); - } else { - - List<GoodsClass> glist = goodsClassService.getByorderby(orderby); - if (glist != null && glist.size() > 0) { - GoodsClass changeObj = glist.get(0); - changeObj.setOrderby(resultObj.getOrderby()); - goodsClassService.updateGoodsClass(changeObj); - } - - resultObj.setOrderby(orderby); - goodsClassService.updateGoodsClass(resultObj); - - JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("淇敼鎴愬姛")); - } - - } catch (Exception e) { - e.printStackTrace(); - JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鎿嶄綔寮傚父")); - } - - } - + /** * 鎵归噺鍒犻櫎 * @@ -299,46 +174,13 @@ } } catch (Exception e) { - // TODO Auto-generated catch block JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鎿嶄綔寮傚父")); e.printStackTrace(); } } - // - /** - * 涓婁紶/淇敼 鍥剧墖 - * - * @param callback - * @param file - * @param request - * @param out - * @param response - */ - @RequestMapping(value = "uploadPicture") - public void uploadPicture(Long id, @RequestParam("file") CommonsMultipartFile file, PrintWriter out) { - - try { - GoodsClass goodsClass = goodsClassService.getGoodsClass(id); - - if (goodsClass == null ) { - out.print(JsonUtil.loadFalseResult("璇ョ被鍒笉瀛樺湪鎴栧凡琚垹闄�")); - return; - } - - if (file == null) { - out.print(JsonUtil.loadFalseResult("鍥剧墖鏂囦欢涓嶈兘涓虹┖")); - return; - } - - goodsClassService.uploadPicture(goodsClass, file); - out.print(JsonUtil.loadTrueResult("涓婁紶鎴愬姛")); - } catch (Exception e) { - e.printStackTrace(); - out.print(JsonUtil.loadFalseResult("鎿嶄綔寮傚父")); - } - } + /** * 鍒犻櫎鍥剧墖 @@ -367,7 +209,6 @@ e.printStackTrace(); out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("鎿嶄綔寮傚父"))); } - } @RequestMapping(value = "setSuperSystem") 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 852c69c..b312031 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,15 +8,9 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; -import net.sf.json.JSONObject; - import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartHttpServletRequest; -import org.springframework.web.multipart.commons.CommonsMultipartFile; import org.yeshi.utils.JsonUtil; import com.google.gson.Gson; @@ -24,9 +18,11 @@ 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.exception.FloatADException; import com.yeshi.fanli.service.inter.goods.GoodsSubClassService; import com.yeshi.fanli.service.inter.lable.LabelClassService; -import com.yeshi.fanli.util.StringUtil; + +import net.sf.json.JSONObject; @Controller @RequestMapping("admin/new/api/v1/goodsSubClass") @@ -37,146 +33,35 @@ @Resource private LabelClassService labelClassService; + + /** - * 娣诲姞绫诲埆 + * 淇濆瓨淇℃伅 * * @param callback - * @param goodsSubClass - * @param request + * @param special * @param out */ - @RequestMapping(value = "saveAdd", method = RequestMethod.POST) - public void saveAdd(String callback, Long pid, Integer type, GoodsSubClass goodsSubClass, - HttpServletRequest request, PrintWriter out) { + @RequestMapping(value = "save") + public void save(String callback, GoodsSubClass goodsSubClass, Long pid, Integer type, HttpServletRequest request,PrintWriter out) { try { - - String name = goodsSubClass.getName(); - if (StringUtil.isNullOrEmpty(name)) { - out.print(JsonUtil.loadFalseResult("绫诲埆鍚嶇О涓嶈兘涓虹┖")); - return; - } - - if (pid == null) { - out.print(JsonUtil.loadFalseResult("涓婄骇id涓虹┖")); - return; - } - - if (type == null) { - out.print(JsonUtil.loadFalseResult("绛夌骇涓嶈兘涓虹┖")); - return; - } - - if (type > 5) { - out.print(JsonUtil.loadFalseResult("绛夌骇涓嶈兘瓒呰繃浜旂骇")); - return; - } - - String key = goodsSubClass.getKey(); - if (StringUtil.isNullOrEmpty(key)) { - goodsSubClass.setKey(name.trim()); - } - - // 榛樿鍋滅敤 - goodsSubClass.setState(0); - + // 1. 鍏堝垽鏂環ttpRequest 鏄惁鍚湁鏂囦欢绫诲瀷 if (request instanceof MultipartHttpServletRequest) { - - int result; - List<MultipartFile> files = ((MultipartHttpServletRequest) request).getFiles("file"); - - goodsSubClass.setAndroidClick(0L); - goodsSubClass.setIosClick(0L); - goodsSubClass.setLevel(type); - goodsSubClass.setCreatetime(new Date()); - goodsSubClass.setUpdatetime(new Date()); - // 鎼滅储鏉′欢:鏈夊埜銆佸湪鍞环20-200銆佺墰鐨櫍杞诲井 - goodsSubClass.setSearchJson("{\"quan\":1,\"endPrice\":220,\"includeGoodRate\":true}"); - - if (type == 2) { - goodsSubClass.setRootClass(new GoodsClass(pid)); - int weight = goodsSubClassService.getMaxWeightByRootId(pid); - goodsSubClass.setWeight(weight + 1); - } else { - goodsSubClass.setParent(new GoodsSubClass(pid)); - int weight = goodsSubClassService.getMaxWeightByPid(pid); - goodsSubClass.setWeight(weight + 1); - } - - - - if (files != null && files.size() > 0) { - // 鍥剧墖鏂囦欢涓婁紶 - result = goodsSubClassService.save(goodsSubClass, files.get(0)); - } else { - // 鏃犲浘淇濆瓨 - result = goodsSubClassService.save(goodsSubClass, null); - } - - if (result == 1) { - out.print(JsonUtil.loadTrueResult("淇濆瓨鎴愬姛")); - } else { - out.print(JsonUtil.loadFalseResult("淇濆瓨澶辫触")); - } - - } else { - out.print(JsonUtil.loadFalseResult("璇蜂紶閫掓纭殑鍙傛暟")); - } - + MultipartHttpServletRequest fileRequest = (MultipartHttpServletRequest) request; + goodsSubClassService.saveObject(fileRequest.getFile("file"), goodsSubClass, type, pid); + }else{ + goodsSubClassService.saveObject(null, goodsSubClass, type, pid); + } + + JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("淇濆瓨鎴愬姛")); + } catch (FloatADException e) { + JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg())); } catch (Exception e) { - out.print(JsonUtil.loadFalseResult("鎿嶄綔寮傚父")); + JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("淇濆瓨澶辫触")); e.printStackTrace(); } - } - /** - * 淇濆瓨淇敼淇℃伅 - * - * @param callback - * @param goodsSubClass - * @param out - */ - @RequestMapping(value = "saveModify") - public void saveModify(String callback, GoodsSubClass goodsSubClass, PrintWriter out) { - - try { - - Long id = goodsSubClass.getId(); - if (id == null) { - JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("涓嶅瓨鍦ㄨ绫诲埆")); - return; - } - - GoodsSubClass resultObj = goodsSubClassService.selectByPrimaryKey(id); - if (resultObj == null) { - JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("涓嶅瓨鍦ㄨ绫诲埆")); - return; - } - - GoodsSubClass subClass = new GoodsSubClass(); - - String name = goodsSubClass.getName(); - if (!StringUtil.isNullOrEmpty(name)) { - subClass.setName(name); - } - // 鍏抽敭璇嶅彲浠ヤ负绌� - subClass.setKey(goodsSubClass.getKey()); - - subClass.setId(id); - subClass.setUpdatetime(new Date()); - subClass.setAndroidClick(resultObj.getAndroidClick()); - subClass.setIosClick(resultObj.getIosClick()); - goodsSubClassService.updateByPrimaryKeySelective(subClass); - - JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("淇敼鎴愬姛")); - - } catch (Exception e) { - JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("淇敼澶辫触")); - e.printStackTrace(); - - } - - } /** * 鎵归噺鍒犻櫎 @@ -202,50 +87,11 @@ } } catch (Exception e) { - // TODO Auto-generated catch block out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("鎿嶄綔寮傚父"))); e.printStackTrace(); } - } - /** - * 涓婁紶/淇敼 鍥剧墖 - * - * @param callback - * @param file - * @param request - * @param out - * @param response - */ - @RequestMapping(value = "uploadPicture") - public void uploadPicture(Long id, @RequestParam("file") CommonsMultipartFile file, PrintWriter out) { - if (file == null) { - out.print(JsonUtil.loadFalseResult("鍥剧墖鏂囦欢涓嶈兘涓虹┖")); - return; - } - - try { - - GoodsSubClass goodsSubClass = goodsSubClassService.selectByPrimaryKey(id); - if (goodsSubClass == null) { - out.print(JsonUtil.loadFalseResult("璇ョ被鍒笉瀛樺湪鎴栧凡琚垹闄�")); - return; - } - - - int result = goodsSubClassService.uploadPicture(goodsSubClass, file); - if (result == 1) { - out.print(JsonUtil.loadTrueResult("涓婁紶鎴愬姛")); - } else { - out.print(JsonUtil.loadFalseResult("涓婁紶澶辫触")); - } - - } catch (Exception e) { - e.printStackTrace(); - out.print(JsonUtil.loadFalseResult("鎿嶄綔寮傚父")); - } - } /** * 鍒犻櫎鍥剧墖 @@ -277,7 +123,6 @@ } } catch (Exception e) { - // TODO Auto-generated catch block e.printStackTrace(); out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("鎿嶄綔寮傚父"))); } @@ -333,11 +178,17 @@ goodsSubClass.setCountClick(0l); } + String searchJson = goodsSubClass.getSearchJson(); + if (searchJson == null) { + goodsSubClass.setSearchParam(""); + } else { + goodsSubClass.setSearchParam(searchJson); + } + + int countlabel = labelClassService.getCountQueryBySubClassId(goodsSubClass.getId()); goodsSubClass.setCountlabel(countlabel); } - - GsonBuilder gsonBuilder = new GsonBuilder(); gsonBuilder.serializeNulls(); // 閲嶇偣 @@ -396,7 +247,6 @@ */ @RequestMapping(value = "saveOrder") public void saveOrder(String callback, Long id, Integer type, Integer moveType, PrintWriter out) { - try { if (moveType == null || (!moveType.equals(1) && !moveType.equals(-1))) { @@ -404,7 +254,6 @@ return; } - GoodsSubClass resultObj = goodsSubClassService.selectByPrimaryKey(id); if (resultObj == null) { JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("涓嶅瓨鍦ㄨ绫诲埆")); @@ -430,11 +279,11 @@ changeObj.setWeight(resultWeight); changeObj.setUpdatetime(new Date()); - goodsSubClassService.updateByPrimaryKey(changeObj); + goodsSubClassService.updateByPrimaryKeySelective(changeObj); } resultObj.setUpdatetime(new Date()); - goodsSubClassService.updateByPrimaryKey(resultObj); + goodsSubClassService.updateByPrimaryKeySelective(resultObj); JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("鎿嶄綔鎴愬姛")); @@ -442,51 +291,6 @@ e.printStackTrace(); JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鎿嶄綔寮傚父")); } - - } - - - /** - * 淇敼鎺掑簭 - * - * @param callback - * @param goodsClass - * @param out - */ - @RequestMapping(value = "saveState") - public void saveState(String callback, Long id, PrintWriter out) { - - try { - - if (id == null) { - JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("涓嶅瓨鍦ㄨ绫诲埆")); - return; - } - - GoodsSubClass resultObj = goodsSubClassService.selectByPrimaryKey(id); - if (resultObj == null) { - JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("涓嶅瓨鍦ㄨ绫诲埆")); - return; - } - - Integer state = resultObj.getState(); - if (state.equals(1) || state == 1) { - state = 0; - } else { - state = 1; - } - - resultObj.setState(state); - resultObj.setUpdatetime(new Date()); - goodsSubClassService.updateByPrimaryKeySelective(resultObj); - - JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(state)); - - } catch (Exception e) { - e.printStackTrace(); - JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鎿嶄綔寮傚父")); - } - } } diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/GoodsClassController.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/GoodsClassController.java index 8787cb4..bf7dbed 100644 --- a/fanli/src/main/java/com/yeshi/fanli/controller/client/GoodsClassController.java +++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/GoodsClassController.java @@ -192,7 +192,12 @@ goodsClass.setIosClick(1L); } } - goodsClassService.updateByPrimaryKeySelective(goodsClass); + + GoodsClass gc = new GoodsClass(); + gc.setId(goodsClass.getId()); + gc.setIosClick(goodsClass.getIosClick()); + gc.setAndroidClick(goodsClass.getAndroidClick()); + goodsClassService.updateByPrimaryKeySelective(gc); } }); @@ -755,7 +760,7 @@ if (meterialId > 0) result = TaoKeApiUtil.getMaterialByMaterialId(meterialId, page, 20); else - result = TaoKeApiUtil.searchCouple(goodsClassService.getKwById(id), null, page, 20); + result = TaoKeApiUtil.searchCouple(goodsClassService.getKeysById(id), null, page, 20); List<TaoBaoSearchNav> navList = TaoBaoUtil.getBaseNav(); if (result.getNavList() != null) diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/h5/H5SearchController.java b/fanli/src/main/java/com/yeshi/fanli/controller/h5/H5SearchController.java index 57915fb..c2fb565 100644 --- a/fanli/src/main/java/com/yeshi/fanli/controller/h5/H5SearchController.java +++ b/fanli/src/main/java/com/yeshi/fanli/controller/h5/H5SearchController.java @@ -5,17 +5,14 @@ import java.util.ArrayList; import java.util.HashSet; import java.util.List; -import java.util.Map; import java.util.Set; import javax.annotation.Resource; -import net.sf.json.JSONArray; -import net.sf.json.JSONObject; - import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; +import org.yeshi.utils.JsonUtil; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -28,13 +25,16 @@ import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBriefExtra; import com.yeshi.fanli.entity.taobao.TaoBaoSearchNav; import com.yeshi.fanli.entity.taobao.TaoBaoSearchResult; +import com.yeshi.fanli.service.inter.config.CustomerContentService; import com.yeshi.fanli.service.inter.config.SuperHotSearchService; import com.yeshi.fanli.service.inter.config.SystemClientParamsService; import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService; import com.yeshi.fanli.service.inter.user.HistorySearchService; import com.yeshi.fanli.util.StringUtil; import com.yeshi.fanli.util.taobao.TaoBaoUtil; -import org.yeshi.utils.JsonUtil; + +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; @Controller @RequestMapping("api/h5/v1/webSearch") @@ -54,6 +54,9 @@ @Resource private SuperHotSearchService superHotSearchSerivce; + + @Resource + private CustomerContentService customerContentService; // 浼樻儬鍒� /* @@ -276,7 +279,7 @@ @RequestMapping(value = "contactCustomer", method = RequestMethod.GET) public void contactCustomerService(PrintWriter out) { String title = "鑱旂郴瀹㈡湇"; - List<CustomerContent> contentList = systemClientParamsService.contactCustomerService(title); + List<CustomerContent> contentList = customerContentService.contactCustomerService(title); JSONObject data = new JSONObject(); data.put("contentList", JsonUtil.getSimpleGsonWithDate().toJson(contentList)); out.print(JsonUtil.loadTrueResult(data)); diff --git a/fanli/src/main/java/com/yeshi/fanli/dao/goods/GoodsClassDao.java b/fanli/src/main/java/com/yeshi/fanli/dao/goods/GoodsClassDao.java deleted file mode 100644 index a2cb180..0000000 --- a/fanli/src/main/java/com/yeshi/fanli/dao/goods/GoodsClassDao.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.yeshi.fanli.dao.goods; - -import org.springframework.stereotype.Repository; - -import com.yeshi.fanli.dao.BaseDao; -import com.yeshi.fanli.entity.bus.clazz.GoodsClass; - -@Repository -public class GoodsClassDao extends BaseDao<GoodsClass> { - -} diff --git a/fanli/src/main/java/com/yeshi/fanli/dao/goods/GoodsSecondClassDao.java b/fanli/src/main/java/com/yeshi/fanli/dao/goods/GoodsSecondClassDao.java deleted file mode 100644 index 2d69898..0000000 --- a/fanli/src/main/java/com/yeshi/fanli/dao/goods/GoodsSecondClassDao.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.yeshi.fanli.dao.goods; - -import org.springframework.stereotype.Repository; - -import com.yeshi.fanli.dao.BaseDao; -import com.yeshi.fanli.entity.bus.clazz.GoodsSecondClass; - -@Repository -public class GoodsSecondClassDao extends BaseDao<GoodsSecondClass> { - -} diff --git a/fanli/src/main/java/com/yeshi/fanli/dao/goods/SuperGoodsClassDao.java b/fanli/src/main/java/com/yeshi/fanli/dao/goods/SuperGoodsClassDao.java deleted file mode 100644 index 11105f1..0000000 --- a/fanli/src/main/java/com/yeshi/fanli/dao/goods/SuperGoodsClassDao.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.yeshi.fanli.dao.goods; - -import org.springframework.stereotype.Repository; - -import com.yeshi.fanli.dao.BaseDao; -import com.yeshi.fanli.entity.bus.su.clazz.SuperGoodsClass; - -@Repository -public class SuperGoodsClassDao extends BaseDao<SuperGoodsClass> { - -} diff --git a/fanli/src/main/java/com/yeshi/fanli/dao/mybatis/GoodsClassMapper.java b/fanli/src/main/java/com/yeshi/fanli/dao/mybatis/GoodsClassMapper.java index f03d5bd..fb5790e 100644 --- a/fanli/src/main/java/com/yeshi/fanli/dao/mybatis/GoodsClassMapper.java +++ b/fanli/src/main/java/com/yeshi/fanli/dao/mybatis/GoodsClassMapper.java @@ -4,18 +4,33 @@ import org.apache.ibatis.annotations.Param; +import com.yeshi.fanli.dao.BaseMapper; import com.yeshi.fanli.entity.bus.clazz.GoodsClass; -public interface GoodsClassMapper { +public interface GoodsClassMapper extends BaseMapper<GoodsClass>{ - String getKwById(Long id); + /** + * 鏌ヨ鎼滅储鍏抽敭璇� + * @param id + * @return + */ + String getKeysById(Long id); - GoodsClass selectByPrimaryKey(Long id); - // 鏌ヨ鎵�鏈� - List<GoodsClass> queryAll(); + /** + * 鏍规嵁鍚嶇О妯$硦鎼滅储 + * @param id + * @return + */ + List<GoodsClass> listByName(@Param("start") long start, @Param("count") int count, @Param("name")String name); - int updateByPrimaryKeySelective(GoodsClass record); + + /** + * 鏍规嵁鍚嶇О妯$硦鎼滅储 + * @param id + * @return + */ + int countByName(@Param("name")String name, @Param("systemId")Long systemId); /** * 鏍规嵁绯荤粺id鏌ヨ鍒嗙被 @@ -23,4 +38,21 @@ * @return */ List<GoodsClass> listGoodsClassBySystemId(@Param("systemId") Long systemId); + + /** + * 鏍规嵁鎺掑簭鏌ヨ + * @param orderby + * @return + */ + GoodsClass getByAdjoinOrder(@Param("order") Integer order, @Param("type") Integer type); + + + List<GoodsClass> getGoodsClassAll(); + + /** + * 鑾峰彇鏈�澶ф帓搴忓�� + * @return + */ + int getMaxOrder(); + } diff --git a/fanli/src/main/java/com/yeshi/fanli/dao/mybatis/GoodsSecondClassMapper.java b/fanli/src/main/java/com/yeshi/fanli/dao/mybatis/GoodsSecondClassMapper.java new file mode 100644 index 0000000..74dd530 --- /dev/null +++ b/fanli/src/main/java/com/yeshi/fanli/dao/mybatis/GoodsSecondClassMapper.java @@ -0,0 +1,31 @@ +package com.yeshi.fanli.dao.mybatis; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; + +import com.yeshi.fanli.dao.BaseMapper; +import com.yeshi.fanli.entity.bus.clazz.GoodsSecondClass; + +public interface GoodsSecondClassMapper extends BaseMapper<GoodsSecondClass>{ + + /** + * 鏍规嵁涓婄骇鍒嗙被ID鏌ヨ + * @param pid + * @return + */ + List<GoodsSecondClass> getByGoodsClassId(@Param("pid") Long pid); + + /** + * 鏍规嵁涓婄骇鍒嗙被ID鏌ヨ + * @param pid + * @return + */ + List<GoodsSecondClass> getByNameAndGoodsClassId(@Param("start") long start, @Param("count") int count, + @Param("pid") Long pid, @Param("name") String name); + + + int countByNameAndGoodsClassId(@Param("pid") Long pid, @Param("name") String name); + + +} \ No newline at end of file diff --git a/fanli/src/main/java/com/yeshi/fanli/dao/mybatis/SuperGoodsClassMapper.java b/fanli/src/main/java/com/yeshi/fanli/dao/mybatis/SuperGoodsClassMapper.java new file mode 100644 index 0000000..338dade --- /dev/null +++ b/fanli/src/main/java/com/yeshi/fanli/dao/mybatis/SuperGoodsClassMapper.java @@ -0,0 +1,58 @@ +package com.yeshi.fanli.dao.mybatis; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; + +import com.yeshi.fanli.dao.BaseMapper; +import com.yeshi.fanli.entity.bus.su.clazz.SuperGoodsClass; + +public interface SuperGoodsClassMapper extends BaseMapper<SuperGoodsClass>{ + + + + /** + * 鏍规嵁绯荤粺id + * @param id + * @return + */ + List<SuperGoodsClass> listBySystemId(@Param("systemId") Long systemId); + + /** + * 鏍规嵁鍒嗙被id 鎵归噺鏌ヨ + * @param list + * @return + */ + List<SuperGoodsClass> listByGoodsclassIds(@Param("list") List<Long> list); + + + /** + * 鏍规嵁绯荤粺id 鍒嗙被鍚嶇О妯$硦鏌ヨ + * @param start + * @param count + * @param name + * @param systemId + * @return + */ + List<SuperGoodsClass> listBySystemIdAmdClassName(@Param("start") long start, @Param("count") int count, + @Param("name")String name, @Param("systemId") Long systemId); + + + /** + * 鏍规嵁鍒嗙被id 鍒犻櫎 + * @param goodsClassId + * @param systemId + * @return + */ + void deleteByClassId(@Param("goodsClassId")Long goodsClassId); + + + /** + * 鏍规嵁绯荤粺id 鍜屽垎绫籭d 鍒犻櫎 + * @param goodsClassId + * @param systemId + * @return + */ + Integer deleteBySystemIdAndClassId(@Param("goodsClassId")Long goodsClassId, @Param("systemId") Long systemId); + +} diff --git a/fanli/src/main/java/com/yeshi/fanli/entity/bus/clazz/GoodsClass.java b/fanli/src/main/java/com/yeshi/fanli/entity/bus/clazz/GoodsClass.java index 749f84e..89d06d5 100644 --- a/fanli/src/main/java/com/yeshi/fanli/entity/bus/clazz/GoodsClass.java +++ b/fanli/src/main/java/com/yeshi/fanli/entity/bus/clazz/GoodsClass.java @@ -3,13 +3,8 @@ import java.io.Serializable; import java.util.List; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; -import javax.persistence.Transient; +import org.yeshi.utils.mybatis.Column; +import org.yeshi.utils.mybatis.Table; import com.yeshi.fanli.entity.system.BusinessSystem; @@ -18,60 +13,63 @@ * * @author Administrator * - * */ -@Entity -@Table(name = "yeshi_ec_class") -public class GoodsClass implements Serializable{ +@Table("yeshi_ec_class") +public class GoodsClass implements Serializable { + /** * */ private static final long serialVersionUID = 1L; - @Id - @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "id") - private long id; + private Long id; - @Column(name = "`name`", length = 50) + @Column(name = "name") private String name; - @Column(name = "`picture`", length = 1024) + @Column(name = "picture") private String picture; + @Column(name = "url") private String url; - @Column(name = "`key`", length = 50) + @Column(name = "key") private String key; - - @Column(name = "`search_param`", length = 1024) + @Column(name = "search_param") private String searchParam; -// @Column(name = "`tbcates`", length = 1024) -// private String tbCates; - - private int orderby; + @Column(name = "orderby") + private Integer orderby; - private long createtime; + @Column(name = "createtime") + private Long createtime; @Column(name = "ios_click") - private Long iosClick = 0l; + private Long iosClick; @Column(name = "android_click") - private Long androidClick = 0l; + private Long androidClick; - @Transient // 鐐瑰嚮娆℃暟 + + // 鐐瑰嚮娆℃暟 private Long countClick = 0l; - - @Transient // 鍏宠仈鏍囩鏁伴噺 + // 鍏宠仈鏍囩鏁伴噺 private int countlabel = 0; - - @Transient // 绯荤粺鍏宠仈鍒楄〃 + // 绯荤粺鍏宠仈鍒楄〃 private List<BusinessSystem> systemList; + + public GoodsClass() { + } - public GoodsClass(String name, String picture, int orderby, long createtime) { + public GoodsClass(Long id) { + super(); + this.id = id; + } + + public GoodsClass(String name, String picture, Integer orderby, Long createtime) { super(); this.name = name; this.picture = picture; @@ -79,19 +77,11 @@ this.createtime = createtime; } - public GoodsClass() { - } - - public GoodsClass(long id) { - super(); - this.id = id; - } - - public long getId() { + public Long getId() { return id; } - public void setId(long id) { + public void setId(Long id) { this.id = id; } @@ -101,14 +91,6 @@ public void setName(String name) { this.name = name; - } - - public String getKey() { - return key; - } - - public void setKey(String key) { - this.key = key; } public String getPicture() { @@ -127,19 +109,35 @@ this.url = url; } - public int getOrderby() { + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public String getSearchParam() { + return searchParam; + } + + public void setSearchParam(String searchParam) { + this.searchParam = searchParam; + } + + public Integer getOrderby() { return orderby; } - public void setOrderby(int orderby) { + public void setOrderby(Integer orderby) { this.orderby = orderby; } - public long getCreatetime() { + public Long getCreatetime() { return createtime; } - public void setCreatetime(long createtime) { + public void setCreatetime(Long createtime) { this.createtime = createtime; } @@ -167,14 +165,6 @@ this.countClick = countClick; } - public List<BusinessSystem> getSystemList() { - return systemList; - } - - public void setSystemList(List<BusinessSystem> systemList) { - this.systemList = systemList; - } - public int getCountlabel() { return countlabel; } @@ -183,13 +173,12 @@ this.countlabel = countlabel; } - public String getSearchParam() { - return searchParam; + public List<BusinessSystem> getSystemList() { + return systemList; } - public void setSearchParam(String searchParam) { - this.searchParam = searchParam; + public void setSystemList(List<BusinessSystem> systemList) { + this.systemList = systemList; } - } diff --git a/fanli/src/main/java/com/yeshi/fanli/entity/bus/clazz/GoodsSecondClass.java b/fanli/src/main/java/com/yeshi/fanli/entity/bus/clazz/GoodsSecondClass.java index 1c03c1a..bb81859 100644 --- a/fanli/src/main/java/com/yeshi/fanli/entity/bus/clazz/GoodsSecondClass.java +++ b/fanli/src/main/java/com/yeshi/fanli/entity/bus/clazz/GoodsSecondClass.java @@ -1,14 +1,7 @@ package com.yeshi.fanli.entity.bus.clazz; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.FetchType; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import javax.persistence.Table; +import org.yeshi.utils.mybatis.Column; +import org.yeshi.utils.mybatis.Table; import com.google.gson.annotations.Expose; @@ -18,27 +11,32 @@ * @author Administrator * */ -@Entity -@Table(name = "yeshi_ec_second_class") +@Table("yeshi_ec_second_class") public class GoodsSecondClass { - @Id - @GeneratedValue(strategy = GenerationType.AUTO) + + @Expose @Column(name = "id") + private Long id; + @Expose - private long id; - @Expose - @Column(name = "`name`", length = 50) + @Column(name = "name") private String name; + @Expose - @Column(name = "`picture`", length = 1024) + @Column(name = "picture") private String picture; - private int orderby; - private long createtime; - @ManyToOne(fetch = FetchType.EAGER) - @JoinColumn(name = "pid") + + @Column(name = "pid") private GoodsClass parent; - @Column(name = "`key`", length = 10) + + @Column(name = "key") private String key; + + @Column(name = "orderby") + private Integer orderby; + + @Column(name = "createtime") + private Long createtime; public GoodsSecondClass() { } @@ -57,28 +55,12 @@ this.createtime = createtime; this.parent = parent; } - - public String getKey() { - return key; - } - public void setKey(String key) { - this.key = key; - } - - public GoodsClass getParent() { - return parent; - } - - public void setParent(GoodsClass parent) { - this.parent = parent; - } - - public long getId() { + public Long getId() { return id; } - public void setId(long id) { + public void setId(Long id) { this.id = id; } @@ -98,19 +80,36 @@ this.picture = picture; } - public int getOrderby() { + public GoodsClass getParent() { + return parent; + } + + public void setParent(GoodsClass parent) { + this.parent = parent; + } + + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public Integer getOrderby() { return orderby; } - public void setOrderby(int orderby) { + public void setOrderby(Integer orderby) { this.orderby = orderby; } - public long getCreatetime() { + public Long getCreatetime() { return createtime; } - public void setCreatetime(long createtime) { + public void setCreatetime(Long createtime) { this.createtime = createtime; } + } diff --git a/fanli/src/main/java/com/yeshi/fanli/entity/bus/clazz/GoodsSubClass.java b/fanli/src/main/java/com/yeshi/fanli/entity/bus/clazz/GoodsSubClass.java index b2dbf12..cc5a0f2 100644 --- a/fanli/src/main/java/com/yeshi/fanli/entity/bus/clazz/GoodsSubClass.java +++ b/fanli/src/main/java/com/yeshi/fanli/entity/bus/clazz/GoodsSubClass.java @@ -3,16 +3,8 @@ import java.io.Serializable; import java.util.Date; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.FetchType; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import javax.persistence.Table; -import javax.persistence.Transient; +import org.yeshi.utils.mybatis.Column; +import org.yeshi.utils.mybatis.Table; import com.google.gson.annotations.Expose; @@ -22,104 +14,66 @@ * @author Administrator * */ -@Entity -@Table(name = "yeshi_ec_sub_class") -@org.yeshi.utils.mybatis.Table("yeshi_ec_sub_class") -public class GoodsSubClass implements Serializable{ - /** - * - */ - private static final long serialVersionUID = 1L; +@Table("yeshi_ec_sub_class") +public class GoodsSubClass implements Serializable { - @Id @Expose @Column(name = "sub_id") - @GeneratedValue(strategy = GenerationType.AUTO) - @org.yeshi.utils.mybatis.Column(name="sub_id") private Long id; @Expose @Column(name = "sub_name") - @org.yeshi.utils.mybatis.Column(name="sub_name") private String name; // 鍚嶇О @Expose @Column(name = "sub_picture") - @org.yeshi.utils.mybatis.Column(name="sub_picture") private String picture; // 鍥剧墖璺緞 - @Expose @Column(name = "sub_weight") - @org.yeshi.utils.mybatis.Column(name="sub_weight") private Integer weight; // 鏉冮噸-鎺掑簭 - @Expose @Column(name = "sub_state") - @org.yeshi.utils.mybatis.Column(name="sub_state") private Integer state; // 鐘舵�� 1鍚敤 0鍋滅敤 - @ManyToOne(fetch = FetchType.EAGER) - @JoinColumn(name = "sub_root_id") - @org.yeshi.utils.mybatis.Column(name="sub_root_id") + @Column(name = "sub_root_id") private GoodsClass rootClass; // 涓�绾х被鍒� - @ManyToOne(fetch = FetchType.EAGER) - @JoinColumn(name = "sub_pid") - @org.yeshi.utils.mybatis.Column(name="sub_pid") + @Column(name = "sub_pid") private GoodsSubClass parent ; // 涓婄骇锛氬搴旂殑浜岀骇浠ヤ笅鍒嗙被 鐢ㄤ簬3绾с��4绾с��5绾� - - @Expose @Column(name = "sub_level") - @org.yeshi.utils.mybatis.Column(name="sub_level") private Integer level; // 鍏蜂綋绛夌骇 - @Expose @Column(name = "sub_key") - @org.yeshi.utils.mybatis.Column(name="sub_key") private String key; // 鎼滅储鍏抽敭璇� - - @Expose @Column(name = "sub_search_json") - @org.yeshi.utils.mybatis.Column(name="sub_search_json") private String searchJson; // 鎼滅储鏉′欢 - - @Expose @Column(name = "sub_ios_click") - @org.yeshi.utils.mybatis.Column(name="sub_ios_click") private Long iosClick = 0l; - @Expose @Column(name = "sub_android_click") - @org.yeshi.utils.mybatis.Column(name="sub_android_click") private Long androidClick = 0l; - @Expose @Column(name = "sub_createtime") - @org.yeshi.utils.mybatis.Column(name="sub_createtime") private Date createtime; // 鍒涘缓鏃堕棿 - @Expose @Column(name = "sub_updatetime") - @org.yeshi.utils.mybatis.Column(name="sub_updatetime") private Date updatetime; // 鍒涘缓鏃堕棿 - @Transient - private Long CountClick = 0l; - @Transient // 鍏宠仈鏍囩鏁伴噺 + + private Long countClick = 0l; + // 鍏宠仈鏍囩鏁伴噺 private int countlabel = 0; + private String searchParam; public GoodsSubClass(){} public GoodsSubClass(Long id) { this.id = id; } - - - public Long getId() { @@ -195,14 +149,6 @@ this.androidClick = androidClick; } - public Long getCountClick() { - return CountClick; - } - - public void setCountClick(Long countClick) { - CountClick = countClick; - } - public Integer getLevel() { return level; } @@ -250,5 +196,21 @@ public void setState(Integer state) { this.state = state; } + + public String getSearchParam() { + return searchParam; + } + + public void setSearchParam(String searchParam) { + this.searchParam = searchParam; + } + + public Long getCountClick() { + return countClick; + } + + public void setCountClick(Long countClick) { + this.countClick = countClick; + } } diff --git a/fanli/src/main/java/com/yeshi/fanli/entity/bus/clazz/TaoBaoClass.java b/fanli/src/main/java/com/yeshi/fanli/entity/bus/clazz/TaoBaoClass.java index ed1e658..284b70c 100644 --- a/fanli/src/main/java/com/yeshi/fanli/entity/bus/clazz/TaoBaoClass.java +++ b/fanli/src/main/java/com/yeshi/fanli/entity/bus/clazz/TaoBaoClass.java @@ -2,12 +2,8 @@ import java.util.Date; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; +import org.yeshi.utils.mybatis.Column; +import org.yeshi.utils.mybatis.Table; import com.google.gson.annotations.Expose; @@ -17,40 +13,31 @@ * @author yj * */ -@Entity -@Table(name = "yeshi_ec_taobao_class") -@org.yeshi.utils.mybatis.Table("yeshi_ec_taobao_class") +@Table("yeshi_ec_taobao_class") public class TaoBaoClass { - @Id + @Expose @Column(name = "tc_id") - @GeneratedValue(strategy = GenerationType.AUTO) - @org.yeshi.utils.mybatis.Column(name="tc_id") private Long id; @Expose @Column(name = "tc_category_id") - @org.yeshi.utils.mybatis.Column(name="tc_category_id") private Integer categoryId; // 鍒嗙被id @Expose @Column(name = "tc_category_name") - @org.yeshi.utils.mybatis.Column(name="tc_category_name") private String categoryName; // 娣樺疂鍒嗙被鍚嶇О @Expose @Column(name = "tc_parent_category_id") - @org.yeshi.utils.mybatis.Column(name="tc_parent_category_id") private Integer parentCategoryId; // 涓婄骇娣樺疂鍒嗙被id @Expose @Column(name = "tc_createtime") - @org.yeshi.utils.mybatis.Column(name="tc_createtime") private Date createtime; // 鍒涘缓鏃堕棿 @Expose @Column(name = "tc_updatetime") - @org.yeshi.utils.mybatis.Column(name="tc_updatetime") private Date updatetime; // 鏇存柊鏃堕棿 diff --git a/fanli/src/main/java/com/yeshi/fanli/entity/bus/clazz/TaoBaoClassRelation.java b/fanli/src/main/java/com/yeshi/fanli/entity/bus/clazz/TaoBaoClassRelation.java index a2e81ac..ef1c275 100644 --- a/fanli/src/main/java/com/yeshi/fanli/entity/bus/clazz/TaoBaoClassRelation.java +++ b/fanli/src/main/java/com/yeshi/fanli/entity/bus/clazz/TaoBaoClassRelation.java @@ -2,13 +2,8 @@ import java.util.Date; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.Table; +import org.yeshi.utils.mybatis.Column; +import org.yeshi.utils.mybatis.Table; import com.google.gson.annotations.Expose; @@ -18,42 +13,32 @@ * @author yj * */ -@Entity -@Table(name = "yeshi_ec_taobao_class_mapper") -@org.yeshi.utils.mybatis.Table("yeshi_ec_taobao_class_mapper") +@Table("yeshi_ec_taobao_class_mapper") public class TaoBaoClassRelation { - @Id + @Expose @Column(name = "tm_id") - @GeneratedValue(strategy = GenerationType.AUTO) - @org.yeshi.utils.mybatis.Column(name="tm_id") private Long id; @Expose @Column(name = "tm_system_cid") - @org.yeshi.utils.mybatis.Column(name="tm_system_cid") private Long cid; // 鏈郴缁熶竴绾х被鐩甶d @Expose @Column(name = "tm_system_sub_cid") - @org.yeshi.utils.mybatis.Column(name="tm_system_sub_cid") private Long subId; //鏈郴缁熶簩绾х被鐩甶d @Expose @Column(name = "tm_taobao_cid") - @org.yeshi.utils.mybatis.Column(name="tm_taobao_cid") private Long taobaoCid; // 娣樺疂绫荤洰id - @JoinColumn(name = "tm_weight") - @org.yeshi.utils.mybatis.Column(name = "tm_weight") + @Column(name = "tm_weight") private Double weight; // 鏉冮噸 - @JoinColumn(name = "tm_createtime") - @org.yeshi.utils.mybatis.Column(name = "tm_createtime") + @Column(name = "tm_createtime") private Date createtime; // 鍒涘缓鏃堕棿 - @JoinColumn(name = "tm_updatetime") - @org.yeshi.utils.mybatis.Column(name = "tm_updatetime") + @Column(name = "tm_updatetime") private Date updatetime; // 鏇存柊鏃堕棿锛堜慨鏀规椂闂达級 diff --git a/fanli/src/main/java/com/yeshi/fanli/entity/bus/homemodule/SuperHomeNavbar.java b/fanli/src/main/java/com/yeshi/fanli/entity/bus/homemodule/SuperHomeNavbar.java index abc2608..d6d487c 100644 --- a/fanli/src/main/java/com/yeshi/fanli/entity/bus/homemodule/SuperHomeNavbar.java +++ b/fanli/src/main/java/com/yeshi/fanli/entity/bus/homemodule/SuperHomeNavbar.java @@ -2,15 +2,8 @@ import java.io.Serializable; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.FetchType; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import javax.persistence.Table; +import org.yeshi.utils.mybatis.Column; +import org.yeshi.utils.mybatis.Table; import com.yeshi.fanli.entity.system.BusinessSystem; @@ -21,29 +14,20 @@ * * @date 2018骞�10鏈�24鏃� */ -@Entity -@Table(name = "yeshi_ec_super_homenavbar") -@org.yeshi.utils.mybatis.Table("yeshi_ec_super_homenavbar") +@Table("yeshi_ec_super_homenavbar") public class SuperHomeNavbar implements Serializable { private static final long serialVersionUID = 1L; - @Id @Column(name = "sp_id") - @GeneratedValue(strategy = GenerationType.AUTO) - @org.yeshi.utils.mybatis.Column(name = "sp_id") private Long id; // 瀵艰埅鏍廼d - @ManyToOne(fetch = FetchType.EAGER) - @JoinColumn(name = "sp_navbar_id") - @org.yeshi.utils.mybatis.Column(name = "sp_navbar_id") + @Column(name = "sp_navbar_id") private HomeNavbar homeNavbar; // 绯荤粺id - @ManyToOne(fetch = FetchType.EAGER) - @JoinColumn(name = "sp_system_id") - @org.yeshi.utils.mybatis.Column(name = "sp_system_id") + @Column(name = "sp_system_id") private BusinessSystem system; public Long getId() { diff --git a/fanli/src/main/java/com/yeshi/fanli/entity/bus/lable/BoutiqueAutoRule.java b/fanli/src/main/java/com/yeshi/fanli/entity/bus/lable/BoutiqueAutoRule.java index 2ea870c..1163d65 100644 --- a/fanli/src/main/java/com/yeshi/fanli/entity/bus/lable/BoutiqueAutoRule.java +++ b/fanli/src/main/java/com/yeshi/fanli/entity/bus/lable/BoutiqueAutoRule.java @@ -1,6 +1,7 @@ package com.yeshi.fanli.entity.bus.lable; +import java.io.Serializable; import java.util.Date; import org.springframework.format.annotation.DateTimeFormat; @@ -18,7 +19,12 @@ * @date 2018骞�8鏈�2鏃� */ @Table("yeshi_ec_boutique_auto_rule") -public class BoutiqueAutoRule { +public class BoutiqueAutoRule implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 1L; // 娣樺疂鐗╂枡API public final static int TB_OPTIONAL = 1; diff --git a/fanli/src/main/java/com/yeshi/fanli/entity/bus/lable/Label.java b/fanli/src/main/java/com/yeshi/fanli/entity/bus/lable/Label.java index f5e98ff..a0d1e18 100644 --- a/fanli/src/main/java/com/yeshi/fanli/entity/bus/lable/Label.java +++ b/fanli/src/main/java/com/yeshi/fanli/entity/bus/lable/Label.java @@ -1,5 +1,6 @@ package com.yeshi.fanli.entity.bus.lable; +import java.io.Serializable; import java.util.Date; import org.yeshi.utils.mybatis.Column; @@ -15,8 +16,13 @@ * @date 2018骞�6鏈�27鏃� */ @Table("yeshi_ec_label") -public class Label { +public class Label implements Serializable { + /** + * + */ + private static final long serialVersionUID = 1L; + // 鍚庡彴褰曞叆 public final static int MODE_BACKSTAGE = 1; // excel瀵煎叆 diff --git a/fanli/src/main/java/com/yeshi/fanli/entity/bus/lable/MergeClass.java b/fanli/src/main/java/com/yeshi/fanli/entity/bus/lable/MergeClass.java index cb45339..856c4ca 100644 --- a/fanli/src/main/java/com/yeshi/fanli/entity/bus/lable/MergeClass.java +++ b/fanli/src/main/java/com/yeshi/fanli/entity/bus/lable/MergeClass.java @@ -1,19 +1,9 @@ package com.yeshi.fanli.entity.bus.lable; -import java.io.Serializable; import java.util.Date; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.FetchType; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import javax.persistence.Table; - -import com.yeshi.fanli.entity.common.AdminUser; +import org.yeshi.utils.mybatis.Column; +import org.yeshi.utils.mybatis.Table; /** * 9k9缁勫悎绫� @@ -22,41 +12,25 @@ * * @date 2018骞�6鏈�27鏃� */ -@Entity -@Table(name = "yeshi_ec_class_9k9") -@org.yeshi.utils.mybatis.Table("yeshi_ec_class_9k9") -public class MergeClass implements Serializable{ +@Table("yeshi_ec_class_9k9") +public class MergeClass { - - /** - * - */ - private static final long serialVersionUID = 1L; - - @Id @Column(name = "k_id") - @GeneratedValue(strategy = GenerationType.AUTO) - @org.yeshi.utils.mybatis.Column(name = "k_id") private Long id; - @JoinColumn(name = "k_name") - @org.yeshi.utils.mybatis.Column(name = "k_name") + @Column(name = "k_name") private String name;// 鍚嶇О - @JoinColumn(name = "k_merge_cid") - @org.yeshi.utils.mybatis.Column(name = "k_merge_cid") + @Column(name = "k_merge_cid") private String mergeCids; // 绯荤粺绫籭d(閫楀彿闅斿紑) - @JoinColumn(name = "k_weight") - @org.yeshi.utils.mybatis.Column(name = "k_weight") + @Column(name = "k_weight") private Double weight; // 鏉冮噸 - @JoinColumn(name = "k_createtime") - @org.yeshi.utils.mybatis.Column(name = "k_createtime") + @Column(name = "k_createtime") private Date createtime; // 鍒涘缓鏃堕棿 - @JoinColumn(name = "k_updatetime") - @org.yeshi.utils.mybatis.Column(name = "k_updatetime") + @Column(name = "k_updatetime") private Date updatetime; // 鏇存柊鏃堕棿锛堜慨鏀规椂闂达級 diff --git a/fanli/src/main/java/com/yeshi/fanli/entity/bus/lable/QualityFactory.java b/fanli/src/main/java/com/yeshi/fanli/entity/bus/lable/QualityFactory.java index f2fc235..331e215 100644 --- a/fanli/src/main/java/com/yeshi/fanli/entity/bus/lable/QualityFactory.java +++ b/fanli/src/main/java/com/yeshi/fanli/entity/bus/lable/QualityFactory.java @@ -1,5 +1,6 @@ package com.yeshi.fanli.entity.bus.lable; +import java.io.Serializable; import java.util.Date; import org.yeshi.utils.mybatis.Column; @@ -16,7 +17,12 @@ * @date 2018骞�7鏈�3鏃� */ @Table("yeshi_ec_quality_factory") -public class QualityFactory { +public class QualityFactory implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 1L; // 浜哄伐绛涢�夊叆搴� public final static int MODE_MANUAL = 1; diff --git a/fanli/src/main/java/com/yeshi/fanli/entity/bus/lable/QualityFlashSale.java b/fanli/src/main/java/com/yeshi/fanli/entity/bus/lable/QualityFlashSale.java index 4dded14..5305479 100644 --- a/fanli/src/main/java/com/yeshi/fanli/entity/bus/lable/QualityFlashSale.java +++ b/fanli/src/main/java/com/yeshi/fanli/entity/bus/lable/QualityFlashSale.java @@ -1,5 +1,6 @@ package com.yeshi.fanli.entity.bus.lable; +import java.io.Serializable; import java.util.Date; import org.yeshi.utils.mybatis.Column; @@ -13,9 +14,14 @@ * @date 2018骞�9鏈�18鏃� */ @Table("yeshi_ec_quality_flash_sale") -public class QualityFlashSale { +public class QualityFlashSale implements Serializable{ + /** + * + */ + private static final long serialVersionUID = 1L; + @Column(name = "fs_id") private Long id; diff --git a/fanli/src/main/java/com/yeshi/fanli/entity/bus/su/clazz/SuperGoodsClass.java b/fanli/src/main/java/com/yeshi/fanli/entity/bus/su/clazz/SuperGoodsClass.java index 637e56a..bd0ca87 100644 --- a/fanli/src/main/java/com/yeshi/fanli/entity/bus/su/clazz/SuperGoodsClass.java +++ b/fanli/src/main/java/com/yeshi/fanli/entity/bus/su/clazz/SuperGoodsClass.java @@ -1,54 +1,41 @@ package com.yeshi.fanli.entity.bus.su.clazz; -import java.io.Serializable; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.FetchType; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import javax.persistence.Table; +import org.yeshi.utils.mybatis.Column; +import org.yeshi.utils.mybatis.Table; import com.yeshi.fanli.entity.bus.clazz.GoodsClass; import com.yeshi.fanli.entity.system.BusinessSystem; -@Entity -@Table(name = "yeshi_ec_super_goodsclass") -public class SuperGoodsClass implements Serializable{ - /** - * - */ - private static final long serialVersionUID = 1L; - - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) +@Table("yeshi_ec_super_goodsclass") +public class SuperGoodsClass { + @Column(name = "id") - private long id; - @ManyToOne(fetch = FetchType.EAGER) - @JoinColumn(name = "goodsclass_id") + private Long id; + + @Column(name = "goodsclass_id") private GoodsClass goodsClass; - @ManyToOne(fetch = FetchType.EAGER) - @JoinColumn(name = "system_id") + + @Column(name = "system_id") private BusinessSystem system; + + public SuperGoodsClass() { } - + public SuperGoodsClass(GoodsClass goodsClass, BusinessSystem system) { super(); this.goodsClass = goodsClass; this.system = system; } + + - public long getId() { + public Long getId() { return id; } - public void setId(long id) { + public void setId(Long id) { this.id = id; } diff --git a/fanli/src/main/java/com/yeshi/fanli/exception/GoodsClassException.java b/fanli/src/main/java/com/yeshi/fanli/exception/GoodsClassException.java new file mode 100644 index 0000000..48ae2d0 --- /dev/null +++ b/fanli/src/main/java/com/yeshi/fanli/exception/GoodsClassException.java @@ -0,0 +1,32 @@ +package com.yeshi.fanli.exception; + +public class GoodsClassException extends Exception { + /** + * + */ + private static final long serialVersionUID = 1L; + private int code; + private String msg; + + public int getCode() { + return code; + } + + public String getMsg() { + return msg; + } + + public GoodsClassException(int code, String msg) { + this.code = code; + this.msg = msg; + } + + public GoodsClassException() { + } + + @Override + public String getMessage() { + return this.msg; + } + +} diff --git a/fanli/src/main/java/com/yeshi/fanli/exception/GoodsSubClassException.java b/fanli/src/main/java/com/yeshi/fanli/exception/GoodsSubClassException.java new file mode 100644 index 0000000..6a64915 --- /dev/null +++ b/fanli/src/main/java/com/yeshi/fanli/exception/GoodsSubClassException.java @@ -0,0 +1,32 @@ +package com.yeshi.fanli.exception; + +public class GoodsSubClassException extends Exception { + /** + * + */ + private static final long serialVersionUID = 1L; + private int code; + private String msg; + + public int getCode() { + return code; + } + + public String getMsg() { + return msg; + } + + public GoodsSubClassException(int code, String msg) { + this.code = code; + this.msg = msg; + } + + public GoodsSubClassException() { + } + + @Override + public String getMessage() { + return this.msg; + } + +} diff --git a/fanli/src/main/java/com/yeshi/fanli/mapping/GoodsClassMapper.xml b/fanli/src/main/java/com/yeshi/fanli/mapping/GoodsClassMapper.xml index 4b5d74b..3addf0c 100644 --- a/fanli/src/main/java/com/yeshi/fanli/mapping/GoodsClassMapper.xml +++ b/fanli/src/main/java/com/yeshi/fanli/mapping/GoodsClassMapper.xml @@ -1,32 +1,72 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> + <mapper namespace="com.yeshi.fanli.dao.mybatis.GoodsClassMapper"> - <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.clazz.GoodsClass"> - <id column="id" property="id" jdbcType="BIGINT"/> - <result column="name" property="name" jdbcType="VARCHAR"/> - <result column="picture" property="picture" jdbcType="VARCHAR"/> - <result column="orderby" property="orderby" jdbcType="INTEGER"/> - <result column="createtime" property="createtime" jdbcType="TIMESTAMP"/> - <result column="url" property="url" jdbcType="VARCHAR"/> - <result column="key" property="key" jdbcType="VARCHAR"/> - <result column="ios_click" property="iosClick" jdbcType="BIGINT"/> - <result column="android_click" property="androidClick" jdbcType="BIGINT"/> - </resultMap> - - <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.clazz.GoodsClass"> - update yeshi_ec_class + <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.clazz.GoodsClass"> + <id column="id" property="id" jdbcType="BIGINT"/> + <result column="name" property="name" jdbcType="VARCHAR"/> + <result column="picture" property="picture" jdbcType="VARCHAR"/> + <result column="url" property="url" jdbcType="VARCHAR"/> + <result column="key" property="key" jdbcType="VARCHAR"/> + <result column="search_param" property="searchParam" jdbcType="VARCHAR"/> + <result column="orderby" property="orderby" jdbcType="INTEGER"/> + <result column="createtime" property="createtime" jdbcType="BIGINT"/> + <result column="ios_click" property="iosClick" jdbcType="BIGINT"/> + <result column="android_click" property="androidClick" jdbcType="BIGINT"/> + </resultMap> + + <sql id="Base_Column_List">id,`name`,picture,`key`,search_param,orderby,createtime,ios_click,android_click</sql> + + <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long"> + select * from yeshi_ec_class where id = #{id,jdbcType=BIGINT} + </select> + <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_class where id = #{id,jdbcType=BIGINT}</delete> + <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.clazz.GoodsClass" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_class (id,`name`,picture,url,`key`,search_param,orderby,createtime,ios_click,android_click) values (#{id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{picture,jdbcType=VARCHAR},#{url,jdbcType=VARCHAR},#{key,jdbcType=VARCHAR},#{searchParam,jdbcType=VARCHAR},#{orderby,jdbcType=INTEGER},#{createtime,jdbcType=BIGINT},#{iosClick,jdbcType=BIGINT},#{androidClick,jdbcType=BIGINT})</insert> + <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.clazz.GoodsClass" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_class + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="id != null">id,</if> + <if test="name != null">`name`,</if> + <if test="picture != null">picture,</if> + <if test="url != null">url,</if> + <if test="key != null">`key`,</if> + <if test="searchParam != null">search_param,</if> + <if test="orderby != null">orderby,</if> + <if test="createtime != null">createtime,</if> + <if test="iosClick != null">ios_click,</if> + <if test="androidClick != null">android_click,</if> + </trim>values + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="id != null">#{id,jdbcType=BIGINT},</if> + <if test="name != null">#{name,jdbcType=VARCHAR},</if> + <if test="picture != null">#{picture,jdbcType=VARCHAR},</if> + <if test="url != null">#{url,jdbcType=VARCHAR},</if> + <if test="key != null">#{key,jdbcType=VARCHAR},</if> + <if test="searchParam != null">#{searchParam,jdbcType=VARCHAR},</if> + <if test="orderby != null">#{orderby,jdbcType=INTEGER},</if> + <if test="createtime != null">#{createtime,jdbcType=BIGINT},</if> + <if test="iosClick != null">#{iosClick,jdbcType=BIGINT},</if> + <if test="androidClick != null">#{androidClick,jdbcType=BIGINT},</if> + </trim> + </insert> + <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.clazz.GoodsClass">update yeshi_ec_class set `name` = #{name,jdbcType=VARCHAR},picture = #{picture,jdbcType=VARCHAR},url = #{url,jdbcType=VARCHAR},`key` = #{key,jdbcType=VARCHAR},search_param = #{searchParam,jdbcType=VARCHAR},orderby = #{orderby,jdbcType=INTEGER},createtime = #{createtime,jdbcType=BIGINT},ios_click = #{iosClick,jdbcType=BIGINT},android_click = #{androidClick,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}</update> + <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.clazz.GoodsClass">update yeshi_ec_class <set> + <if test="name != null">`name`=#{name,jdbcType=VARCHAR},</if> + <if test="picture != null">picture=#{picture,jdbcType=VARCHAR},</if> + <if test="url != null">url=#{url,jdbcType=VARCHAR},</if> + <if test="key != null">`key`=#{key,jdbcType=VARCHAR},</if> + <if test="searchParam != null">search_param=#{searchParam,jdbcType=VARCHAR},</if> + <if test="orderby != null">orderby=#{orderby,jdbcType=INTEGER},</if> + <if test="createtime != null">createtime=#{createtime,jdbcType=BIGINT},</if> <if test="iosClick != null">ios_click=#{iosClick,jdbcType=BIGINT},</if> <if test="androidClick != null">android_click=#{androidClick,jdbcType=BIGINT},</if> </set> where id = #{id,jdbcType=BIGINT} </update> - <select id="getKwById" resultType="String"> + + + <select id="getKeysById" resultType="java.lang.String"> SELECT ec.`key` FROM `yeshi_ec_class` ec WHERE ec.`id` = #{id}; </select> - - <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long"> - select * from yeshi_ec_class where id = #{id,jdbcType=BIGINT} - </select> <select id="listGoodsClassBySystemId" resultMap="BaseResultMap"> SELECT c.id,c.name,c.picture,c.url FROM `yeshi_ec_class` c @@ -35,5 +75,44 @@ ORDER BY c.`orderby` </select> - -</mapper> \ No newline at end of file + <select id="getByAdjoinOrder" resultMap="BaseResultMap"> + SELECT <include refid="Base_Column_List" /> FROM yeshi_ec_class fd + WHERE 1=1 + <if test="type == -1"> + AND fd.`orderby` <![CDATA[<]]> #{order} + ORDER BY fd.`orderby` desc + </if> + + <if test="type == 1"> + AND fd.`orderby` <![CDATA[>]]> #{order} + ORDER BY fd.`orderby` + </if> + LIMIT 1 + </select> + + + <select id="getGoodsClassAll" resultMap="BaseResultMap"> + SELECT * FROM yeshi_ec_class rs ORDER BY rs.`orderby` + </select> + + <select id="listByName" resultMap="BaseResultMap"> + SELECT * from yeshi_ec_class rs + WHERE rs.name like '%#{name}%' + LIMIT ${start},${count} + </select> + + <select id="countByName" resultType="java.lang.Integer"> + SELECT IFNULL(COUNT(rs.id),0) FROM yeshi_ec_class rs + <if test="systemId != null"> + RIGHT JOIN yeshi_ec_super_goodsclass sp ON sp.`goodsclass_id` = rs.`id` + </if> + WHERE rs.name LIKE '%#{name}%' + <if test="systemId != null"> + AND sp.`system_id` = #{systemId} + </if> + </select> + + <select id="getMaxOrder" resultType="java.lang.Integer"> + SELECT IFNULL(MAX(orderby),0) FROM `yeshi_ec_class` + </select> +</mapper> diff --git a/fanli/src/main/java/com/yeshi/fanli/mapping/GoodsSecondClassMapper.xml b/fanli/src/main/java/com/yeshi/fanli/mapping/GoodsSecondClassMapper.xml new file mode 100644 index 0000000..0efbebc --- /dev/null +++ b/fanli/src/main/java/com/yeshi/fanli/mapping/GoodsSecondClassMapper.xml @@ -0,0 +1,73 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> + +<mapper namespace="com.yeshi.fanli.dao.mybatis.GoodsSecondClassMapper"> + <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.clazz.GoodsSecondClass"> + <id column="id" property="id" jdbcType="BIGINT"/> + <result column="name" property="name" jdbcType="VARCHAR"/> + <result column="picture" property="picture" jdbcType="VARCHAR"/> + <result column="key" property="key" jdbcType="VARCHAR"/> + <result column="orderby" property="orderby" jdbcType="INTEGER"/> + <result column="createtime" property="createtime" jdbcType="BIGINT"/> + + <association property="parent" column="pid" javaType="com.yeshi.fanli.entity.bus.clazz.GoodsClass"> + <id column="pid" property="id" jdbcType="BIGINT"/> + </association> + + </resultMap> + <sql id="Base_Column_List">id,name,picture,pid,key,orderby,createtime</sql> + <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select + <include refid="Base_Column_List"/>from yeshi_ec_second_class where id = #{id,jdbcType=BIGINT} + </select> + <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_second_class where id = #{id,jdbcType=BIGINT}</delete> + <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.clazz.GoodsSecondClass" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_second_class (id,name,picture,pid,key,orderby,createtime) values (#{id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{picture,jdbcType=VARCHAR},#{parent.id,jdbcType=BIGINT},#{key,jdbcType=VARCHAR},#{orderby,jdbcType=INTEGER},#{createtime,jdbcType=BIGINT})</insert> + <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.clazz.GoodsSecondClass" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_second_class + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="id != null">id,</if> + <if test="name != null">name,</if> + <if test="picture != null">picture,</if> + <if test="parent != null">pid,</if> + <if test="key != null">key,</if> + <if test="orderby != null">orderby,</if> + <if test="createtime != null">createtime,</if> + </trim>values + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="id != null">#{id,jdbcType=BIGINT},</if> + <if test="name != null">#{name,jdbcType=VARCHAR},</if> + <if test="picture != null">#{picture,jdbcType=VARCHAR},</if> + <if test="parent != null">#{parent.id,jdbcType=BIGINT},</if> + <if test="key != null">#{key,jdbcType=VARCHAR},</if> + <if test="orderby != null">#{orderby,jdbcType=INTEGER},</if> + <if test="createtime != null">#{createtime,jdbcType=BIGINT},</if> + </trim> + </insert> + <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.clazz.GoodsSecondClass">update yeshi_ec_second_class set name = #{name,jdbcType=VARCHAR},picture = #{picture,jdbcType=VARCHAR},pid = #{parent.id,jdbcType=BIGINT},key = #{key,jdbcType=VARCHAR},orderby = #{orderby,jdbcType=INTEGER},createtime = #{createtime,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}</update> + <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.clazz.GoodsSecondClass">update yeshi_ec_second_class + <set> + <if test="name != null">name=#{name,jdbcType=VARCHAR},</if> + <if test="picture != null">picture=#{picture,jdbcType=VARCHAR},</if> + <if test="parent != null">pid=#{parent.id,jdbcType=BIGINT},</if> + <if test="key != null">key=#{key,jdbcType=VARCHAR},</if> + <if test="orderby != null">orderby=#{orderby,jdbcType=INTEGER},</if> + <if test="createtime != null">createtime=#{createtime,jdbcType=BIGINT},</if> + </set> where id = #{id,jdbcType=BIGINT} + </update> + + <select id="getByGoodsClassId" resultMap="BaseResultMap"> + SELECT * FROM `yeshi_ec_second_class` gc + WHERE gc.`pid` = #{pid} + ORDER BY gc.`orderby` + </select> + + <select id="getByNameAndGoodsClassId" resultMap="BaseResultMap"> + SELECT * FROM `yeshi_ec_second_class` gc + WHERE gc.`pid` = #{pid} AND gc.`name` like '%#{name}%' + ORDER BY gc.`orderby` + LIMIT #{start},#{count} + </select> + + <select id="countByNameAndGoodsClassId" resultType="java.lang.Integer"> + SELECT IFNULL(COUNT(gc.`id`),0) FROM `yeshi_ec_second_class` gc + WHERE gc.`pid` = #{pid} AND gc.`name` like '%#{name}%' + </select> +</mapper> diff --git a/fanli/src/main/java/com/yeshi/fanli/mapping/SuperGoodsClassMapper.xml b/fanli/src/main/java/com/yeshi/fanli/mapping/SuperGoodsClassMapper.xml new file mode 100644 index 0000000..335f340 --- /dev/null +++ b/fanli/src/main/java/com/yeshi/fanli/mapping/SuperGoodsClassMapper.xml @@ -0,0 +1,76 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> + +<mapper namespace="com.yeshi.fanli.dao.mybatis.SuperGoodsClassMapper"> + <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.su.clazz.SuperGoodsClass"> + <id column="id" property="id" jdbcType="BIGINT"/> + + <association property="goodsClass" column="goodsclass_id" + select="com.yeshi.fanli.dao.mybatis.GoodsClassMapper.selectByPrimaryKey"/> + + <association property="system" column="system_id" javaType="com.yeshi.fanli.entity.system.BusinessSystem"> + <id column="system_id" property="id" jdbcType="BIGINT" /> + </association> + + </resultMap> + <sql id="Base_Column_List">id,goodsclass_id,system_id</sql> + <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select + <include refid="Base_Column_List"/>from yeshi_ec_super_goodsclass where id = #{id,jdbcType=BIGINT} + </select> + <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_super_goodsclass where id = #{id,jdbcType=BIGINT}</delete> + <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.su.clazz.SuperGoodsClass" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_super_goodsclass (id,goodsclass_id,system_id) values (#{id,jdbcType=BIGINT},#{goodsClass.id,jdbcType=BIGINT},#{system.id,jdbcType=BIGINT})</insert> + <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.su.clazz.SuperGoodsClass" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_super_goodsclass + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="id != null">id,</if> + <if test="goodsClass != null">goodsclass_id,</if> + <if test="system != null">system_id,</if> + </trim>values + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="id != null">#{id,jdbcType=BIGINT},</if> + <if test="goodsClass != null">#{goodsClass.id,jdbcType=BIGINT},</if> + <if test="system != null">#{system.id,jdbcType=BIGINT},</if> + </trim> + </insert> + <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.su.clazz.SuperGoodsClass">update yeshi_ec_super_goodsclass set goodsclass_id = #{goodsClass.id,jdbcType=BIGINT},system_id = #{system.id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}</update> + <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.su.clazz.SuperGoodsClass">update yeshi_ec_super_goodsclass + <set> + <if test="goodsClass != null">goodsclass_id=#{goodsClass.id,jdbcType=BIGINT},</if> + <if test="system != null">system_id=#{system.id,jdbcType=BIGINT},</if> + </set> where id = #{id,jdbcType=BIGINT} + </update> + + <select id="listBySystemId" resultMap="BaseResultMap"> + SELECT * FROM yeshi_ec_super_goodsclass sg + LEFT JOIN yeshi_ec_class cs ON cs.`id` = sg.`goodsclass_id` + WHERE sg.`system_id` = #{systemId} + ORDER BY cs.`orderby` + </select> + + <select id="listByGoodsclassIds" resultMap="BaseResultMap"> + SELECT * FROM yeshi_ec_super_goodsclass sg + LEFT JOIN yeshi_ec_class cs ON cs.`id` = sg.`goodsclass_id` + WHERE cs.`id` IN + <foreach collection="list" index="index" item="item" open="(" separator="," close=")"> + #{item} + </foreach> + </select> + + <select id="listBySystemIdAmdClassName" resultMap="BaseResultMap"> + SELECT * FROM yeshi_ec_super_goodsclass sg + LEFT JOIN yeshi_ec_class cs ON cs.`id` = sg.`goodsclass_id` + WHERE sg.`system_id` = #{systemId} AND cs.`name` LIKE '%#{name}%' + ORDER BY cs.`orderby` + LIMIT #{start},#{count} + </select> + + <delete id="deleteBySystemIdAndClassId"> + DELETE FROM yeshi_ec_super_goodsclass + WHERE `goodsclass_id` = #{goodsClassId} AND system_id = #{systemId} + </delete> + + <delete id="deleteByClassId"> + DELETE FROM yeshi_ec_super_goodsclass + WHERE `goodsclass_id` = #{goodsClassId} + </delete> + +</mapper> diff --git a/fanli/src/main/java/com/yeshi/fanli/mapping/order/CommonOrderMapper.xml b/fanli/src/main/java/com/yeshi/fanli/mapping/order/CommonOrderMapper.xml index 659d4f6..17b4279 100644 --- a/fanli/src/main/java/com/yeshi/fanli/mapping/order/CommonOrderMapper.xml +++ b/fanli/src/main/java/com/yeshi/fanli/mapping/order/CommonOrderMapper.xml @@ -272,6 +272,10 @@ <!-- 鏁翠釜璁㈠崟澶辨晥 --> AND co.co_state_whole_order = 3 </if> + <if test="orderState != null and orderState == 4"> + <!-- 宸叉敹璐ц鍗� --> + AND co.co_state = 2 + </if> </sql> <sql id="SELECT_PARAM_ORDER_CREATE_TIME"> diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/GoodsClassServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/GoodsClassServiceImpl.java index 1e55f2e..0e39efe 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/GoodsClassServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/GoodsClassServiceImpl.java @@ -1,57 +1,40 @@ package com.yeshi.fanli.service.impl.goods; -import java.io.FileNotFoundException; -import java.io.IOException; import java.io.InputStream; -import java.io.Serializable; -import java.net.URLEncoder; -import java.text.MessageFormat; import java.util.ArrayList; -import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.Properties; import java.util.UUID; import javax.annotation.Resource; import javax.transaction.Transactional; import org.apache.commons.beanutils.PropertyUtils; -import org.hibernate.HibernateException; -import org.hibernate.Query; -import org.hibernate.Session; import org.springframework.cache.annotation.Cacheable; -import org.springframework.orm.hibernate4.HibernateCallback; import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; import org.yeshi.utils.tencentcloud.COSManager; import com.google.gson.Gson; import com.google.gson.GsonBuilder; -import com.yeshi.fanli.dao.goods.GoodsClassDao; import com.yeshi.fanli.dao.mybatis.GoodsClassMapper; -import com.yeshi.fanli.dao.mybatis.lable.LabelClassMapper; -import com.yeshi.fanli.entity.admin.GoodsClassAdmin; import com.yeshi.fanli.entity.bus.clazz.GoodsClass; import com.yeshi.fanli.entity.bus.clazz.GoodsSubClass; import com.yeshi.fanli.entity.bus.su.clazz.SuperGoodsClass; import com.yeshi.fanli.entity.system.BusinessSystem; +import com.yeshi.fanli.exception.GoodsClassException; import com.yeshi.fanli.service.inter.config.BusinessSystemService; import com.yeshi.fanli.service.inter.goods.GoodsClassService; -import com.yeshi.fanli.service.inter.goods.GoodsSecondClassService; import com.yeshi.fanli.service.inter.goods.GoodsSubClassService; import com.yeshi.fanli.service.inter.goods.SuperGoodsClassService; -import com.yeshi.fanli.util.Constant; +import com.yeshi.fanli.service.inter.lable.LabelClassService; import com.yeshi.fanli.util.StringUtil; import com.yeshi.fanli.util.Utils; @Service public class GoodsClassServiceImpl implements GoodsClassService { - - @Resource - private GoodsClassDao goodsClassDao; @Resource private BusinessSystemService businessSystemService; @@ -60,290 +43,69 @@ private SuperGoodsClassService superGoodsClassService; @Resource - private GoodsSecondClassService goodsSecondClassService; - - @Resource private GoodsClassMapper goodsClassMapper; - - @Resource - private LabelClassMapper labelClassMapper; - @Resource private GoodsSubClassService goodsSubClassService; + @Resource + private LabelClassService labelClassService; + - public GoodsClass getGoodsClass(long gcid) { - return goodsClassDao.find(GoodsClass.class, gcid); + public GoodsClass getGoodsClass(long id) { + return goodsClassMapper.selectByPrimaryKey(id); } @Override - public void deleteGoodsClass(final long id) { - goodsClassDao.excute(new HibernateCallback() { - public Object doInHibernate(Session session) - throws HibernateException { - Query query = session.createQuery("delete from GoodsClass where id = ? "); - query.setParameter(0, id); - query.executeUpdate(); - return null; - } - }); + public int updateByPrimaryKey(GoodsClass record) { + return goodsClassMapper.updateByPrimaryKey(record); } @Override - @SuppressWarnings("unchecked") - public List<GoodsClass> getByorderby(int orderby) { - - List<GoodsClass> goodsClassList = (List<GoodsClass>) goodsClassDao.excute(new HibernateCallback<List<GoodsClass>>() { - public List<GoodsClass> doInHibernate(Session session) throws HibernateException { - Query query = session.createQuery(" from GoodsClass rs where rs.orderby = ? "); - query.setParameter(0, orderby); - return query.list(); - } - }); - - return goodsClassList; + public String getKeysById(Long id) { + return goodsClassMapper.getKeysById(id); + } + + @Override + public GoodsClass selectByPrimaryKey(Long gcid) { + return goodsClassMapper.selectByPrimaryKey(gcid); + } + + @Override + public int updateByPrimaryKeySelective(GoodsClass record) { + return goodsClassMapper.updateByPrimaryKeySelective(record); } - @SuppressWarnings("unchecked") - public List<GoodsClassAdmin> getGoodsClassAdmins(int index, String platform, String packages, String key) { - final int strat = index * Constant.PAGE_SIZE; - platform = Utils.getMap().get(platform); - BusinessSystem system = businessSystemService.getBusinessSystem(platform, packages); - List<GoodsClass> GoodsClassList = null; - List<SuperGoodsClass> superGoodsClassList = null; - Map<Long, GoodsClassAdmin> goodsClassAdminMap = new HashMap<Long, GoodsClassAdmin>(); - List<GoodsClassAdmin> goodsClassAdmin = new ArrayList<GoodsClassAdmin>(); - if (system == null) { - final String likekey = "%" + key + "%"; - GoodsClassList = (List<GoodsClass>) goodsClassDao.excute(new HibernateCallback<List<GoodsClass>>() { - public List<GoodsClass> doInHibernate(Session session) throws HibernateException { - Query query = session.createQuery(" from GoodsClass rs where rs.name like ? "); - query.setFirstResult(strat); - query.setMaxResults(Constant.PAGE_SIZE); - query.setParameter(0, likekey); - return query.list(); - } - }); - List<Long> gcIdList = new ArrayList<Long>(); - for (GoodsClass rs : GoodsClassList) { - gcIdList.add(rs.getId()); - } - superGoodsClassList = superGoodsClassService.getSuperGoodsClasss(gcIdList); - Map<Long, List<BusinessSystem>> superMap = new HashMap<Long, List<BusinessSystem>>(); - Long rsId = null; - List<BusinessSystem> systemList = null; - for (SuperGoodsClass srs : superGoodsClassList) { - rsId = srs.getGoodsClass().getId(); - systemList = superMap.get(rsId); - if (systemList == null) { - systemList = new ArrayList<BusinessSystem>(); - } - systemList.add(srs.getSystem()); - superMap.put(rsId, systemList); - } - GoodsClassAdmin rsa = null; - for (GoodsClass GoodsClass : GoodsClassList) { - long id = GoodsClass.getId(); - rsa = goodsClassAdminMap.get(id); - if (rsa == null) { - rsa = new GoodsClassAdmin(); - } - List<BusinessSystem> list = superMap.get(id); - if (list != null) { - rsa.getSystemList().addAll(superMap.get(id)); - } - rsa.setGoodsClass(GoodsClass); - goodsClassAdminMap.put(id, rsa); - } - } else if (system != null) { - String likekey = "%" + key + "%"; - superGoodsClassList = superGoodsClassService.getSuperGoodsClassList(system.getId(), strat, - Constant.PAGE_SIZE, likekey); - List<Long> gcIdList = new ArrayList<Long>(); - for (SuperGoodsClass superGoodsClass : superGoodsClassList) { - GoodsClass GoodsClass = superGoodsClass.getGoodsClass(); - gcIdList.add(GoodsClass.getId()); - } - superGoodsClassList = superGoodsClassService.getSuperGoodsClasss(gcIdList); - GoodsClassAdmin rsa = null; - for (SuperGoodsClass superGoodsClass : superGoodsClassList) { - GoodsClass goodsClass = superGoodsClass.getGoodsClass(); - rsa = goodsClassAdminMap.get(goodsClass.getId()); - if (rsa == null) { - rsa = new GoodsClassAdmin(goodsClass); - } - rsa.getSystemList().add(superGoodsClass.getSystem()); - goodsClassAdminMap.put(goodsClass.getId(), rsa); - } - } - Map map = Utils.orderBy(goodsClassAdminMap); - Collection<GoodsClassAdmin> values = map.values(); - goodsClassAdmin.addAll(values); - return goodsClassAdmin; - + @Cacheable(value="classCache",key="'getGoodsClass-'+#gcid") + @Override + public GoodsClass getGoodsClassCache(long gcid) { + return getGoodsClass(gcid); } + + @Override + public void deleteGoodsClass(long id) { + goodsClassMapper.deleteByPrimaryKey(id); + } + + + @Override public int getCount(String platform, String packages, final String key) { + + Long systemId = null; + platform = Utils.getMap().get(platform); - final BusinessSystem system = businessSystemService.getBusinessSystem(platform, packages); - return (Integer) goodsClassDao.excute(new HibernateCallback<Integer>() { - - public Integer doInHibernate(Session session) throws HibernateException { - String k = "%" + key + "%"; - if (system == null) { - // Query query = session.createSQLQuery("select - // count(a.name) from (select `name` from yeshi_ec_class - // where `name` like ?) a"); - Query query = session.createQuery("select count(gc.id) from GoodsClass gc where gc.name like ?"); - query.setParameter(0, k); - Long result = (Long) query.uniqueResult(); - int intValue = result.intValue(); - return intValue; - } else { - // Query query =session.createSQLQuery("select count(a.name) - // from (select hs.name from yeshi_ec_super_goodsclass shs - // left join yeshi_ec_class hs on shs.goodsclass_id=hs.id - // where shs.system_id=? and hs.name like ?) a"); - Query query = session.createQuery( - "select count(sgc.id) from SuperGoodsClass sgc where sgc.goodsClass.name like ? and sgc.system.id=?"); - query.setParameter(0, k); - query.setParameter(1, system.getId()); - Long result = (Long) query.uniqueResult(); - int intValue = result.intValue(); - return intValue; - } - } - }); - } - - // @Transactional - // public void addGoodsClass(GoodsClass goodsClass) { - // goodsClass.setCreatetime(java.lang.System.currentTimeMillis()); - // Serializable id = goodsClassDao.save(goodsClass); - // Properties properties = new Properties(); - // InputStream in = null; - // try { - // in = new BufferedInputStream (new FileInputStream("url.properties")); - // properties.load(in); - // String url = (String) properties.get("url"); - // goodsClass.setUrl(url+id); - // goodsClassDao.update(goodsClass); - // } catch (FileNotFoundException e) { - // e.printStackTrace(); - // } catch (IOException e) { - // e.printStackTrace(); - // }finally{ - // if(in !=null){ - // try { - // in.close(); - // } catch (IOException e) { - // e.printStackTrace(); - // } - // } - // } - // } - - public Integer addGoodsClass(final GoodsClass goodsClass) { - - return (Integer) goodsClassDao.excute(new HibernateCallback() { - - public Object doInHibernate(Session session) throws HibernateException { - session.getTransaction().begin(); - goodsClass.setCreatetime(java.lang.System.currentTimeMillis()); - Serializable id = session.save(goodsClass); - Properties properties = new Properties(); - InputStream in = null; - try { - in = this.getClass().getClassLoader().getResourceAsStream("url.properties"); - properties.load(in); - String url = (String) properties.get("url"); - url = MessageFormat.format(url, id, goodsClass.getKey(), goodsClass.getName()); - goodsClass.setUrl(url); - session.update(goodsClass); - session.flush(); - session.getTransaction().commit(); - } catch (FileNotFoundException e) { - session.getTransaction().rollback(); - e.printStackTrace(); - return 1; - } catch (IOException e) { - session.getTransaction().rollback(); - e.printStackTrace(); - return 2; - } finally { - if (in != null) { - try { - in.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - } - return null; - } - }); - } - - - @Transactional - public void deleteGoodsClasss(long[] gcids) { - for (long id : gcids) { - superGoodsClassService.deleteSuperGoodsClass(id); - goodsSecondClassService.deleteSecondClassByGC(id); - goodsClassDao.delete(new GoodsClass(id)); + + BusinessSystem system = businessSystemService.getBusinessSystem(platform, packages); + if (system != null) { + systemId = system.getId(); } - } - - public Integer updateGoodsClass(final GoodsClass goodsClass) { - - return (Integer) goodsClassDao.excute(new HibernateCallback() { - - public Object doInHibernate(Session session) throws HibernateException { - session.getTransaction().begin(); - goodsClass.setCreatetime(java.lang.System.currentTimeMillis()); - session.update(goodsClass); - Properties properties = new Properties(); - InputStream in = null; - try { - in = this.getClass().getClassLoader().getResourceAsStream("url.properties"); - properties.load(in); - String url = (String) properties.get("url"); - - java.lang.System.out.println(goodsClass.getKey()); - java.lang.System.out.println(goodsClass.getName()); - - String encodeKey = URLEncoder.encode(goodsClass.getKey(), "utf-8"); - String encodeName = URLEncoder.encode(goodsClass.getName(), "utf-8"); - url = MessageFormat.format(url, goodsClass.getId(), encodeKey, encodeName); - goodsClass.setUrl(url); - session.update(goodsClass); - session.flush(); - session.getTransaction().commit(); - } catch (FileNotFoundException e) { - session.getTransaction().rollback(); - e.printStackTrace(); - return 1; - } catch (IOException e) { - session.getTransaction().rollback(); - e.printStackTrace(); - return 2; - } finally { - if (in != null) { - try { - in.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - } - return null; - } - }); + ; + return goodsClassMapper.countByName(key, systemId); } - @SuppressWarnings("unchecked") + @Override public List<GoodsClass> queryAll(String platform, String packages) throws Exception{ @@ -358,12 +120,7 @@ if (system == null) { - goodsClassList = (List<GoodsClass>) goodsClassDao.excute(new HibernateCallback<List<GoodsClass>>() { - public List<GoodsClass> doInHibernate(Session session) throws HibernateException { - Query query = session.createQuery(" from GoodsClass order by orderby"); - return query.list(); - } - }); + goodsClassList = goodsClassMapper.getGoodsClassAll(); if (goodsClassList == null || goodsClassList.size() == 0) { return null; @@ -375,7 +132,7 @@ } } else if (system != null) { - superGoodsClassList = superGoodsClassService.getSuperGoodsClassAll(system.getId()); + superGoodsClassList = superGoodsClassService.getSuperGoodsClassBySystemId(system.getId()); if (goodsClassList == null || goodsClassList.size() == 0) { return null; @@ -406,8 +163,16 @@ } else { gclass.setCountClick(0l); } + + String searchParam = gclass.getSearchParam(); + if (searchParam == null) { + gclass.setSearchParam(""); + } else { + gclass.setSearchParam(searchParam); + } + - int countlabel = labelClassMapper.getCountQueryByClassId(gclass.getId()); + int countlabel = labelClassService.getCountQueryByClassId(gclass.getId()); gclass.setCountlabel(countlabel); List<Long> gList = new ArrayList<Long>(); @@ -453,67 +218,124 @@ } public List<GoodsClass> getGoodsClassAll() { - return goodsClassDao.list("from GoodsClass order by orderby"); + return goodsClassMapper.getGoodsClassAll(); } - @Override - public String getKwById(Long id) { - return goodsClassMapper.getKwById(id); - } @Override - public GoodsClass selectByPrimaryKey(Long gcid) { - return goodsClassMapper.selectByPrimaryKey(gcid); - } - - @Override - public int updateByPrimaryKeySelective(GoodsClass record) { - return goodsClassMapper.updateByPrimaryKeySelective(record); - } - - - - @Override - public List<GoodsClass> queryAll() { - return goodsClassMapper.queryAll(); - } - - @Cacheable(value="classCache",key="'getGoodsClass-'+#gcid") - @Override - public GoodsClass getGoodsClassCache(long gcid) { - return getGoodsClass(gcid); - } - - @Override - @SuppressWarnings("unchecked") - public long saveAdd(GoodsClass record, MultipartFile file) throws Exception{ + public void saveObject(MultipartFile file, GoodsClass record) throws GoodsClassException, Exception{ - long result = 0; - record.setCreatetime(java.lang.System.currentTimeMillis()); - - /* 涓婁紶鏂板浘鐗� */ - if (file != null) { - InputStream inputStream = file.getInputStream(); - String contentType = file.getContentType(); - String type = contentType.substring(contentType.indexOf("/") + 1); - // 涓婁紶鏂囦欢鐩稿浣嶇疆 - String fileUrl="ClassImg/"+UUID.randomUUID().toString().replace("-", "") + "." + type; - String uploadFilePath = COSManager.getInstance().uploadFile(inputStream, fileUrl).getUrl(); - - record.setPicture(uploadFilePath); + String name = record.getName(); + if (name == null || name.trim().length() == 0) { + throw new GoodsClassException(1, "鍒嗙被鍚嶇О涓嶈兘涓虹┖"); } - addGoodsClass(record); - record.setOrderby((int)record.getId()); - updateGoodsClass(record); + // 鍥剧墖涓婁紶 + String picture = null; + if (file != null) { + picture = uploadPicture(file); + } - long id = record.getId(); - if (id > 0) - return id; + String params = record.getSearchParam(); + if (params== null || params.trim().length() == 0 || "null".equalsIgnoreCase(params)) { + record.setSearchParam(null); + } else { + record.setSearchParam(params); + } - return result; + + + Long id = record.getId(); + if (id == null) { + record.setPicture(picture); + record.setIosClick(0L); + record.setAndroidClick(0L); + + record.setCreatetime(java.lang.System.currentTimeMillis()); + + if (params== null || params.trim().length() == 0 || "null".equalsIgnoreCase(params)) { + // 鎼滅储鏉′欢:鏈夊埜銆佸湪鍞环20-200銆佺墰鐨櫍杞诲井 + record.setSearchParam("{\"quan\":1,\"endPrice\":220,\"includeGoodRate\":true,\"baoYou\":true,\"ip\":\"218.72.111.105\"}"); + } + + // 鎺掑簭 + int maxOrder = goodsClassMapper.getMaxOrder(); + record.setOrderby(maxOrder + 1); + + goodsClassMapper.insert(record); + + // 榛樿鎵�鏈夌郴缁熶娇鐢� + List<BusinessSystem> listSystems = businessSystemService.getBusinessSystems(); + if (listSystems != null && listSystems.size() > 0) { + for(BusinessSystem businessSystem: listSystems) { + SuperGoodsClass superGoodsClass = new SuperGoodsClass(); + superGoodsClass.setGoodsClass(record);; + superGoodsClass.setSystem(businessSystem); + superGoodsClassService.insertSelective(superGoodsClass); + } + } + + } else { + // 淇敼 + GoodsClass resultObj = goodsClassMapper.selectByPrimaryKey(id); + if (resultObj == null) { + throw new GoodsClassException(1, "淇敼鍐呭宸蹭笉瀛樺湪"); + } + + if (picture != null && picture.trim().length() > 0) { + // 鍒犻櫎鑰佸浘 + removePicture(resultObj.getPicture()); + // 瀛樺偍鏂板浘 + record.setPicture(picture); + } else { + record.setPicture(resultObj.getPicture()); + } + + record.setIosClick(resultObj.getIosClick()); + record.setOrderby(resultObj.getOrderby()); + record.setAndroidClick(resultObj.getAndroidClick()); + record.setCreatetime(resultObj.getCreatetime()); + goodsClassMapper.updateByPrimaryKey(record); + } } + + + /** + * 涓婁紶鍥剧墖 + * @param file + * @return + * @throws Exception + */ + public String uploadPicture(MultipartFile file) throws Exception { + + // 鏂囦欢瑙f瀽 + InputStream inputStream = file.getInputStream(); + String contentType = file.getContentType(); + String type = contentType.substring(contentType.indexOf("/") + 1); + + // 鏂囦欢璺緞 + String filePath="/img/GoodsClass/"+UUID.randomUUID().toString().replace("-", "") + "." + type; + // 鎵ц涓婁紶 + String fileLink= COSManager.getInstance().uploadFile(inputStream, filePath).getUrl(); + + return fileLink; + } + + /** + * 鍒犻櫎鍥剧墖-涓嶆洿鏂版暟鎹簱 + * @param record + * @throws Exception + */ + public void removePicture(String picture) throws Exception { + if (picture != null && picture.trim().length() > 0) { + COSManager.getInstance().deleteFile(picture); + } + } + + + + @Override public void uploadPicture(GoodsClass record, MultipartFile file) throws Exception { @@ -540,7 +362,7 @@ /* 鏇存柊鏁版嵁搴撲俊鎭� */ if (!StringUtil.isNullOrEmpty(uploadFilePath)) { record.setPicture(uploadFilePath); - updateGoodsClass(record); + goodsClassMapper.updateByPrimaryKey(record); } } @@ -562,7 +384,7 @@ if (deleteFile) { record.setPicture(null); // 鏇存柊鏁版嵁搴� - updateGoodsClass(record); + goodsClassMapper.updateByPrimaryKey(record); } } @@ -630,5 +452,37 @@ return list; } + + + @Override + @Transactional + public void updateOrder(Long id, Integer moveType) throws GoodsClassException { + + if (id == null || moveType == null || (!moveType.equals(1) && !moveType.equals(-1))) { + throw new GoodsClassException(1, "璇蜂紶閫掓纭弬鏁�"); + } + + GoodsClass resultObj = goodsClassMapper.selectByPrimaryKey(id); + if (resultObj == null) { + throw new GoodsClassException(1, "姝ゅ唴瀹瑰凡涓嶅瓨鍦�"); + } + + Integer order = resultObj.getOrderby(); + // 鑾峰彇浜ゆ崲瀵硅薄 + GoodsClass exchangeObject = goodsClassMapper.getByAdjoinOrder( order, moveType); + if (exchangeObject == null) { + if (moveType == 1) { + throw new GoodsClassException(1, "鍦ㄧ浉鍚屼娇鐢ㄥ湴鏂逛腑浼樺厛绾у凡缁忔渶浣庝簡"); + } else { + throw new GoodsClassException(1, "鍦ㄧ浉鍚屼娇鐢ㄥ湴鏂逛腑浼樺厛绾у凡缁忔渶楂樹簡"); + } + } + + resultObj.setOrderby(exchangeObject.getOrderby()); + exchangeObject.setOrderby(order); + + goodsClassMapper.updateByPrimaryKey(resultObj); + goodsClassMapper.updateByPrimaryKey(exchangeObject); + } } diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/GoodsSecondClassServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/GoodsSecondClassServiceImpl.java index 2cb3aef..7b0a16a 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/GoodsSecondClassServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/GoodsSecondClassServiceImpl.java @@ -1,17 +1,13 @@ package com.yeshi.fanli.service.impl.goods; -import java.io.Serializable; import java.util.List; import javax.annotation.Resource; -import org.hibernate.HibernateException; -import org.hibernate.Session; import org.springframework.cache.annotation.Cacheable; -import org.springframework.orm.hibernate4.HibernateCallback; import org.springframework.stereotype.Service; -import com.yeshi.fanli.dao.goods.GoodsSecondClassDao; +import com.yeshi.fanli.dao.mybatis.GoodsSecondClassMapper; import com.yeshi.fanli.entity.bus.clazz.GoodsSecondClass; import com.yeshi.fanli.exception.NotExistObjectException; import com.yeshi.fanli.service.inter.goods.GoodsSecondClassService; @@ -21,55 +17,39 @@ public class GoodsSecondClassServiceImpl implements GoodsSecondClassService { @Resource - private GoodsSecondClassDao goodsSecondClassDao; + private GoodsSecondClassMapper goodsSecondClassMapper; + + + @Cacheable(value="classCache",key="'getGoodsSecondClassByGoodsClassId-'+#id") public List<GoodsSecondClass> getGoodsSecondClassByGoodsClassId(long id) { - - List<GoodsSecondClass> list = goodsSecondClassDao.list( - "from GoodsSecondClass gsc " + "where gsc.parent.id=? order by gsc.orderby ", - new Serializable[] { id }); - - return list; + return goodsSecondClassMapper.getByGoodsClassId(id); } - public List<GoodsSecondClass> getSecondClassList(int index, String key, - long cid) { - - int start = index * Constant.PAGE_SIZE; - - List<GoodsSecondClass> list = goodsSecondClassDao - .list("from GoodsSecondClass gsc where gsc.parent.id=? and gsc.name like ? order by gsc.orderby", - start, Constant.PAGE_SIZE, new Serializable[] { cid, - "%" + key + "%" }); - - return list; + public List<GoodsSecondClass> getSecondClassList(int index, String key, long cid) { + return goodsSecondClassMapper.getByNameAndGoodsClassId(index * Constant.PAGE_SIZE, Constant.PAGE_SIZE, cid, key); } public int getCount(long cid, String key) { - Long lcount = goodsSecondClassDao - .getCount( - "select count(*) from GoodsSecondClass gsc where gsc.parent.id=? and gsc.name like ? ", - new Serializable[] { cid, "%" + key + "%" }); - return lcount.intValue(); + return goodsSecondClassMapper.countByNameAndGoodsClassId(cid, key); } public void addSecondClass(GoodsSecondClass secondClass) { secondClass.setCreatetime(System.currentTimeMillis()); - goodsSecondClassDao.save(secondClass); + goodsSecondClassMapper.insert(secondClass); } public void deleteSecondClass(long sid) { - goodsSecondClassDao.delete(new GoodsSecondClass(sid)); + goodsSecondClassMapper.deleteByPrimaryKey(sid); } public GoodsSecondClass getSecondClass(long scid) { - return goodsSecondClassDao.find(GoodsSecondClass.class, scid); + return goodsSecondClassMapper.selectByPrimaryKey(scid); } - + public void updateSecondClass(GoodsSecondClass secondClass) throws NotExistObjectException { - GoodsSecondClass find = goodsSecondClassDao.find( - GoodsSecondClass.class, secondClass.getId()); + GoodsSecondClass find = goodsSecondClassMapper.selectByPrimaryKey(secondClass.getId()); if (find == null) { throw new NotExistObjectException("涓嶅瓨鍦ㄨ鐢ㄦ埛"); } @@ -77,19 +57,7 @@ find.setPicture(secondClass.getPicture()); find.setOrderby(secondClass.getOrderby()); find.setKey(secondClass.getKey()); - goodsSecondClassDao.update(find); - } - - public void deleteSecondClassByGC(final long id) { - goodsSecondClassDao.excute(new HibernateCallback() { - public Object doInHibernate(Session session) - throws HibernateException { - session.createQuery( - "delete from GoodsSecondClass gsc where gsc.parent.id=?") - .setParameter(0, id).executeUpdate(); - return null; - } - }); + goodsSecondClassMapper.updateByPrimaryKey(find); } } diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/GoodsSubClassServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/GoodsSubClassServiceImpl.java index cc4c268..30f95ce 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/GoodsSubClassServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/GoodsSubClassServiceImpl.java @@ -1,6 +1,7 @@ package com.yeshi.fanli.service.impl.goods; import java.io.InputStream; +import java.util.Date; import java.util.List; import java.util.UUID; @@ -10,14 +11,16 @@ import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; +import org.yeshi.utils.tencentcloud.COSManager; import com.yeshi.fanli.dao.mybatis.GoodsSubClassMapper; import com.yeshi.fanli.entity.accept.AcceptData; +import com.yeshi.fanli.entity.bus.clazz.GoodsClass; import com.yeshi.fanli.entity.bus.clazz.GoodsSubClass; +import com.yeshi.fanli.exception.GoodsSubClassException; import com.yeshi.fanli.service.inter.goods.GoodsSubClassService; import com.yeshi.fanli.service.inter.lable.LabelClassService; import com.yeshi.fanli.util.StringUtil; -import org.yeshi.utils.tencentcloud.COSManager; @Service public class GoodsSubClassServiceImpl implements GoodsSubClassService { @@ -55,10 +58,6 @@ return goodsSubClassMapper.updateByPrimaryKeySelective(record); } - @Override - public int updateByPrimaryKey(GoodsSubClass record) { - return goodsSubClassMapper.updateByPrimaryKey(record); - } @Override @Transactional @@ -86,8 +85,6 @@ @Override @Transactional public void deleteSub(Long recordId) throws Exception { - // TODO Auto-generated method stub - GoodsSubClass goodsSubClass = goodsSubClassMapper.selectByPrimaryKey(recordId); if (goodsSubClass == null) @@ -116,52 +113,135 @@ goodsSubClassMapper.deleteByPrimaryKey(recordId); } + + @Override - public int save(GoodsSubClass record, MultipartFile file) throws Exception { - - int result = 0; - - result = goodsSubClassMapper.insertSelective(record); + public void saveObject(MultipartFile file, GoodsSubClass record, Integer type, Long pid) throws GoodsSubClassException, Exception{ - - // 涓婁紶鍥剧墖 - if (file != null) { - result = goodsSubClassService.uploadPicture(record, file); + String name = record.getName(); + if (name == null || name.trim().length() == 0) { + throw new GoodsSubClassException(1, "鍒嗙被鍚嶇О涓嶈兘涓虹┖"); } - - return result; + + // 鍥剧墖涓婁紶 + String picture = null; + if (file != null) { + picture = uploadPicture(file); + } + + String params = record.getSearchParam(); + if (params== null || params.trim().length() == 0 || "null".equalsIgnoreCase(params)) { + record.setSearchJson(null); + } else { + record.setSearchJson(params); + } + + Long id = record.getId(); + if (id == null) { + if (type == null) { + throw new GoodsSubClassException(1, "绛夌骇涓嶈兘涓虹┖"); + } + + if (type > 5) { + throw new GoodsSubClassException(1, "绛夌骇涓嶈兘瓒呰繃浜旂骇"); + } + + if (pid == null) { + throw new GoodsSubClassException(1, "涓婄骇id涓虹┖"); + } + + + if (type == 2) { + record.setRootClass(new GoodsClass(pid)); + int weight = goodsSubClassMapper.getMaxWeightByRootId(pid); + record.setWeight(weight + 1); + } else { + record.setParent(new GoodsSubClass(pid)); + int weight = goodsSubClassMapper.getMaxWeightByPid(pid); + record.setWeight(weight + 1); + } + + String key = record.getKey(); + if (StringUtil.isNullOrEmpty(key)) { + record.setKey(name.trim()); + } + + record.setLevel(type); + record.setPicture(picture); + record.setState(0); + record.setAndroidClick(0L); + record.setIosClick(0L); + record.setCreatetime(new Date()); + record.setUpdatetime(new Date()); + + if (params== null || params.trim().length() == 0 || "null".equalsIgnoreCase(params)) { + // 鎼滅储鏉′欢:鏈夊埜銆佸湪鍞环20-200銆佺墰鐨櫍杞诲井 + record.setSearchJson("{\"quan\":1,\"endPrice\":220,\"includeGoodRate\":true}"); + } + + goodsSubClassMapper.insert(record); + + } else { + // 淇敼 + GoodsSubClass resultObj = goodsSubClassMapper.selectByPrimaryKey(id); + if (resultObj == null) { + throw new GoodsSubClassException(1, "淇敼鍐呭宸蹭笉瀛樺湪"); + } + + if (picture != null && picture.trim().length() > 0) { + // 鍒犻櫎鑰佸浘 + removePicture(resultObj.getPicture()); + // 瀛樺偍鏂板浘 + record.setPicture(picture); + } else { + record.setPicture(resultObj.getPicture()); + } + + record.setLevel(resultObj.getLevel()); + record.setRootClass(resultObj.getRootClass()); + record.setWeight(resultObj.getWeight()); + record.setIosClick(resultObj.getIosClick()); + record.setAndroidClick(resultObj.getAndroidClick()); + record.setCreatetime(resultObj.getCreatetime()); + record.setUpdatetime(new Date()); + goodsSubClassMapper.updateByPrimaryKey(record); + } } - @Override - public int uploadPicture(GoodsSubClass record, MultipartFile file) throws Exception { - + /** + * 涓婁紶鍥剧墖 + * @param file + * @return + * @throws Exception + */ + public String uploadPicture(MultipartFile file) throws Exception { + + // 鏂囦欢瑙f瀽 InputStream inputStream = file.getInputStream(); String contentType = file.getContentType(); String type = contentType.substring(contentType.indexOf("/") + 1); - // 涓婁紶鏂囦欢鐩稿浣嶇疆 - String fileUrl = "ClassImg/" + UUID.randomUUID().toString().replace("-", "") + "." + type; - - boolean deleteFile = true; - - /* 淇敼鍥剧墖鏃讹紝鍏堝垹闄ゅ凡瀛樺湪鍥剧墖 */ - String picture = record.getPicture(); - if (!StringUtil.isNullOrEmpty(picture)) - deleteFile = COSManager.getInstance().deleteFile(picture); - - String uploadFilePath = null; - /* 涓婁紶鏂板浘鐗� */ - if (deleteFile) { - uploadFilePath = COSManager.getInstance().uploadFile(inputStream, fileUrl).getUrl(); - } - - /* 鏇存柊鏁版嵁搴撲俊鎭� */ - int result = 0; - if (!StringUtil.isNullOrEmpty(uploadFilePath)) { - record.setPicture(uploadFilePath); - result = goodsSubClassMapper.updateByPrimaryKeySelective(record); - } - return result; + + // 鏂囦欢璺緞 + String filePath="/img/GoodsSubClass/"+UUID.randomUUID().toString().replace("-", "") + "." + type; + // 鎵ц涓婁紶 + String fileLink= COSManager.getInstance().uploadFile(inputStream, filePath).getUrl(); + + return fileLink; } + + /** + * 鍒犻櫎鍥剧墖 + * @param record + * @throws Exception + */ + public void removePicture(String picture) throws Exception { + if (picture != null && picture.trim().length() > 0) { + COSManager.getInstance().deleteFile(picture); + } + } + + + /** * 鍒犻櫎鍥剧墖 @@ -252,26 +332,6 @@ return goodsSubClassMapper.countByPid(pid); } - /** - * 缁熻涓�绾т箣涓嬬殑鎵�鏈変簩绾у垎绫绘渶澶ф潈閲� - * @param rootId 涓�绾d - * @returnL - */ - @Override - public int getMaxWeightByRootId(Long rootId) { - return goodsSubClassMapper.getMaxWeightByRootId(rootId); - } - - /** - * 缁熻浜岀骇鍒嗙被涔嬩笅鍏朵粬鍒嗙被鏈�澶ф潈閲� - * @param rootId 涓�绾d - * @return - */ - @Override - public int getMaxWeightByPid(Long pid){ - return goodsSubClassMapper.getMaxWeightByPid(pid); - } - @Override public void countClick(AcceptData acceptData, GoodsSubClass record) { @@ -297,4 +357,5 @@ public List<GoodsSubClass> queryByListCid(List<Long> list){ return goodsSubClassMapper.queryByListCid(list); } + } diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/SuperGoodsClassServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/SuperGoodsClassServiceImpl.java index 80c7fa8..e97b826 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/SuperGoodsClassServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/SuperGoodsClassServiceImpl.java @@ -1,20 +1,14 @@ package com.yeshi.fanli.service.impl.goods; -import java.io.Serializable; import java.util.ArrayList; import java.util.List; import javax.annotation.Resource; -import org.hibernate.HibernateException; -import org.hibernate.Query; -import org.hibernate.Session; -import org.hibernate.Transaction; import org.springframework.cache.annotation.Cacheable; -import org.springframework.orm.hibernate4.HibernateCallback; import org.springframework.stereotype.Service; -import com.yeshi.fanli.dao.goods.SuperGoodsClassDao; +import com.yeshi.fanli.dao.mybatis.SuperGoodsClassMapper; import com.yeshi.fanli.entity.bus.clazz.GoodsClass; import com.yeshi.fanli.entity.bus.su.clazz.SuperGoodsClass; import com.yeshi.fanli.entity.system.BusinessSystem; @@ -25,95 +19,64 @@ public class SuperGoodsClassServiceImpl implements SuperGoodsClassService { @Resource - private SuperGoodsClassDao superGoodsClassDao; + private SuperGoodsClassMapper superGoodsClassMapper; @Resource private BusinessSystemService businessSystemService; + @Override @Cacheable(value="classCache", key="'getSuperGoodsClassBySystemId-'+#id") public List<SuperGoodsClass> getSuperGoodsClassBySystemId(long id) { - - return superGoodsClassDao.list("from SuperGoodsClass sgc where sgc.system.id=? order by sgc.goodsClass.orderby ", new Serializable[]{id}); - + return superGoodsClassMapper.listBySystemId(id); } + @Override public List<SuperGoodsClass> getSuperGoodsClasss(List<Long> gcIdList) { - if (gcIdList.size() == 0) { + if (gcIdList == null || gcIdList.size() == 0) { return new ArrayList<SuperGoodsClass>(); } - StringBuffer sb = new StringBuffer(" from SuperGoodsClass sgc "); - Serializable[] serArr = new Serializable[gcIdList.size()]; - for (int i = 0; i < gcIdList.size(); i++) { - if (i == 0) { - sb.append(" where sgc.goodsClass.id=? "); - } else { - sb.append(" or sgc.goodsClass.id=? "); - } - serArr[i] = gcIdList.get(i); - } - //sb.append(" order by sgc.goodsClass.orderby "); - String hql = sb.toString(); - - return superGoodsClassDao.list(hql, serArr); - + return superGoodsClassMapper.listByGoodsclassIds(gcIdList); } - public List<SuperGoodsClass> getSuperGoodsClassList(long id, int start, - int count, String key) { - return superGoodsClassDao.list("from SuperGoodsClass srs where srs.system.id=? and srs.goodsClass.name like ? order by sgc.goodsClass.orderby ",start,count,new Serializable[]{id, "%"+key+"%"}); + @Override + public List<SuperGoodsClass> getSuperGoodsClassList(long id, int start, int count, String key) { + return superGoodsClassMapper.listBySystemIdAmdClassName(start, count, key, id); } @Override - public List<SuperGoodsClass> getSuperGoodsClassAll(long id) { - return superGoodsClassDao.list("from SuperGoodsClass srs where srs.system.id=? order by sgc.goodsClass.orderby ",new Serializable[]{id}); + public Integer deleteSuperGoodsClass(final long gcid, final String platform, final String packageName) { + BusinessSystem system = businessSystemService.getBusinessSystem(platform, packageName); + if (system == null) { + return 0; + } + return superGoodsClassMapper.deleteBySystemIdAndClassId(gcid, system.getId()); } - public Integer deleteSuperGoodsClass(final long gcid, final String platform, - final String packageName) { - - return (Integer) superGoodsClassDao.excute(new HibernateCallback<Integer>() { - - public Integer doInHibernate(Session session) - throws HibernateException { - BusinessSystem system = businessSystemService.getBusinessSystem(platform, packageName); - Transaction transaction = session.beginTransaction(); - Query query = session.createQuery("delete SuperGoodsClass shs " - + " where shs.goodsClass.id=? and shs.system.id=?"); - query.setLong(0, gcid); - query.setLong(1, system.getId()); - int i = query.executeUpdate(); - transaction.commit(); - return i ; - } - }); - } - - public void addSuperGoodsClass(long gcid, String platform, - String packageName) { + + @Override + public void addSuperGoodsClass(long gcid, String platform, String packageName) { BusinessSystem system = businessSystemService.getBusinessSystem(platform,packageName); - SuperGoodsClass superGoodsClass = new SuperGoodsClass(); + GoodsClass goodsClass = new GoodsClass(); goodsClass.setId(gcid); + + SuperGoodsClass superGoodsClass = new SuperGoodsClass(); superGoodsClass.setGoodsClass(goodsClass);; superGoodsClass.setSystem(system); - superGoodsClassDao.create(superGoodsClass); + superGoodsClassMapper.insert(superGoodsClass); + } + @Override + public void deleteSuperGoodsClass(long gcid) { + superGoodsClassMapper.deleteByClassId(gcid); } - - public void deleteSuperGoodsClass(final long gcid) { - superGoodsClassDao.excute(new HibernateCallback() { - public Object doInHibernate(Session session) - throws HibernateException { - Query query = session.createQuery("delete from SuperGoodsClass sgc where sgc.goodsClass.id=?"); - query.setParameter(0, gcid); - query.executeUpdate(); - return null; - } - }); + + @Override + public void insertSelective(SuperGoodsClass record){ + superGoodsClassMapper.insertSelective(record); } - - + } diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/FloatADServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/FloatADServiceImpl.java index 84b84e2..8ed9d59 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/FloatADServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/FloatADServiceImpl.java @@ -46,7 +46,7 @@ } String params = record.getParams(); - if ((params != null && params.trim().length() == 0) || "null".equalsIgnoreCase(params) ) { + if (params == null || params.trim().length() == 0 || "null".equalsIgnoreCase(params) ) { record.setParams(null); } diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/SwiperPictureServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/SwiperPictureServiceImpl.java index 53ba772..21fce07 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/SwiperPictureServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/SwiperPictureServiceImpl.java @@ -78,7 +78,7 @@ } String params = record.getParams(); - if ((params != null && params.trim().length() == 0) || "null".equalsIgnoreCase(params) ) { + if (params == null || params.trim().length() == 0 || "null".equalsIgnoreCase(params) ) { record.setParams(null); } diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/AccountMessageServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/AccountMessageServiceImpl.java index 635dc79..564fbed 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/AccountMessageServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/AccountMessageServiceImpl.java @@ -9,13 +9,13 @@ import org.springframework.orm.hibernate4.HibernateCallback; import org.springframework.stereotype.Service; -import com.yeshi.fanli.dao.config.SystemZnxDao; import com.yeshi.fanli.dao.mybatis.AccountMessageMapper; import com.yeshi.fanli.dao.user.UserInfoDao; import com.yeshi.fanli.entity.bus.user.AccountMessage; import com.yeshi.fanli.entity.bus.user.UserInfo; import com.yeshi.fanli.entity.system.SystemZnx; import com.yeshi.fanli.service.inter.user.AccountMessageService; +import com.yeshi.fanli.service.inter.user.SystemZnxService; import com.yeshi.fanli.util.Constant; @Service @@ -25,8 +25,9 @@ private AccountMessageMapper accountMessageMapper; @Resource private UserInfoDao userInfoDao; + @Resource - private SystemZnxDao systemZnxDao; + private SystemZnxService systemZnxService; @Override public List<AccountMessage> findAccountMessageList(long uid, int page) { @@ -67,22 +68,9 @@ UserInfo userInfo = userInfoDao.find(UserInfo.class, uid); if (userInfo == null) return; - List<SystemZnx> list = (List<SystemZnx>) systemZnxDao.excute(new HibernateCallback<List<SystemZnx>>() { - @SuppressWarnings("unchecked") - @Override - public List<SystemZnx> doInHibernate(Session session) throws HibernateException { - List result = session - .createSQLQuery( - "SELECT sm.* FROM `yeshi_ec_system_msg` sm LEFT JOIN (SELECT * FROM `yeshi_ec_account_message` a WHERE a.`uid`=? AND a.`system_msg_id` IS NOT NULL) s ON s.`system_msg_id`=sm.`id` WHERE s.`system_msg_id` IS NULL and sm.createTime>=" - + userInfo.getCreatetime()) - .addEntity(SystemZnx.class).setParameter(0, uid).list(); - if (result != null) { - List<SystemZnx> list = (List<SystemZnx>) result; - return list; - } - return null; - } - }); + + List<SystemZnx> list = systemZnxService.listbyUidAndCreateTime(uid, userInfo.getCreatetime()); + if (list != null) for (SystemZnx systemZnx : list) { AccountMessage accountMessage = new AccountMessage(); diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserInfoServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserInfoServiceImpl.java index 36cc59d..23a7e25 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserInfoServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserInfoServiceImpl.java @@ -692,15 +692,13 @@ userInfoVO.setLastLoginTime(null); } - String wxUnionId = userInfoVO.getWxUnionId(); - if (wxUnionId == null || wxUnionId.trim().length() == 0) { - userInfoVO.setWxName(null); - } - - String taoBaoUid = userInfoVO.getTaoBaoUid(); - if (taoBaoUid == null || taoBaoUid.trim().length() == 0) { - userInfoVO.setTbName(null); - } + /* 鏄剧ず鐢ㄦ埛寰俊 娣樺疂 鑰佺増鏈瓨鍦� + * String wxUnionId = userInfoVO.getWxUnionId(); if (wxUnionId == null || + * wxUnionId.trim().length() == 0) { userInfoVO.setWxName(null); } + * + * String taoBaoUid = userInfoVO.getTaoBaoUid(); if (taoBaoUid == null || + * taoBaoUid.trim().length() == 0) { userInfoVO.setTbName(null); } + */ Long uid = userInfoVO.getId(); diff --git a/fanli/src/main/java/com/yeshi/fanli/service/inter/goods/GoodsClassService.java b/fanli/src/main/java/com/yeshi/fanli/service/inter/goods/GoodsClassService.java index c9c013c..8dab207 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/inter/goods/GoodsClassService.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/inter/goods/GoodsClassService.java @@ -7,6 +7,7 @@ import com.yeshi.fanli.entity.admin.GoodsClassAdmin; import com.yeshi.fanli.entity.bus.clazz.GoodsClass; +import com.yeshi.fanli.exception.GoodsClassException; public interface GoodsClassService { @@ -15,16 +16,10 @@ public GoodsClass getGoodsClassCache(long gcid); - public List<GoodsClassAdmin> getGoodsClassAdmins(int i, String platform, - String packages, String key); public int getCount(String platform, String packages, String key); - public Integer addGoodsClass(GoodsClass goodsClass); - public void deleteGoodsClasss(long[] gcids); - - public Integer updateGoodsClass(GoodsClass goodsClass); /** * 鑾峰彇鎵�鏈夊垎绫� * @return @@ -39,7 +34,7 @@ * @param id * @return */ - public String getKwById(Long id); + public String getKeysById(Long id); /** * 涓婁紶鍥剧墖 @@ -50,14 +45,6 @@ */ public void uploadPicture(GoodsClass record, MultipartFile file) throws Exception; - /** - * 鏂板绫诲埆 - * @param record - * @param file - * @return - * @throws Exception - */ - public long saveAdd(GoodsClass record, MultipartFile file) throws Exception; public void deleteGoodsClass(long id); @@ -66,19 +53,7 @@ public List<GoodsClass> queryAll(String platform, String packages) throws Exception; - /** - * 鏍规嵁鎺掑簭id鏌ヨ - * @param orderby - * @return - */ - public List<GoodsClass> getByorderby(int orderby); - - /** - * 鏌ヨ鎵�鏈� - * @return - */ - public List<GoodsClass> queryAll(); /** * 閫夋嫨鎬ф洿鏂� @@ -87,6 +62,10 @@ */ public int updateByPrimaryKeySelective(GoodsClass record); + + int updateByPrimaryKey(GoodsClass record); + + public GoodsClass selectByPrimaryKey(Long gcid); @@ -107,4 +86,23 @@ public List<Map<String, Object>> getClassListAllCache(Long systemId) throws Exception; + /** + * 淇濆瓨鍒嗙被淇℃伅 + * @param file + * @param record + * @throws GoodsClassException + * @throws Exception + */ + public void saveObject(MultipartFile file, GoodsClass record) throws GoodsClassException, Exception; + + + /** + * 鍚庡彴椤哄簭璋冩暣 + * @param id + * @param moveType + * @throws GoodsClassException + */ + public void updateOrder(Long id, Integer moveType) throws GoodsClassException; + + } diff --git a/fanli/src/main/java/com/yeshi/fanli/service/inter/goods/GoodsSecondClassService.java b/fanli/src/main/java/com/yeshi/fanli/service/inter/goods/GoodsSecondClassService.java index 49a74e6..7dbf337 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/inter/goods/GoodsSecondClassService.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/inter/goods/GoodsSecondClassService.java @@ -2,8 +2,6 @@ import java.util.List; -import org.springframework.cache.annotation.Cacheable; - import com.yeshi.fanli.entity.bus.clazz.GoodsSecondClass; import com.yeshi.fanli.exception.NotExistObjectException; @@ -23,7 +21,5 @@ public GoodsSecondClass getSecondClass(long scid); public void updateSecondClass(GoodsSecondClass secondClass) throws NotExistObjectException; - - public void deleteSecondClassByGC(long id); } diff --git a/fanli/src/main/java/com/yeshi/fanli/service/inter/goods/GoodsSubClassService.java b/fanli/src/main/java/com/yeshi/fanli/service/inter/goods/GoodsSubClassService.java index fc29373..a753ea3 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/inter/goods/GoodsSubClassService.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/inter/goods/GoodsSubClassService.java @@ -7,6 +7,7 @@ import com.yeshi.fanli.entity.accept.AcceptData; import com.yeshi.fanli.entity.bus.clazz.GoodsSubClass; +import com.yeshi.fanli.exception.GoodsSubClassException; public interface GoodsSubClassService { @@ -21,7 +22,6 @@ public int updateByPrimaryKeySelective(GoodsSubClass record); - public int updateByPrimaryKey(GoodsSubClass record); /** * 鎵归噺鍒犻櫎 @@ -30,24 +30,6 @@ */ public void deleteByPrimaryKeyBatch(List<String> recordIds) throws Exception ; - /** - * 淇濆瓨鍒嗙被淇℃伅 - * @param record - * @param file - * @throws Exception - */ - public int save(GoodsSubClass record, MultipartFile file) throws Exception; - - - /** - * 涓婁紶鍥剧墖鏂囦欢 骞舵洿鏂板璞′俊鎭� - * @param file - * @param record - * @return - * @throws Exception - */ - public int uploadPicture(GoodsSubClass record, MultipartFile file) throws Exception; - /** * 鍒犻櫎鍥剧墖鏂囦欢 骞舵洿鏂板璞′俊鎭� @@ -99,19 +81,6 @@ public int countByPid(Long pid); - /** - * 缁熻涓�绾т箣涓嬬殑鎵�鏈変簩绾у垎绫绘渶澶ф潈閲� - * @param rootId 涓�绾d - * @returnL - */ - public int getMaxWeightByRootId(Long rootId); - - /** - * 缁熻浜岀骇鍒嗙被涔嬩笅鍏朵粬鍒嗙被鏈�澶ф潈閲� - * @param rootId 涓�绾d - * @return - */ - public int getMaxWeightByPid(Long pid); /** * 鑾峰彇浜岀骇鍒嗙被+ 鍔犲叆缂撳瓨 @@ -145,4 +114,16 @@ */ public List<GoodsSubClass> queryByListCid(List<Long> list); + /** + * 淇濆瓨鍒嗙被淇℃伅 + * @param file + * @param record + * @param type + * @param pid + * @throws GoodsSubClassException + * @throws Exception + */ + public void saveObject(MultipartFile file, GoodsSubClass record, Integer type, Long pid) + throws GoodsSubClassException, Exception; + } diff --git a/fanli/src/main/java/com/yeshi/fanli/service/inter/goods/SuperGoodsClassService.java b/fanli/src/main/java/com/yeshi/fanli/service/inter/goods/SuperGoodsClassService.java index 917adaa..212e4ea 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/inter/goods/SuperGoodsClassService.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/inter/goods/SuperGoodsClassService.java @@ -2,27 +2,22 @@ import java.util.List; -import org.springframework.cache.annotation.Cacheable; - import com.yeshi.fanli.entity.bus.su.clazz.SuperGoodsClass; public interface SuperGoodsClassService { - + public List<SuperGoodsClass> getSuperGoodsClassBySystemId(long id); public List<SuperGoodsClass> getSuperGoodsClasss(List<Long> gcIdList); - public List<SuperGoodsClass> getSuperGoodsClassList(long id, int strat, - int pAGE_SIZE, String likekey); + public List<SuperGoodsClass> getSuperGoodsClassList(long id, int strat, int pAGE_SIZE, String likekey); - public Integer deleteSuperGoodsClass(long gcid, String platform, - String packageName); + public Integer deleteSuperGoodsClass(long gcid, String platform, String packageName); - public void addSuperGoodsClass(long gcid, String platform, - String packageName); + public void addSuperGoodsClass(long gcid, String platform, String packageName); public void deleteSuperGoodsClass(long gcid); - public List<SuperGoodsClass> getSuperGoodsClassAll(long id); + public void insertSelective(SuperGoodsClass record); } diff --git a/fanli/src/main/java/com/yeshi/fanli/util/taobao/DaTaoKeUtil.java b/fanli/src/main/java/com/yeshi/fanli/util/taobao/DaTaoKeUtil.java index 3592495..9db75a2 100644 --- a/fanli/src/main/java/com/yeshi/fanli/util/taobao/DaTaoKeUtil.java +++ b/fanli/src/main/java/com/yeshi/fanli/util/taobao/DaTaoKeUtil.java @@ -78,7 +78,7 @@ int[] ids = new int[] { 1, 9, 10, 2, 3, 4, 5, 6, 7, 8 }; for (int i = 0; i < names.length; i++) { GoodsClass gc = new GoodsClass(); - gc.setId(ids[i]); + gc.setId(Long.parseLong(ids[i]+"")); gc.setName(names[i]); list.add(gc); } -- Gitblit v1.8.0