|
@@ -1,4 +1,4 @@
|
|
|
-package org.dromara.minigame.service.impl;
|
|
|
+package org.dromara.game.service.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
@@ -8,11 +8,11 @@ import org.dromara.common.core.utils.MapstructUtils;
|
|
|
import org.dromara.common.core.utils.StringUtils;
|
|
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
|
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
|
-import org.dromara.minigame.domain.Product;
|
|
|
-import org.dromara.minigame.domain.bo.ProductBo;
|
|
|
-import org.dromara.minigame.domain.vo.ProductVo;
|
|
|
-import org.dromara.minigame.mapper.ProductMapper;
|
|
|
-import org.dromara.minigame.service.IProductService;
|
|
|
+import org.dromara.game.domain.PlatProduct;
|
|
|
+import org.dromara.game.domain.bo.PlatProductBo;
|
|
|
+import org.dromara.game.domain.vo.PlatProductVo;
|
|
|
+import org.dromara.game.mapper.PlatProductMapper;
|
|
|
+import org.dromara.game.service.IPlatProductService;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.Collection;
|
|
@@ -23,13 +23,13 @@ import java.util.Map;
|
|
|
* 产品Service业务层处理
|
|
|
*
|
|
|
* @author Hixon
|
|
|
- * @date 2024-08-05
|
|
|
+ * @date 2024-08-07
|
|
|
*/
|
|
|
@RequiredArgsConstructor
|
|
|
@Service
|
|
|
-public class ProductServiceImpl implements IProductService {
|
|
|
+public class PlatProductServiceImpl implements IPlatProductService {
|
|
|
|
|
|
- private final ProductMapper baseMapper;
|
|
|
+ private final PlatProductMapper baseMapper;
|
|
|
|
|
|
/**
|
|
|
* 查询产品
|
|
@@ -38,7 +38,7 @@ public class ProductServiceImpl implements IProductService {
|
|
|
* @return 产品
|
|
|
*/
|
|
|
@Override
|
|
|
- public ProductVo queryById(Long id){
|
|
|
+ public PlatProductVo queryById(Long id){
|
|
|
return baseMapper.selectVoById(id);
|
|
|
}
|
|
|
|
|
@@ -50,9 +50,9 @@ public class ProductServiceImpl implements IProductService {
|
|
|
* @return 产品分页列表
|
|
|
*/
|
|
|
@Override
|
|
|
- public TableDataInfo<ProductVo> queryPageList(ProductBo bo, PageQuery pageQuery) {
|
|
|
- LambdaQueryWrapper<Product> lqw = buildQueryWrapper(bo);
|
|
|
- Page<ProductVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
|
|
+ public TableDataInfo<PlatProductVo> queryPageList(PlatProductBo bo, PageQuery pageQuery) {
|
|
|
+ LambdaQueryWrapper<PlatProduct> lqw = buildQueryWrapper(bo);
|
|
|
+ Page<PlatProductVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
|
|
return TableDataInfo.build(result);
|
|
|
}
|
|
|
|
|
@@ -63,16 +63,16 @@ public class ProductServiceImpl implements IProductService {
|
|
|
* @return 产品列表
|
|
|
*/
|
|
|
@Override
|
|
|
- public List<ProductVo> queryList(ProductBo bo) {
|
|
|
- LambdaQueryWrapper<Product> lqw = buildQueryWrapper(bo);
|
|
|
+ public List<PlatProductVo> queryList(PlatProductBo bo) {
|
|
|
+ LambdaQueryWrapper<PlatProduct> lqw = buildQueryWrapper(bo);
|
|
|
return baseMapper.selectVoList(lqw);
|
|
|
}
|
|
|
|
|
|
- private LambdaQueryWrapper<Product> buildQueryWrapper(ProductBo bo) {
|
|
|
+ private LambdaQueryWrapper<PlatProduct> buildQueryWrapper(PlatProductBo bo) {
|
|
|
Map<String, Object> params = bo.getParams();
|
|
|
- LambdaQueryWrapper<Product> lqw = Wrappers.lambdaQuery();
|
|
|
- lqw.eq(bo.getCategoryId() != null, Product::getCategoryId, bo.getCategoryId());
|
|
|
- lqw.like(StringUtils.isNotBlank(bo.getName()), Product::getName, bo.getName());
|
|
|
+ LambdaQueryWrapper<PlatProduct> lqw = Wrappers.lambdaQuery();
|
|
|
+ lqw.eq(bo.getCategoryId() != null, PlatProduct::getCategoryId, bo.getCategoryId());
|
|
|
+ lqw.like(StringUtils.isNotBlank(bo.getName()), PlatProduct::getName, bo.getName());
|
|
|
return lqw;
|
|
|
}
|
|
|
|
|
@@ -83,8 +83,8 @@ public class ProductServiceImpl implements IProductService {
|
|
|
* @return 是否新增成功
|
|
|
*/
|
|
|
@Override
|
|
|
- public Boolean insertByBo(ProductBo bo) {
|
|
|
- Product add = MapstructUtils.convert(bo, Product.class);
|
|
|
+ public Boolean insertByBo(PlatProductBo bo) {
|
|
|
+ PlatProduct add = MapstructUtils.convert(bo, PlatProduct.class);
|
|
|
validEntityBeforeSave(add);
|
|
|
boolean flag = baseMapper.insert(add) > 0;
|
|
|
if (flag) {
|
|
@@ -100,8 +100,8 @@ public class ProductServiceImpl implements IProductService {
|
|
|
* @return 是否修改成功
|
|
|
*/
|
|
|
@Override
|
|
|
- public Boolean updateByBo(ProductBo bo) {
|
|
|
- Product update = MapstructUtils.convert(bo, Product.class);
|
|
|
+ public Boolean updateByBo(PlatProductBo bo) {
|
|
|
+ PlatProduct update = MapstructUtils.convert(bo, PlatProduct.class);
|
|
|
validEntityBeforeSave(update);
|
|
|
return baseMapper.updateById(update) > 0;
|
|
|
}
|
|
@@ -109,7 +109,7 @@ public class ProductServiceImpl implements IProductService {
|
|
|
/**
|
|
|
* 保存前的数据校验
|
|
|
*/
|
|
|
- private void validEntityBeforeSave(Product entity){
|
|
|
+ private void validEntityBeforeSave(PlatProduct entity){
|
|
|
//TODO 做一些数据校验,如唯一约束
|
|
|
}
|
|
|
|