|
@@ -1,6 +1,5 @@
|
|
package edu.travel.country.service.impl;
|
|
package edu.travel.country.service.impl;
|
|
|
|
|
|
-import com.alibaba.nacos.client.naming.utils.CollectionUtils;
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
@@ -9,6 +8,7 @@ import edu.travel.country.entity.BaseCountry;
|
|
import edu.travel.country.entity.BaseCountryServe;
|
|
import edu.travel.country.entity.BaseCountryServe;
|
|
import edu.travel.country.mapper.BaseCountryMapper;
|
|
import edu.travel.country.mapper.BaseCountryMapper;
|
|
import edu.travel.country.mapper.BaseCountryServeMapper;
|
|
import edu.travel.country.mapper.BaseCountryServeMapper;
|
|
|
|
+import edu.travel.country.mapper.ShopCurrencyMapper;
|
|
import edu.travel.country.service.BaseCountryServeService;
|
|
import edu.travel.country.service.BaseCountryServeService;
|
|
import edu.travel.dto.BaseCountryServeDto;
|
|
import edu.travel.dto.BaseCountryServeDto;
|
|
import edu.travel.rpc.RPCBaseResponse;
|
|
import edu.travel.rpc.RPCBaseResponse;
|
|
@@ -20,21 +20,24 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
-import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
@Service
|
|
@Service
|
|
public class BaseCountryServeServiceImpl extends SysServiceImpl<BaseCountryServeMapper, BaseCountryServe> implements BaseCountryServeService {
|
|
public class BaseCountryServeServiceImpl extends SysServiceImpl<BaseCountryServeMapper, BaseCountryServe> implements BaseCountryServeService {
|
|
@Autowired
|
|
@Autowired
|
|
private BaseCountryMapper baseCountryMapper;
|
|
private BaseCountryMapper baseCountryMapper;
|
|
- //分页
|
|
|
|
- @Override
|
|
|
|
- public RPCBaseResponse<IPage<BaseCountryServeVo>> getCountryServePage(BaseCountryServeDto dto) {
|
|
|
|
- Page<BaseCountryServe> baseCountryServePage = new Page<>(dto.getCurrentPage(), dto.getPageSize());
|
|
|
|
- IPage<BaseCountryServe> pageLink = super.getPageLink(new LambdaQueryWrapper<BaseCountryServe>(), baseCountryServePage);
|
|
|
|
- IPage<BaseCountryServeVo> result = new Page<>();
|
|
|
|
- BeanUtils.copyProperties(pageLink, result);
|
|
|
|
- return new RPCBaseResponse<>(200,"SUCCESS",result);
|
|
|
|
- }
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private ShopCurrencyMapper shopCurrencyMapper;
|
|
|
|
+
|
|
|
|
+//分页连表
|
|
|
|
+@Override
|
|
|
|
+public RPCBaseResponse<List<BaseCountryServe>> getCountryServeCurrencyPageForm(BaseCountryServeDto dto) {
|
|
|
|
+ // 查询所有国家服务数据
|
|
|
|
+ LambdaQueryWrapper<BaseCountryServe> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
+ // 查询所有的数据
|
|
|
|
+ List<BaseCountryServe> baseCountryServeList = super.getListLink(queryWrapper);
|
|
|
|
+ return new RPCBaseResponse <>(200, "SUCCESS", baseCountryServeList);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
|
|
/**
|
|
/**
|
|
* 服务国家树
|
|
* 服务国家树
|
|
@@ -46,7 +49,6 @@ public class BaseCountryServeServiceImpl extends SysServiceImpl<BaseCountryServe
|
|
LambdaQueryWrapper<BaseCountryServe> queryWrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<BaseCountryServe> queryWrapper = new LambdaQueryWrapper<>();
|
|
List<BaseCountryServe> baseCountryServeList = super.getListLink(queryWrapper);
|
|
List<BaseCountryServe> baseCountryServeList = super.getListLink(queryWrapper);
|
|
|
|
|
|
-
|
|
|
|
// 构建树形结构
|
|
// 构建树形结构
|
|
List<BaseCountryServeVo> baseCountryServeTree = buildCountryServeTree(baseCountryServeList);
|
|
List<BaseCountryServeVo> baseCountryServeTree = buildCountryServeTree(baseCountryServeList);
|
|
|
|
|
|
@@ -54,6 +56,8 @@ public class BaseCountryServeServiceImpl extends SysServiceImpl<BaseCountryServe
|
|
return new RPCBaseResponse<>(200, "SUCCESS", baseCountryServeTree);
|
|
return new RPCBaseResponse<>(200, "SUCCESS", baseCountryServeTree);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
// 树构建方法
|
|
// 树构建方法
|
|
private List<BaseCountryServeVo> buildCountryServeTree(List<BaseCountryServe> baseCountryServeList) {
|
|
private List<BaseCountryServeVo> buildCountryServeTree(List<BaseCountryServe> baseCountryServeList) {
|
|
Map<Long, BaseCountryServeVo> serveMap = new HashMap<>();
|
|
Map<Long, BaseCountryServeVo> serveMap = new HashMap<>();
|
|
@@ -103,5 +107,4 @@ public class BaseCountryServeServiceImpl extends SysServiceImpl<BaseCountryServe
|
|
|
|
|
|
return rootCountries;
|
|
return rootCountries;
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|