|
@@ -2,20 +2,22 @@ package com.chelvc.cloud.vehicle.server.service.impl;
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.chelvc.cloud.vehicle.api.constant.CategoryType;
|
|
|
import com.chelvc.cloud.vehicle.api.dto.GoodsDTO;
|
|
|
import com.chelvc.cloud.vehicle.api.dto.MerchantDTO;
|
|
|
import com.chelvc.cloud.vehicle.api.dto.MerchantDetailDTO;
|
|
|
-import com.chelvc.cloud.vehicle.api.param.GoodsQueryParam;
|
|
|
-import com.chelvc.cloud.vehicle.api.param.LocationQueryParam;
|
|
|
-import com.chelvc.cloud.vehicle.api.param.MerchantQueryParam;
|
|
|
+import com.chelvc.cloud.vehicle.api.param.*;
|
|
|
import com.chelvc.cloud.vehicle.server.copier.MerchantCopier;
|
|
|
import com.chelvc.cloud.vehicle.server.dao.MerchantMapper;
|
|
|
import com.chelvc.cloud.vehicle.server.entity.Merchant;
|
|
|
import com.chelvc.cloud.vehicle.server.service.GoodsService;
|
|
|
import com.chelvc.cloud.vehicle.server.service.MerchantService;
|
|
|
+import com.chelvc.framework.base.model.Pagination;
|
|
|
+import com.chelvc.framework.base.util.StringUtils;
|
|
|
import com.chelvc.framework.database.context.DatabaseContextHolder;
|
|
|
+import com.chelvc.framework.database.util.PagingUtils;
|
|
|
import lombok.NonNull;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import org.apache.dubbo.config.annotation.DubboService;
|
|
@@ -64,4 +66,27 @@ public class MerchantServiceImpl extends ServiceImpl<MerchantMapper, Merchant> i
|
|
|
List<CategoryType> types = this.goodsService.listMerchantGoodsCategoryTypes(id);
|
|
|
return MerchantDetailDTO.builder().merchant(merchant).goods(goods).categories(types).build();
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Long addMerchant(MerchantModifyParam param){
|
|
|
+ Merchant merchant = MerchantCopier.INSTANCE.copying(param);
|
|
|
+ this.save(merchant);
|
|
|
+ return merchant.getId();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void updateMerchant(@NonNull Long id, @NonNull MerchantModifyParam param) {
|
|
|
+ Merchant merchant = DatabaseContextHolder.getRequireEntity(this, id, "分类不存在");
|
|
|
+ MerchantCopier.INSTANCE.copying(param, merchant);
|
|
|
+ this.updateById(merchant);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Pagination<MerchantDTO> getMerchantPaging(@NonNull MerchantPagingParam param) {
|
|
|
+ Page<Merchant> page = this.lambdaQuery()
|
|
|
+ .like(StringUtils.nonEmpty(param.getName()), Merchant::getName, param.getName())
|
|
|
+ .orderByAsc(Merchant::getStatus).page(PagingUtils.convert(param.getPaging()));
|
|
|
+ return PagingUtils.convert(page, MerchantCopier.INSTANCE::copying);
|
|
|
+ }
|
|
|
}
|