Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jiedao-api-boot-master
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lanbaoming
jiedao-api-boot-master
Commits
d0ab099d
Commit
d0ab099d
authored
Aug 14, 2024
by
zhangfeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
网点区域树状列表获取
parent
2b93bf94
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
189 additions
and
0 deletions
+189
-0
NodeApi.java
...in/java/cn/iocoder/yudao/module/ecw/api/node/NodeApi.java
+2
-0
NodeTreeRegionDTO.java
...oder/yudao/module/ecw/api/node/dto/NodeTreeRegionDTO.java
+43
-0
NodeController.java
...udao/module/ecw/controller/admin/node/NodeController.java
+6
-0
NodeTreeRegionSimpleVO.java
.../ecw/controller/admin/node/vo/NodeTreeRegionSimpleVO.java
+54
-0
NodeMapper.java
...n/iocoder/yudao/module/ecw/dal/mysql/node/NodeMapper.java
+2
-0
NodeApiImpl.java
.../cn/iocoder/yudao/module/ecw/service/api/NodeApiImpl.java
+6
-0
NodeService.java
...cn/iocoder/yudao/module/ecw/service/node/NodeService.java
+1
-0
NodeServiceImpl.java
...ocoder/yudao/module/ecw/service/node/NodeServiceImpl.java
+55
-0
NodeMapper.xml
...le-ecw-impl/src/main/resources/mapper/node/NodeMapper.xml
+20
-0
No files found.
yudao-module-ecw/yudao-module-ecw-api/src/main/java/cn/iocoder/yudao/module/ecw/api/node/NodeApi.java
View file @
d0ab099d
package
cn
.
iocoder
.
yudao
.
module
.
ecw
.
api
.
node
;
package
cn
.
iocoder
.
yudao
.
module
.
ecw
.
api
.
node
;
import
cn.iocoder.yudao.module.ecw.api.node.dto.NodeRespDTO
;
import
cn.iocoder.yudao.module.ecw.api.node.dto.NodeRespDTO
;
import
cn.iocoder.yudao.module.ecw.api.node.dto.NodeTreeRegionDTO
;
import
java.util.List
;
import
java.util.List
;
public
interface
NodeApi
{
public
interface
NodeApi
{
List
<
NodeRespDTO
>
getNodesByCity
(
Long
cityId
,
Long
countryId
);
List
<
NodeRespDTO
>
getNodesByCity
(
Long
cityId
,
Long
countryId
);
List
<
NodeTreeRegionDTO
>
getNodeTreeRegion
();
}
}
yudao-module-ecw/yudao-module-ecw-api/src/main/java/cn/iocoder/yudao/module/ecw/api/node/dto/NodeTreeRegionDTO.java
0 → 100644
View file @
d0ab099d
package
cn
.
iocoder
.
yudao
.
module
.
ecw
.
api
.
node
.
dto
;
import
lombok.Data
;
@Data
public
class
NodeTreeRegionDTO
{
/**
* 国家id
*/
private
Long
countryId
;
/**
* 国家中文
*/
private
String
countryZh
;
/**
* 国家英文
*/
private
String
countryEn
;
/**
* 城市id
*/
private
Long
cityId
;
/**
* 城市中文
*/
private
String
cityZh
;
/**
* 城市英文
*/
private
String
cityEn
;
/**
* 网点id
*/
private
Long
nodeId
;
/**
* 网点中文
*/
private
String
nodeZh
;
/**
* 网点英文
*/
private
String
nodeEn
;
}
yudao-module-ecw/yudao-module-ecw-impl/src/main/java/cn/iocoder/yudao/module/ecw/controller/admin/node/NodeController.java
View file @
d0ab099d
...
@@ -104,6 +104,12 @@ public class NodeController {
...
@@ -104,6 +104,12 @@ public class NodeController {
return
success
(
NodeConvert
.
INSTANCE
.
convertPage
(
pageResult
));
return
success
(
NodeConvert
.
INSTANCE
.
convertPage
(
pageResult
));
}
}
@GetMapping
(
"/get-node-tree-region"
)
@ApiOperation
(
"获得网点树状列表"
)
public
CommonResult
<
List
<
NodeTreeRegionSimpleVO
>>
getNodeTreeRegion
()
{
return
success
(
nodeService
.
getNodeTreeRegion
());
}
@GetMapping
(
"/export-excel"
)
@GetMapping
(
"/export-excel"
)
@ApiOperation
(
"导出服务网点 Excel"
)
@ApiOperation
(
"导出服务网点 Excel"
)
@PreAuthorize
(
"@ss.hasPermission('ecw:node:export')"
)
@PreAuthorize
(
"@ss.hasPermission('ecw:node:export')"
)
...
...
yudao-module-ecw/yudao-module-ecw-impl/src/main/java/cn/iocoder/yudao/module/ecw/controller/admin/node/vo/NodeTreeRegionSimpleVO.java
0 → 100644
View file @
d0ab099d
package
cn
.
iocoder
.
yudao
.
module
.
ecw
.
controller
.
admin
.
node
.
vo
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.List
;
import
java.util.Objects
;
@Data
public
class
NodeTreeRegionSimpleVO
{
@ApiModelProperty
(
"国家id"
)
private
Long
id
;
@ApiModelProperty
(
"国家中文名"
)
private
String
labelZh
;
@ApiModelProperty
(
"国家英文名"
)
private
String
labelEn
;
@ApiModelProperty
(
"城市"
)
private
List
<
NodeCity
>
children
;
@Data
public
static
class
NodeCity
{
@ApiModelProperty
(
"城市id"
)
private
Long
id
;
@ApiModelProperty
(
"城市中文名"
)
private
String
labelZh
;
@ApiModelProperty
(
"城市英文名"
)
private
String
labelEn
;
@ApiModelProperty
(
"网点"
)
private
List
<
Node
>
children
;
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
return
false
;
NodeCity
that
=
(
NodeCity
)
o
;
return
Objects
.
equals
(
id
,
that
.
id
);
}
@Override
public
int
hashCode
()
{
return
Objects
.
hashCode
(
id
);
}
}
@Data
public
static
class
Node
{
@ApiModelProperty
(
"网点id"
)
private
Long
id
;
@ApiModelProperty
(
"网点中文名"
)
private
String
labelZh
;
@ApiModelProperty
(
"网点英文名"
)
private
String
labelEn
;
}
}
yudao-module-ecw/yudao-module-ecw-impl/src/main/java/cn/iocoder/yudao/module/ecw/dal/mysql/node/NodeMapper.java
View file @
d0ab099d
...
@@ -5,6 +5,7 @@ import java.util.*;
...
@@ -5,6 +5,7 @@ import java.util.*;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX
;
import
cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX
;
import
cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX
;
import
cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX
;
import
cn.iocoder.yudao.module.ecw.api.node.dto.NodeTreeRegionDTO
;
import
cn.iocoder.yudao.module.ecw.dal.dataobject.node.NodeDO
;
import
cn.iocoder.yudao.module.ecw.dal.dataobject.node.NodeDO
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
...
@@ -81,4 +82,5 @@ public interface NodeMapper extends BaseMapperX<NodeDO> {
...
@@ -81,4 +82,5 @@ public interface NodeMapper extends BaseMapperX<NodeDO> {
.
orderByDesc
(
NodeDO:
:
getId
));
.
orderByDesc
(
NodeDO:
:
getId
));
}
}
List
<
NodeTreeRegionDTO
>
getNodeTreeRegionList
();
}
}
yudao-module-ecw/yudao-module-ecw-impl/src/main/java/cn/iocoder/yudao/module/ecw/service/api/NodeApiImpl.java
View file @
d0ab099d
...
@@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.ecw.service.api;
...
@@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.ecw.service.api;
import
cn.iocoder.yudao.module.ecw.api.node.NodeApi
;
import
cn.iocoder.yudao.module.ecw.api.node.NodeApi
;
import
cn.iocoder.yudao.module.ecw.api.node.dto.NodeRespDTO
;
import
cn.iocoder.yudao.module.ecw.api.node.dto.NodeRespDTO
;
import
cn.iocoder.yudao.module.ecw.api.node.dto.NodeTreeRegionDTO
;
import
cn.iocoder.yudao.module.ecw.dal.dataobject.node.NodeDO
;
import
cn.iocoder.yudao.module.ecw.dal.dataobject.node.NodeDO
;
import
cn.iocoder.yudao.module.ecw.dal.mysql.node.NodeMapper
;
import
cn.iocoder.yudao.module.ecw.dal.mysql.node.NodeMapper
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
...
@@ -35,4 +36,9 @@ public class NodeApiImpl implements NodeApi {
...
@@ -35,4 +36,9 @@ public class NodeApiImpl implements NodeApi {
}
}
return
null
;
return
null
;
}
}
@Override
public
List
<
NodeTreeRegionDTO
>
getNodeTreeRegion
()
{
return
nodeMapper
.
getNodeTreeRegionList
();
}
}
}
yudao-module-ecw/yudao-module-ecw-impl/src/main/java/cn/iocoder/yudao/module/ecw/service/node/NodeService.java
View file @
d0ab099d
...
@@ -76,4 +76,5 @@ public interface NodeService {
...
@@ -76,4 +76,5 @@ public interface NodeService {
*/
*/
List
<
NodeDO
>
getNodeList
(
NodeExportReqVO
exportReqVO
);
List
<
NodeDO
>
getNodeList
(
NodeExportReqVO
exportReqVO
);
List
<
NodeTreeRegionSimpleVO
>
getNodeTreeRegion
();
}
}
yudao-module-ecw/yudao-module-ecw-impl/src/main/java/cn/iocoder/yudao/module/ecw/service/node/NodeServiceImpl.java
View file @
d0ab099d
package
cn
.
iocoder
.
yudao
.
module
.
ecw
.
service
.
node
;
package
cn
.
iocoder
.
yudao
.
module
.
ecw
.
service
.
node
;
import
cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils
;
import
cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils
;
import
cn.iocoder.yudao.module.ecw.api.node.dto.NodeTreeRegionDTO
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
...
@@ -86,6 +87,60 @@ public class NodeServiceImpl implements NodeService {
...
@@ -86,6 +87,60 @@ public class NodeServiceImpl implements NodeService {
return
nodeMapper
.
selectList
(
exportReqVO
);
return
nodeMapper
.
selectList
(
exportReqVO
);
}
}
@Override
public
List
<
NodeTreeRegionSimpleVO
>
getNodeTreeRegion
()
{
List
<
NodeTreeRegionDTO
>
nodeList
=
nodeMapper
.
getNodeTreeRegionList
();
Map
<
Long
,
NodeTreeRegionSimpleVO
>
countryMap
=
new
LinkedHashMap
<>();
Map
<
Long
,
Map
<
Long
,
NodeTreeRegionSimpleVO
.
NodeCity
>>
cityMap
=
new
LinkedHashMap
<>();
for
(
NodeTreeRegionDTO
dto
:
nodeList
)
{
Long
countryId
=
dto
.
getCountryId
();
String
countryZh
=
dto
.
getCountryZh
();
String
countryEn
=
dto
.
getCountryEn
();
Long
cityId
=
dto
.
getCityId
();
String
cityZh
=
dto
.
getCityZh
();
String
cityEn
=
dto
.
getCityEn
();
Long
nodeId
=
dto
.
getNodeId
();
String
nodeZh
=
dto
.
getNodeZh
();
String
nodeEn
=
dto
.
getNodeEn
();
// 处理国家
NodeTreeRegionSimpleVO
countryVO
=
countryMap
.
computeIfAbsent
(
countryId
,
id
->
{
NodeTreeRegionSimpleVO
vo
=
new
NodeTreeRegionSimpleVO
();
vo
.
setId
(
id
);
vo
.
setLabelZh
(
countryZh
.
trim
());
vo
.
setLabelEn
(
countryEn
);
vo
.
setChildren
(
new
ArrayList
<>());
return
vo
;
});
// 处理城市
Map
<
Long
,
NodeTreeRegionSimpleVO
.
NodeCity
>
cities
=
cityMap
.
computeIfAbsent
(
countryId
,
k
->
new
LinkedHashMap
<>());
NodeTreeRegionSimpleVO
.
NodeCity
cityVO
=
cities
.
computeIfAbsent
(
cityId
,
id
->
{
NodeTreeRegionSimpleVO
.
NodeCity
city
=
new
NodeTreeRegionSimpleVO
.
NodeCity
();
city
.
setId
(
id
);
city
.
setLabelZh
(
cityZh
.
trim
());
city
.
setLabelEn
(
cityEn
);
city
.
setChildren
(
new
ArrayList
<>());
return
city
;
});
// 处理网点
NodeTreeRegionSimpleVO
.
Node
node
=
new
NodeTreeRegionSimpleVO
.
Node
();
node
.
setId
(
nodeId
);
node
.
setLabelZh
(
nodeZh
);
node
.
setLabelEn
(
nodeEn
);
cityVO
.
getChildren
().
add
(
node
);
if
(!
countryVO
.
getChildren
().
contains
(
cityVO
))
{
countryVO
.
getChildren
().
add
(
cityVO
);
}
}
return
new
ArrayList
<>(
countryMap
.
values
());
}
@Override
@Override
public
PageResult
<
NodeDO
>
getNodePageList
(
NodePageReqVO
pageReqVO
)
{
public
PageResult
<
NodeDO
>
getNodePageList
(
NodePageReqVO
pageReqVO
)
{
IPage
<
NodeDO
>
mpPage
=
MyBatisUtils
.
buildPage
(
pageReqVO
);
IPage
<
NodeDO
>
mpPage
=
MyBatisUtils
.
buildPage
(
pageReqVO
);
...
...
yudao-module-ecw/yudao-module-ecw-impl/src/main/resources/mapper/node/NodeMapper.xml
View file @
d0ab099d
...
@@ -32,6 +32,26 @@
...
@@ -32,6 +32,26 @@
order by node.aorder desc
order by node.aorder desc
</select>
</select>
<select
id=
"getNodeTreeRegionList"
resultType=
"cn.iocoder.yudao.module.ecw.api.node.dto.NodeTreeRegionDTO"
>
SELECT
n.guojia AS countryId,
c.title_zh AS countryZh,
c.title_en AS countryEn,
n.shi AS cityId,
p.title_zh AS cityZh,
p.title_en AS cityEn,
n.id AS nodeId,
n.title_zh AS nodeZh,
n.title_en AS nodeEn
FROM
ecw_node n
LEFT JOIN
ecw_region c ON n.guojia = c.id
LEFT JOIN
ecw_region p ON n.shi = p.id
ORDER BY
n.guojia, n.shi, n.id;
</select>
</mapper>
</mapper>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment