|
@@ -408,6 +408,9 @@ public class GoodsServiceImpl implements GoodsService {
|
|
public int enSale(Integer id) {
|
|
public int enSale(Integer id) {
|
|
CurrentUserLoginVo user = ShiroUtils.getUserEntity();
|
|
CurrentUserLoginVo user = ShiroUtils.getUserEntity();
|
|
GoodsEntity goodsEntity = queryObject(id);
|
|
GoodsEntity goodsEntity = queryObject(id);
|
|
|
|
+ if(goodsEntity == null){
|
|
|
|
+ throw new RRException("此商品不存在!");
|
|
|
|
+ }
|
|
if (1 == goodsEntity.getIsOnSale()) {
|
|
if (1 == goodsEntity.getIsOnSale()) {
|
|
throw new RRException("此商品已处于上架状态!");
|
|
throw new RRException("此商品已处于上架状态!");
|
|
}
|
|
}
|
|
@@ -421,6 +424,9 @@ public class GoodsServiceImpl implements GoodsService {
|
|
public int unSale(Integer id) {
|
|
public int unSale(Integer id) {
|
|
CurrentUserLoginVo user = ShiroUtils.getUserEntity();
|
|
CurrentUserLoginVo user = ShiroUtils.getUserEntity();
|
|
GoodsEntity goodsEntity = queryObject(id);
|
|
GoodsEntity goodsEntity = queryObject(id);
|
|
|
|
+ if(goodsEntity == null){
|
|
|
|
+ throw new RRException("此商品不存在!");
|
|
|
|
+ }
|
|
if (0 == goodsEntity.getIsOnSale()) {
|
|
if (0 == goodsEntity.getIsOnSale()) {
|
|
throw new RRException("此商品已处于下架状态!");
|
|
throw new RRException("此商品已处于下架状态!");
|
|
}
|
|
}
|