From 06e70064fbc059c8cc9c654376ce589945e9702d Mon Sep 17 00:00:00 2001 From: yujian <yujian@163.com> Date: 星期二, 03 十二月 2019 12:32:41 +0800 Subject: [PATCH] 品牌修改 --- fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandInfoServiceImpl.java | 34 ++++++++++++++++++++++++++-------- 1 files changed, 26 insertions(+), 8 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandInfoServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandInfoServiceImpl.java index 11967ac..25f724f 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandInfoServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandInfoServiceImpl.java @@ -95,29 +95,49 @@ state = 0; record.setState(state); } - // 鍥剧墖涓婁紶 + + String picture = null; if (file != null) { - try { + try { // 鍥剧墖涓婁紶 picture = uploadPicture(file); } catch (Exception e) { throw new BrandInfoException(1, "鍥剧墖涓婁紶澶辫触"); } } - + + String searchKey = record.getSearchKey(); + if (!StringUtil.isNullOrEmpty(searchKey)) { + if (StringUtil.isNullOrEmpty(record.getSearchKeyJD())) + record.setSearchKeyJD(searchKey); + + if (StringUtil.isNullOrEmpty(record.getSearchKeyPDD())) + record.setSearchKeyPDD(searchKey); + } + + String shopKey = record.getShopKey(); + if (!StringUtil.isNullOrEmpty(shopKey)) { + if (StringUtil.isNullOrEmpty(record.getShopKeyJD())) + record.setShopKeyJD(shopKey); + + if (StringUtil.isNullOrEmpty(record.getShopKeyPDD())) + record.setShopKeyPDD(shopKey); + } record.setName(name.trim()); + record.setUpdateTime(new Date()); + Long id = record.getId(); if (id == null) { - record.setCreateTime(new Date()); + record.setIcon(picture); + record.setWeight(500.00); record.setGoodsTotal(0); record.setShopTotal(0); - record.setUpdateTime(new Date()); + record.setCreateTime(new Date()); brandInfoMapper.insert(record); BrandInfo resultObj = new BrandInfo(); resultObj.setId(record.getId()); resultObj.setOrder(Integer.valueOf(record.getId().toString())); - resultObj.setWeight(500.00); brandInfoMapper.updateByPrimaryKeySelective(resultObj); } else { BrandInfo resultObj = brandInfoMapper.selectByPrimaryKey(id); @@ -142,11 +162,9 @@ record.setGoodsTotal(resultObj.getGoodsTotal()); record.setShopTotal(resultObj.getShopTotal()); } - record.setOrder(resultObj.getOrder()); record.setWeight(resultObj.getWeight()); record.setCreateTime(resultObj.getCreateTime()); - record.setUpdateTime(new Date()); brandInfoMapper.updateByPrimaryKey(record); if (state == 0){ -- Gitblit v1.8.0