From 89cc8f054c27f70fcfe16f14554a8a12e0c19e23 Mon Sep 17 00:00:00 2001
From: yujian <yujian@163.com>
Date: 星期三, 18 十二月 2019 09:22:31 +0800
Subject: [PATCH] 邀请统计
---
fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandClassServiceImpl.java | 48 +++++++++++++++++++-----------------------------
1 files changed, 19 insertions(+), 29 deletions(-)
diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandClassServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandClassServiceImpl.java
index 6414d77..a70a564 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandClassServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandClassServiceImpl.java
@@ -28,6 +28,13 @@
@Resource
private BrandClassShopService brandClassShopService;
+
+ @Override
+ public BrandClass selectByPrimaryKey(Long id) {
+ return brandClassMapper.selectByPrimaryKey(id);
+ }
+
+
@Override
public List<BrandClass> listEffective() {
return brandClassMapper.listEffective();
@@ -44,38 +51,30 @@
@Override
public void saveObject(BrandClass record) throws BrandClassException, Exception{
Long gcid = record.getGcid();
- if (gcid != null) {
- GoodsClass goodsClass = goodsClassService.selectByPrimaryKey(gcid);
- if (goodsClass != null) {
- record.setName(goodsClass.getName());
- record.setGoodsClass(goodsClass);
- }
- }
+ if (gcid != null)
+ record.setGoodsClass(new GoodsClass(gcid));
String name = record.getName();
- if (name == null || name.trim().length() == 0) {
+ if (name == null || name.trim().length() == 0)
throw new BrandClassException(1, "鍚嶇О鍜屽垎绫讳笉鑳藉悓鏃朵负绌�");
- }
Integer state = record.getState();
- if (state == null) {
+ if (state == null)
record.setState(0);
- }
+
+ record.setUpdateTime(new Date());
Long id = record.getId();
if (id == null) {
record.setOrderBy(brandClassMapper.getMaxOrder() + 1);
record.setCreateTime(new Date());
- record.setUpdateTime(new Date());
brandClassMapper.insert(record);
} else {
BrandClass resultObj = brandClassMapper.selectByPrimaryKey(id);
- if (resultObj == null) {
+ if (resultObj == null)
throw new BrandClassException(1, "淇敼鍐呭宸蹭笉瀛樺湪");
- }
record.setOrderBy(resultObj.getOrderBy());
record.setCreateTime(resultObj.getCreateTime());
- record.setUpdateTime(new Date());
brandClassMapper.updateByPrimaryKey(record);
}
}
@@ -83,26 +82,22 @@
@Override
public void updateOrder(Long id, Integer moveType) throws BrandClassException, Exception{
-
- if (moveType == null || (!moveType.equals(1) && !moveType.equals(-1))) {
+ if (moveType == null || (!moveType.equals(1) && !moveType.equals(-1)))
throw new BrandClassException(1, "浼犻�掔殑绫诲瀷涓嶆纭�");
- }
- if (id == null) {
+ if (id == null)
throw new BrandClassException(1, "ID涓嶈兘涓虹┖");
- }
BrandClass resultObj = brandClassMapper.selectByPrimaryKey(id);
- if (resultObj == null) {
+ if (resultObj == null)
throw new BrandClassException(1, "鎿嶄綔鏁版嵁宸蹭笉瀛樺湪");
- }
Integer oldOrder = resultObj.getOrderBy();
BrandClass changeObj = brandClassMapper.getByAdjoinOrder(oldOrder, moveType);
- if (changeObj == null ) {
+ if (changeObj == null )
throw new BrandClassException(1, "宸茬粡鍦ㄦ渶杈圭紭锛屾棤鍙氦鎹㈢殑浣嶇疆");
- }
+
// 浜ゆ崲鎺掑簭搴忓彿
resultObj.setOrderBy(changeObj.getOrderBy());
changeObj.setOrderBy(oldOrder);
@@ -114,16 +109,12 @@
@Override
public int deleteBatchByPrimaryKey(List<Long> list) {
- // 鍒犻櫎宸插尮閰嶇殑鍒嗙被鍏崇郴
- brandClassShopService.deleteBatchByClassId(list);
-
return brandClassMapper.deleteBatchByPrimaryKey(list);
}
@Override
public List<BrandClass> listQuery(long start, int count, String key, Integer state) {
-
List<BrandClass> listQuery = brandClassMapper.listQuery(start, count, key, state);
if (listQuery == null || listQuery.size() == 0) {
return listQuery;
@@ -147,7 +138,6 @@
public long countQuery(String key, Integer state) {
return brandClassMapper.countQuery(key, state);
}
-
}
--
Gitblit v1.8.0