Helius
2021-11-01 110a99baa82a748bee993ad01ca03370c9dc0cf2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
package com.matrix.system.hive.service.imp;
  
import com.matrix.core.pojo.PaginationVO;
 
 
import com.matrix.system.hive.bean.SysStoreInfo;
import com.matrix.system.hive.dao.SysStoreInfoDao;
import com.matrix.system.hive.pojo.StoreInOutRecordVO;
import com.matrix.system.hive.service.SysStoreInfoService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.beans.factory.annotation.Autowired;
 
import java.util.List;
 
/**
 *
 * @date 2016-07-17 10:23
 */
@Service("sysStoreInfoService")
public class  SysStoreInfoServiceImpl implements SysStoreInfoService {
 
    
    @Autowired
    private SysStoreInfoDao sysStoreInfoDao;
    
    
    @Override
    @Transactional(rollbackFor = Exception.class)
    public int add(SysStoreInfo sysStoreInfo){
        
        SysStoreInfo storeInfo = this.sysStoreInfoDao.getStoreByGoodsId(sysStoreInfo);
        if(storeInfo!=null){
            
            storeInfo.setStoreTotal(storeInfo.getStoreTotal()+sysStoreInfo.getStoreTotal());
            storeInfo.setGoodsPrice(storeInfo.getGoodsPrice()+sysStoreInfo.getGoodsPrice());
            return this.sysStoreInfoDao.update(storeInfo);
        }else{  
            return sysStoreInfoDao.insert(sysStoreInfo);
        }    
    }
 
 
 
       
    @Override
    public int modify(SysStoreInfo sysStoreInfo){
    
        
        return sysStoreInfoDao.update(sysStoreInfo);
    
    }
    
    @Override
    public int remove(List<Long> list){
    
        return sysStoreInfoDao.deleteByIds(list);
    
    }
 
    @Override
    public int removeById(Long iD){
    
        return sysStoreInfoDao.deleteById(iD);
    
    }
 
 
 
 
    @Override
    public List<SysStoreInfo> findInPage(SysStoreInfo sysStoreInfo,  PaginationVO pageVo){
        return sysStoreInfoDao.selectInPage(sysStoreInfo , pageVo);
    
    }
    
    @Override
    public List<SysStoreInfo> findByModel(SysStoreInfo sysStoreInfo){
    
        return sysStoreInfoDao.selectByModel(sysStoreInfo);
    
    }
    
    @Override
    public int  findTotal(SysStoreInfo sysStoreInfo){
    
        return sysStoreInfoDao.selectTotalRecord(sysStoreInfo);
    
    }
    
    @Override
    public SysStoreInfo  findById(Long iD){
    
        return sysStoreInfoDao.selectById(iD);
    
    }
}