|
@@ -1,5 +1,7 @@
|
|
|
package org.linlinjava.litemall.db.service;
|
|
package org.linlinjava.litemall.db.service;
|
|
|
|
|
|
|
|
|
|
+import org.apache.ibatis.annotations.Param;
|
|
|
|
|
+import org.linlinjava.litemall.db.dao.GoodsProductMapper;
|
|
|
import org.linlinjava.litemall.db.dao.LitemallGoodsProductMapper;
|
|
import org.linlinjava.litemall.db.dao.LitemallGoodsProductMapper;
|
|
|
import org.linlinjava.litemall.db.domain.LitemallGoodsProduct;
|
|
import org.linlinjava.litemall.db.domain.LitemallGoodsProduct;
|
|
|
import org.linlinjava.litemall.db.domain.LitemallGoodsProductExample;
|
|
import org.linlinjava.litemall.db.domain.LitemallGoodsProductExample;
|
|
@@ -12,42 +14,47 @@ import java.util.List;
|
|
|
@Service
|
|
@Service
|
|
|
public class LitemallGoodsProductService {
|
|
public class LitemallGoodsProductService {
|
|
|
@Resource
|
|
@Resource
|
|
|
- private LitemallGoodsProductMapper goodsProductMapper;
|
|
|
|
|
|
|
+ private LitemallGoodsProductMapper litemallGoodsProductMapper;
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private GoodsProductMapper goodsProductMapper;
|
|
|
|
|
|
|
|
public List<LitemallGoodsProduct> queryByGid(Integer gid) {
|
|
public List<LitemallGoodsProduct> queryByGid(Integer gid) {
|
|
|
LitemallGoodsProductExample example = new LitemallGoodsProductExample();
|
|
LitemallGoodsProductExample example = new LitemallGoodsProductExample();
|
|
|
example.or().andGoodsIdEqualTo(gid).andDeletedEqualTo(false);
|
|
example.or().andGoodsIdEqualTo(gid).andDeletedEqualTo(false);
|
|
|
- return goodsProductMapper.selectByExample(example);
|
|
|
|
|
|
|
+ return litemallGoodsProductMapper.selectByExample(example);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public LitemallGoodsProduct findById(Integer id) {
|
|
public LitemallGoodsProduct findById(Integer id) {
|
|
|
- return goodsProductMapper.selectByPrimaryKey(id);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- public int updateById(LitemallGoodsProduct goodsProduct) {
|
|
|
|
|
- goodsProduct.setUpdateTime(LocalDateTime.now());
|
|
|
|
|
- return goodsProductMapper.updateByPrimaryKeySelective(goodsProduct);
|
|
|
|
|
|
|
+ return litemallGoodsProductMapper.selectByPrimaryKey(id);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public void deleteById(Integer id) {
|
|
public void deleteById(Integer id) {
|
|
|
- goodsProductMapper.logicalDeleteByPrimaryKey(id);
|
|
|
|
|
|
|
+ litemallGoodsProductMapper.logicalDeleteByPrimaryKey(id);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public void add(LitemallGoodsProduct goodsProduct) {
|
|
public void add(LitemallGoodsProduct goodsProduct) {
|
|
|
goodsProduct.setAddTime(LocalDateTime.now());
|
|
goodsProduct.setAddTime(LocalDateTime.now());
|
|
|
goodsProduct.setUpdateTime(LocalDateTime.now());
|
|
goodsProduct.setUpdateTime(LocalDateTime.now());
|
|
|
- goodsProductMapper.insertSelective(goodsProduct);
|
|
|
|
|
|
|
+ litemallGoodsProductMapper.insertSelective(goodsProduct);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public int count() {
|
|
public int count() {
|
|
|
LitemallGoodsProductExample example = new LitemallGoodsProductExample();
|
|
LitemallGoodsProductExample example = new LitemallGoodsProductExample();
|
|
|
example.or().andDeletedEqualTo(false);
|
|
example.or().andDeletedEqualTo(false);
|
|
|
- return (int) goodsProductMapper.countByExample(example);
|
|
|
|
|
|
|
+ return (int) litemallGoodsProductMapper.countByExample(example);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public void deleteByGid(Integer gid) {
|
|
public void deleteByGid(Integer gid) {
|
|
|
LitemallGoodsProductExample example = new LitemallGoodsProductExample();
|
|
LitemallGoodsProductExample example = new LitemallGoodsProductExample();
|
|
|
example.or().andGoodsIdEqualTo(gid);
|
|
example.or().andGoodsIdEqualTo(gid);
|
|
|
- goodsProductMapper.logicalDeleteByExample(example);
|
|
|
|
|
|
|
+ litemallGoodsProductMapper.logicalDeleteByExample(example);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public int addStock(Integer id, Short num){
|
|
|
|
|
+ return goodsProductMapper.addStock(id, num);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public int reduceStock(Integer id, Short num){
|
|
|
|
|
+ return goodsProductMapper.reduceStock(id, num);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|