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);
|
|
}
|
}
|