1、先创建商品的服务类GoodsService ,注入GoodsDao
@Service
public class GoodsService {
public static final String COOKIE1_NAME_TOKEN="token";
@Autowired
GoodsDao goodsDao;
@Autowired
RedisService redisService;
//获取商品信息列表
public List<GoodsVo> getGoodsVoList() {
return goodsDao.getGoodsVoList();
}
//获取商品根据商品Id
public GoodsVo getGoodsVoByGoodsId(long goodsId) {
return goodsDao.getGoodsVoByGoodsId(goodsId);
}
//减少商品的库存
public void reduceStock(GoodsVo goodsvo) {
MiaoshaGoods goods=new MiaoshaGoods();
goods.setGoodsId(goo