图库相关代码&商品单位相关代码
This commit is contained in:
@@ -35,7 +35,9 @@ public class PictureClassifyServiceImpl extends ServiceImpl<PictureClassifyMappe
|
|||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
queryWrapper.and(q -> {
|
queryWrapper.and(q -> {
|
||||||
q.eq(PictureClassify::getShopId, shopId).or(q1 -> {
|
q.eq(PictureClassify::getShopId, shopId).or(q1 -> {
|
||||||
q1.eq(PictureClassify::getShopId, 0).eq(PictureClassify::getIsSystem, YesNoEnum.YES.value());
|
q1.eq(PictureClassify::getShopId, 1L);
|
||||||
|
}).or(q2 -> {
|
||||||
|
q2.eq(PictureClassify::getIsSystem, YesNoEnum.YES.value());
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
queryWrapper.eq(PictureClassify::getIsDel, DeleteEnum.NORMAL.value());
|
queryWrapper.eq(PictureClassify::getIsDel, DeleteEnum.NORMAL.value());
|
||||||
@@ -56,7 +58,9 @@ public class PictureClassifyServiceImpl extends ServiceImpl<PictureClassifyMappe
|
|||||||
boolean exists = super.exists(query().eq(PictureClassify::getName, dto.getName())
|
boolean exists = super.exists(query().eq(PictureClassify::getName, dto.getName())
|
||||||
.and(q -> {
|
.and(q -> {
|
||||||
q.eq(PictureClassify::getShopId, shopId).or(q1 -> {
|
q.eq(PictureClassify::getShopId, shopId).or(q1 -> {
|
||||||
q1.eq(PictureClassify::getShopId, 0).eq(PictureClassify::getIsSystem, YesNoEnum.YES.value());
|
q1.eq(PictureClassify::getShopId, 1L);
|
||||||
|
}).or(q2 -> {
|
||||||
|
q2.eq(PictureClassify::getIsSystem, YesNoEnum.YES.value());
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
@@ -78,7 +82,9 @@ public class PictureClassifyServiceImpl extends ServiceImpl<PictureClassifyMappe
|
|||||||
.ne(PictureClassify::getId, dto.getId())
|
.ne(PictureClassify::getId, dto.getId())
|
||||||
.and(q -> {
|
.and(q -> {
|
||||||
q.eq(PictureClassify::getShopId, shopId).or(q1 -> {
|
q.eq(PictureClassify::getShopId, shopId).or(q1 -> {
|
||||||
q1.eq(PictureClassify::getShopId, 0).eq(PictureClassify::getIsSystem, YesNoEnum.YES.value());
|
q1.eq(PictureClassify::getShopId, 1L);
|
||||||
|
}).or(q2 -> {
|
||||||
|
q2.eq(PictureClassify::getIsSystem, YesNoEnum.YES.value());
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
@@ -102,6 +108,7 @@ public class PictureClassifyServiceImpl extends ServiceImpl<PictureClassifyMappe
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void checkPictureClassify(Long id) {
|
private void checkPictureClassify(Long id) {
|
||||||
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
PictureClassify entity = super.getById(id);
|
PictureClassify entity = super.getById(id);
|
||||||
if (entity == null) {
|
if (entity == null) {
|
||||||
throw new CzgException("图片分类不存在");
|
throw new CzgException("图片分类不存在");
|
||||||
@@ -109,6 +116,9 @@ public class PictureClassifyServiceImpl extends ServiceImpl<PictureClassifyMappe
|
|||||||
if (entity.getIsSystem() == YesNoEnum.YES.value()) {
|
if (entity.getIsSystem() == YesNoEnum.YES.value()) {
|
||||||
throw new CzgException("系统预设分类不可操作");
|
throw new CzgException("系统预设分类不可操作");
|
||||||
}
|
}
|
||||||
|
if (!shopId.equals(entity.getShopId())) {
|
||||||
|
throw new CzgException("公共分类不可操作");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -7,6 +7,7 @@ import com.czg.account.entity.PictureGallery;
|
|||||||
import com.czg.account.param.PictureGalleryParam;
|
import com.czg.account.param.PictureGalleryParam;
|
||||||
import com.czg.account.service.PictureGalleryService;
|
import com.czg.account.service.PictureGalleryService;
|
||||||
import com.czg.enums.DeleteEnum;
|
import com.czg.enums.DeleteEnum;
|
||||||
|
import com.czg.exception.CzgException;
|
||||||
import com.czg.sa.StpKit;
|
import com.czg.sa.StpKit;
|
||||||
import com.czg.service.account.mapper.PictureGalleryMapper;
|
import com.czg.service.account.mapper.PictureGalleryMapper;
|
||||||
import com.czg.utils.PageUtil;
|
import com.czg.utils.PageUtil;
|
||||||
@@ -33,8 +34,13 @@ public class PictureGalleryServiceImpl extends ServiceImpl<PictureGalleryMapper,
|
|||||||
if (ObjUtil.isNotNull(param.getPictureClassifyId())) {
|
if (ObjUtil.isNotNull(param.getPictureClassifyId())) {
|
||||||
queryWrapper.eq(PictureGallery::getPictureClassifyId, param.getPictureClassifyId());
|
queryWrapper.eq(PictureGallery::getPictureClassifyId, param.getPictureClassifyId());
|
||||||
}
|
}
|
||||||
|
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
queryWrapper.eq(PictureGallery::getShopId, shopId);
|
queryWrapper.and(q -> {
|
||||||
|
q.eq(PictureGallery::getShopId, shopId).or(q1 -> {
|
||||||
|
q1.eq(PictureGallery::getShopId, 1L);
|
||||||
|
});
|
||||||
|
});
|
||||||
queryWrapper.eq(PictureGallery::getIsDel, DeleteEnum.NORMAL.value());
|
queryWrapper.eq(PictureGallery::getIsDel, DeleteEnum.NORMAL.value());
|
||||||
queryWrapper.orderBy(PictureGallery::getId, false);
|
queryWrapper.orderBy(PictureGallery::getId, false);
|
||||||
return queryWrapper;
|
return queryWrapper;
|
||||||
@@ -61,7 +67,11 @@ public class PictureGalleryServiceImpl extends ServiceImpl<PictureGalleryMapper,
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deletePictureGallery(Long id) {
|
public void deletePictureGallery(Long id) {
|
||||||
|
PictureGallery entity = super.getById(id);
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
|
if (!shopId.equals(entity.getShopId())) {
|
||||||
|
throw new CzgException("公共图片不可操作");
|
||||||
|
}
|
||||||
UpdateChain.of(PictureGallery.class)
|
UpdateChain.of(PictureGallery.class)
|
||||||
.set(PictureGallery::getIsDel, DeleteEnum.DELETED.value())
|
.set(PictureGallery::getIsDel, DeleteEnum.DELETED.value())
|
||||||
.eq(PictureGallery::getShopId, shopId)
|
.eq(PictureGallery::getShopId, shopId)
|
||||||
|
|||||||
@@ -38,7 +38,9 @@ public class ShopProdUnitServiceImpl extends ServiceImpl<ShopProdUnitMapper, Sho
|
|||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
queryWrapper.and(q -> {
|
queryWrapper.and(q -> {
|
||||||
q.eq(ShopProdUnit::getShopId, shopId).or(q1 -> {
|
q.eq(ShopProdUnit::getShopId, shopId).or(q1 -> {
|
||||||
q1.eq(ShopProdUnit::getShopId, 0).eq(ShopProdUnit::getIsSystem, YesNoEnum.YES.value());
|
q1.eq(ShopProdUnit::getShopId, 1L);
|
||||||
|
}).or(q2 -> {
|
||||||
|
q2.eq(ShopProdUnit::getIsSystem, YesNoEnum.YES.value());
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
queryWrapper.orderBy(ShopProdUnit::getId, false);
|
queryWrapper.orderBy(ShopProdUnit::getId, false);
|
||||||
@@ -70,7 +72,9 @@ public class ShopProdUnitServiceImpl extends ServiceImpl<ShopProdUnitMapper, Sho
|
|||||||
boolean exists = super.exists(query().eq(ShopProdUnit::getName, dto.getName())
|
boolean exists = super.exists(query().eq(ShopProdUnit::getName, dto.getName())
|
||||||
.and(q -> {
|
.and(q -> {
|
||||||
q.eq(ShopProdUnit::getShopId, shopId).or(q1 -> {
|
q.eq(ShopProdUnit::getShopId, shopId).or(q1 -> {
|
||||||
q1.eq(ShopProdUnit::getShopId, 0).eq(ShopProdUnit::getIsSystem, YesNoEnum.YES.value());
|
q1.eq(ShopProdUnit::getShopId, 1L);
|
||||||
|
}).or(q2 -> {
|
||||||
|
q2.eq(ShopProdUnit::getIsSystem, YesNoEnum.YES.value());
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
if (exists) {
|
if (exists) {
|
||||||
@@ -95,7 +99,9 @@ public class ShopProdUnitServiceImpl extends ServiceImpl<ShopProdUnitMapper, Sho
|
|||||||
.ne(ShopProdUnit::getId, dto.getId())
|
.ne(ShopProdUnit::getId, dto.getId())
|
||||||
.and(q -> {
|
.and(q -> {
|
||||||
q.eq(ShopProdUnit::getShopId, shopId).or(q1 -> {
|
q.eq(ShopProdUnit::getShopId, shopId).or(q1 -> {
|
||||||
q1.eq(ShopProdUnit::getShopId, 0).eq(ShopProdUnit::getIsSystem, YesNoEnum.YES.value());
|
q1.eq(ShopProdUnit::getShopId, 1L);
|
||||||
|
}).or(q2 -> {
|
||||||
|
q2.eq(ShopProdUnit::getIsSystem, YesNoEnum.YES.value());
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
@@ -136,6 +142,7 @@ public class ShopProdUnitServiceImpl extends ServiceImpl<ShopProdUnitMapper, Sho
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void checkShopProdUnit(Long id) {
|
private void checkShopProdUnit(Long id) {
|
||||||
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
ShopProdUnit entity = super.getById(id);
|
ShopProdUnit entity = super.getById(id);
|
||||||
if (entity == null) {
|
if (entity == null) {
|
||||||
throw new CzgException("单位信息不存在");
|
throw new CzgException("单位信息不存在");
|
||||||
@@ -143,5 +150,8 @@ public class ShopProdUnitServiceImpl extends ServiceImpl<ShopProdUnitMapper, Sho
|
|||||||
if (entity.getIsSystem() == YesNoEnum.YES.value()) {
|
if (entity.getIsSystem() == YesNoEnum.YES.value()) {
|
||||||
throw new CzgException("系统预设单位不可操作");
|
throw new CzgException("系统预设单位不可操作");
|
||||||
}
|
}
|
||||||
|
if (!shopId.equals(entity.getShopId())) {
|
||||||
|
throw new CzgException("公共单位不可操作");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user