Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
setup-manager
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
setup-manager
Commits
23fcd536
Commit
23fcd536
authored
Nov 01, 2024
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加区域树
parent
efa10d54
Changes
17
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
1327 additions
and
353 deletions
+1327
-353
setup-project-manager/src/main/java/com/mortals/xhx/common/code/AreaLevelEnum.java
.../main/java/com/mortals/xhx/common/code/AreaLevelEnum.java
+34
-41
setup-project-manager/src/main/java/com/mortals/xhx/common/code/HaveGetDeptEnum.java
...ain/java/com/mortals/xhx/common/code/HaveGetDeptEnum.java
+65
-0
setup-project-manager/src/main/java/com/mortals/xhx/common/code/HaveGetMatterListEnum.java
...va/com/mortals/xhx/common/code/HaveGetMatterListEnum.java
+65
-0
setup-project-manager/src/main/java/com/mortals/xhx/common/code/HaveSonAreaEnum.java
...ain/java/com/mortals/xhx/common/code/HaveSonAreaEnum.java
+65
-0
setup-project-manager/src/main/java/com/mortals/xhx/common/code/HaveSonDeptEnum.java
...ain/java/com/mortals/xhx/common/code/HaveSonDeptEnum.java
+65
-0
setup-project-manager/src/main/java/com/mortals/xhx/common/code/StatusEnum.java
...src/main/java/com/mortals/xhx/common/code/StatusEnum.java
+65
-0
setup-project-manager/src/main/java/com/mortals/xhx/module/base/dao/BaseAreaDao.java
...ain/java/com/mortals/xhx/module/base/dao/BaseAreaDao.java
+9
-2
setup-project-manager/src/main/java/com/mortals/xhx/module/base/dao/ibatis/BaseAreaDaoImpl.java
...m/mortals/xhx/module/base/dao/ibatis/BaseAreaDaoImpl.java
+9
-4
setup-project-manager/src/main/java/com/mortals/xhx/module/base/model/BaseAreaEntity.java
...ava/com/mortals/xhx/module/base/model/BaseAreaEntity.java
+21
-234
setup-project-manager/src/main/java/com/mortals/xhx/module/base/model/BaseAreaQuery.java
...java/com/mortals/xhx/module/base/model/BaseAreaQuery.java
+327
-2
setup-project-manager/src/main/java/com/mortals/xhx/module/base/model/BaseAreaTreeSelect.java
...com/mortals/xhx/module/base/model/BaseAreaTreeSelect.java
+114
-0
setup-project-manager/src/main/java/com/mortals/xhx/module/base/model/vo/BaseAreaVo.java
...java/com/mortals/xhx/module/base/model/vo/BaseAreaVo.java
+15
-10
setup-project-manager/src/main/java/com/mortals/xhx/module/base/service/BaseAreaService.java
.../com/mortals/xhx/module/base/service/BaseAreaService.java
+35
-10
setup-project-manager/src/main/java/com/mortals/xhx/module/base/service/impl/BaseAreaServiceImpl.java
...als/xhx/module/base/service/impl/BaseAreaServiceImpl.java
+114
-9
setup-project-manager/src/main/java/com/mortals/xhx/module/base/web/BaseAreaController.java
...a/com/mortals/xhx/module/base/web/BaseAreaController.java
+86
-23
setup-project-manager/src/main/resources/sqlmap/module/base/BaseAreaMapper.xml
.../src/main/resources/sqlmap/module/base/BaseAreaMapper.xml
+172
-18
setup-project-manager/src/test/java/com/mortals/httpclient/base/BaseAreaController.http
.../java/com/mortals/httpclient/base/BaseAreaController.http
+66
-0
No files found.
setup-project-manager/src/main/java/com/mortals/xhx/common/code/AreaLevelEnum.java
View file @
23fcd536
package
com.mortals.xhx.common.code
;
import
com.mortals.framework.ap.SysConstains
;
import
com.mortals.framework.common.IBaseEnum
;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
/**
* 区域级别
*
* @author yiqimin
* @create 2018/09/26
*/
public
enum
AreaLevelEnum
implements
IBaseEnum
{
PROVINCE
(
1
,
"省"
,
SysConstains
.
STYLE_DEFAULT
),
CITY
(
2
,
"市"
,
SysConstains
.
STYLE_DEFAULT
),
AREA
(
3
,
"区/县"
,
SysConstains
.
STYLE_DEFAULT
),
TOWN
(
4
,
"镇"
,
SysConstains
.
STYLE_DEFAULT
);
private
int
value
;
* 区域等级(1.省,2.地市州,3.区县,4.街道,5.社区)枚举类
*
* @author zxfei
*/
public
enum
AreaLevelEnum
{
省
(
1
,
"省"
),
地市州
(
2
,
"地市州"
),
区县
(
3
,
"区县"
),
街道
(
4
,
"街道"
),
社区
(
5
,
"社区"
);
private
Integer
value
;
private
String
desc
;
private
String
style
;
AreaLevelEnum
(
int
value
,
String
desc
,
String
style
)
{
AreaLevelEnum
(
Integer
value
,
String
desc
)
{
this
.
value
=
value
;
this
.
desc
=
desc
;
this
.
style
=
style
;
}
@Override
public
int
getValue
()
{
public
Integer
getValue
()
{
return
this
.
value
;
}
public
String
getDesc
()
{
return
desc
;
return
this
.
desc
;
}
public
String
getStyle
()
{
return
style
;
}
public
static
AreaLevelEnum
getByValue
(
int
value
)
{
for
(
AreaLevelEnum
e
:
AreaLevelEnum
.
values
())
{
if
(
e
.
getValue
()
==
value
)
{
return
e
;
public
static
AreaLevelEnum
getByValue
(
Integer
value
)
{
for
(
AreaLevelEnum
areaLevelEnum
:
AreaLevelEnum
.
values
())
{
if
(
areaLevelEnum
.
getValue
()
==
value
)
{
return
areaLevelEnum
;
}
}
return
null
;
}
public
static
Map
<
String
,
String
>
getEnumMap
(
int
...
eItem
)
{
Map
<
String
,
String
>
resultMap
=
new
LinkedHashMap
<
String
,
String
>();
/**
* 获取Map集合
*
* @param eItem 不包含项
* @return
*/
public
static
Map
<
String
,
String
>
getEnumMap
(
Integer
...
eItem
)
{
Map
<
String
,
String
>
resultMap
=
new
LinkedHashMap
<>();
for
(
AreaLevelEnum
item
:
AreaLevelEnum
.
values
())
{
try
{
try
{
boolean
hasE
=
false
;
for
(
int
e
:
eItem
)
{
if
(
item
.
getValue
()==
e
)
{
for
(
Integer
e
:
eItem
)
{
if
(
item
.
getValue
()
==
e
)
{
hasE
=
true
;
break
;
}
}
if
(!
hasE
)
{
resultMap
.
put
(
item
.
getValue
()
+
""
,
item
.
getDesc
());
if
(!
hasE
)
{
resultMap
.
put
(
item
.
getValue
()
+
""
,
item
.
getDesc
());
}
}
catch
(
Exception
ex
){
}
catch
(
Exception
ex
)
{
}
}
return
resultMap
;
}
}
\ No newline at end of file
setup-project-manager/src/main/java/com/mortals/xhx/common/code/HaveGetDeptEnum.java
0 → 100644
View file @
23fcd536
package
com.mortals.xhx.common.code
;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
/**
* 是否获取部门(true.是,false.否)枚举类
*
* @author zxfei
*/
public
enum
HaveGetDeptEnum
{
是
(
"true"
,
"是"
),
否
(
"false"
,
"否"
);
private
String
value
;
private
String
desc
;
HaveGetDeptEnum
(
String
value
,
String
desc
)
{
this
.
value
=
value
;
this
.
desc
=
desc
;
}
public
String
getValue
()
{
return
this
.
value
;
}
public
String
getDesc
()
{
return
this
.
desc
;
}
public
static
HaveGetDeptEnum
getByValue
(
String
value
)
{
for
(
HaveGetDeptEnum
haveGetDeptEnum
:
HaveGetDeptEnum
.
values
())
{
if
(
haveGetDeptEnum
.
getValue
()
==
value
)
{
return
haveGetDeptEnum
;
}
}
return
null
;
}
/**
* 获取Map集合
*
* @param eItem 不包含项
* @return
*/
public
static
Map
<
String
,
String
>
getEnumMap
(
String
...
eItem
)
{
Map
<
String
,
String
>
resultMap
=
new
LinkedHashMap
<>();
for
(
HaveGetDeptEnum
item
:
HaveGetDeptEnum
.
values
())
{
try
{
boolean
hasE
=
false
;
for
(
String
e
:
eItem
)
{
if
(
item
.
getValue
()
==
e
)
{
hasE
=
true
;
break
;
}
}
if
(!
hasE
)
{
resultMap
.
put
(
item
.
getValue
()
+
""
,
item
.
getDesc
());
}
}
catch
(
Exception
ex
)
{
}
}
return
resultMap
;
}
}
\ No newline at end of file
setup-project-manager/src/main/java/com/mortals/xhx/common/code/HaveGetMatterListEnum.java
0 → 100644
View file @
23fcd536
package
com.mortals.xhx.common.code
;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
/**
* 是否获取事项列表(true.是,false.否)枚举类
*
* @author zxfei
*/
public
enum
HaveGetMatterListEnum
{
是
(
"true"
,
"是"
),
否
(
"false"
,
"否"
);
private
String
value
;
private
String
desc
;
HaveGetMatterListEnum
(
String
value
,
String
desc
)
{
this
.
value
=
value
;
this
.
desc
=
desc
;
}
public
String
getValue
()
{
return
this
.
value
;
}
public
String
getDesc
()
{
return
this
.
desc
;
}
public
static
HaveGetMatterListEnum
getByValue
(
String
value
)
{
for
(
HaveGetMatterListEnum
haveGetMatterListEnum
:
HaveGetMatterListEnum
.
values
())
{
if
(
haveGetMatterListEnum
.
getValue
()
==
value
)
{
return
haveGetMatterListEnum
;
}
}
return
null
;
}
/**
* 获取Map集合
*
* @param eItem 不包含项
* @return
*/
public
static
Map
<
String
,
String
>
getEnumMap
(
String
...
eItem
)
{
Map
<
String
,
String
>
resultMap
=
new
LinkedHashMap
<>();
for
(
HaveGetMatterListEnum
item
:
HaveGetMatterListEnum
.
values
())
{
try
{
boolean
hasE
=
false
;
for
(
String
e
:
eItem
)
{
if
(
item
.
getValue
()
==
e
)
{
hasE
=
true
;
break
;
}
}
if
(!
hasE
)
{
resultMap
.
put
(
item
.
getValue
()
+
""
,
item
.
getDesc
());
}
}
catch
(
Exception
ex
)
{
}
}
return
resultMap
;
}
}
\ No newline at end of file
setup-project-manager/src/main/java/com/mortals/xhx/common/code/HaveSonAreaEnum.java
0 → 100644
View file @
23fcd536
package
com.mortals.xhx.common.code
;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
/**
* 是否有下级区域(True.是,False.否)枚举类
*
* @author zxfei
*/
public
enum
HaveSonAreaEnum
{
是
(
"True"
,
"是"
),
否
(
"False"
,
"否"
);
private
String
value
;
private
String
desc
;
HaveSonAreaEnum
(
String
value
,
String
desc
)
{
this
.
value
=
value
;
this
.
desc
=
desc
;
}
public
String
getValue
()
{
return
this
.
value
;
}
public
String
getDesc
()
{
return
this
.
desc
;
}
public
static
HaveSonAreaEnum
getByValue
(
String
value
)
{
for
(
HaveSonAreaEnum
haveSonAreaEnum
:
HaveSonAreaEnum
.
values
())
{
if
(
haveSonAreaEnum
.
getValue
()
==
value
)
{
return
haveSonAreaEnum
;
}
}
return
null
;
}
/**
* 获取Map集合
*
* @param eItem 不包含项
* @return
*/
public
static
Map
<
String
,
String
>
getEnumMap
(
String
...
eItem
)
{
Map
<
String
,
String
>
resultMap
=
new
LinkedHashMap
<>();
for
(
HaveSonAreaEnum
item
:
HaveSonAreaEnum
.
values
())
{
try
{
boolean
hasE
=
false
;
for
(
String
e
:
eItem
)
{
if
(
item
.
getValue
()
==
e
)
{
hasE
=
true
;
break
;
}
}
if
(!
hasE
)
{
resultMap
.
put
(
item
.
getValue
()
+
""
,
item
.
getDesc
());
}
}
catch
(
Exception
ex
)
{
}
}
return
resultMap
;
}
}
\ No newline at end of file
setup-project-manager/src/main/java/com/mortals/xhx/common/code/HaveSonDeptEnum.java
0 → 100644
View file @
23fcd536
package
com.mortals.xhx.common.code
;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
/**
* 是否有下级部门(True.是,False.否)枚举类
*
* @author zxfei
*/
public
enum
HaveSonDeptEnum
{
是
(
"True"
,
"是"
),
否
(
"False"
,
"否"
);
private
String
value
;
private
String
desc
;
HaveSonDeptEnum
(
String
value
,
String
desc
)
{
this
.
value
=
value
;
this
.
desc
=
desc
;
}
public
String
getValue
()
{
return
this
.
value
;
}
public
String
getDesc
()
{
return
this
.
desc
;
}
public
static
HaveSonDeptEnum
getByValue
(
String
value
)
{
for
(
HaveSonDeptEnum
haveSonDeptEnum
:
HaveSonDeptEnum
.
values
())
{
if
(
haveSonDeptEnum
.
getValue
()
==
value
)
{
return
haveSonDeptEnum
;
}
}
return
null
;
}
/**
* 获取Map集合
*
* @param eItem 不包含项
* @return
*/
public
static
Map
<
String
,
String
>
getEnumMap
(
String
...
eItem
)
{
Map
<
String
,
String
>
resultMap
=
new
LinkedHashMap
<>();
for
(
HaveSonDeptEnum
item
:
HaveSonDeptEnum
.
values
())
{
try
{
boolean
hasE
=
false
;
for
(
String
e
:
eItem
)
{
if
(
item
.
getValue
()
==
e
)
{
hasE
=
true
;
break
;
}
}
if
(!
hasE
)
{
resultMap
.
put
(
item
.
getValue
()
+
""
,
item
.
getDesc
());
}
}
catch
(
Exception
ex
)
{
}
}
return
resultMap
;
}
}
\ No newline at end of file
setup-project-manager/src/main/java/com/mortals/xhx/common/code/StatusEnum.java
0 → 100644
View file @
23fcd536
package
com.mortals.xhx.common.code
;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
/**
* 区域状态 (0.停用,1.正常)枚举类
*
* @author zxfei
*/
public
enum
StatusEnum
{
停用
(
0
,
"停用"
),
正常
(
1
,
"正常"
);
private
Integer
value
;
private
String
desc
;
StatusEnum
(
Integer
value
,
String
desc
)
{
this
.
value
=
value
;
this
.
desc
=
desc
;
}
public
Integer
getValue
()
{
return
this
.
value
;
}
public
String
getDesc
()
{
return
this
.
desc
;
}
public
static
StatusEnum
getByValue
(
Integer
value
)
{
for
(
StatusEnum
statusEnum
:
StatusEnum
.
values
())
{
if
(
statusEnum
.
getValue
()
==
value
)
{
return
statusEnum
;
}
}
return
null
;
}
/**
* 获取Map集合
*
* @param eItem 不包含项
* @return
*/
public
static
Map
<
String
,
String
>
getEnumMap
(
Integer
...
eItem
)
{
Map
<
String
,
String
>
resultMap
=
new
LinkedHashMap
<>();
for
(
StatusEnum
item
:
StatusEnum
.
values
())
{
try
{
boolean
hasE
=
false
;
for
(
Integer
e
:
eItem
)
{
if
(
item
.
getValue
()
==
e
)
{
hasE
=
true
;
break
;
}
}
if
(!
hasE
)
{
resultMap
.
put
(
item
.
getValue
()
+
""
,
item
.
getDesc
());
}
}
catch
(
Exception
ex
)
{
}
}
return
resultMap
;
}
}
\ No newline at end of file
setup-project-manager/src/main/java/com/mortals/xhx/module/base/dao/BaseAreaDao.java
View file @
23fcd536
...
...
@@ -2,16 +2,23 @@ package com.mortals.xhx.module.base.dao;
import
com.mortals.framework.dao.ICRUDDao
;
import
com.mortals.xhx.module.base.model.BaseAreaEntity
;
import
java.util.List
;
/**
* 区域Dao
* 区域 DAO接口
*
* @author zxfei
* @date 202
2-11-22
* @date 202
4-11-01
*/
public
interface
BaseAreaDao
extends
ICRUDDao
<
BaseAreaEntity
,
Long
>{
/**
* 查询子节点
*
* @param
* @return
*/
List
<
BaseAreaEntity
>
selectChildrenBaseAreaById
(
String
baseAreaId
);
}
setup-project-manager/src/main/java/com/mortals/xhx/module/base/dao/ibatis/BaseAreaDaoImpl.java
View file @
23fcd536
package
com.mortals.xhx.module.base.dao.ibatis
;
import
com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis
;
import
org.springframework.stereotype.Repository
;
import
com.mortals.xhx.module.base.dao.BaseAreaDao
;
import
com.mortals.xhx.module.base.model.BaseAreaEntity
;
import
org.springframework.stereotype.Repository
;
import
java.util.Date
;
import
com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis
;
import
java.util.List
;
/**
* 区域DaoImpl DAO接口
*
* @author zxfei
* @date 202
2-11-22
* @date 202
4-11-01
*/
@Repository
(
"baseAreaDao"
)
public
class
BaseAreaDaoImpl
extends
BaseCRUDDaoMybatis
<
BaseAreaEntity
,
Long
>
implements
BaseAreaDao
{
@Override
public
List
<
BaseAreaEntity
>
selectChildrenBaseAreaById
(
String
baseAreaId
)
{
return
getSqlSession
().
selectList
(
getSqlId
(
"selectChildrenBaseAreaById"
),
baseAreaId
);
}
}
setup-project-manager/src/main/java/com/mortals/xhx/module/base/model/BaseAreaEntity.java
View file @
23fcd536
package
com.mortals.xhx.module.base.model
;
import
java.util.List
;
import
java.util.ArrayList
;
import
java.math.BigDecimal
;
import
cn.hutool.core.date.DateUtil
;
import
java.util.Date
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.mortals.framework.annotation.Excel
;
import
com.mortals.framework.model.BaseEntityLong
;
import
com.mortals.xhx.module.base.model.vo.BaseAreaVo
;
import
lombok.Data
;
/**
* 区域实体对象
*
* @author zxfei
* @date 202
2-11-22
* @date 202
4-11-01
*/
@Data
public
class
BaseAreaEntity
extends
BaseAreaVo
{
private
static
final
long
serialVersionUID
=
1L
;
...
...
@@ -63,196 +71,6 @@ public class BaseAreaEntity extends BaseAreaVo {
* 区域状态 (0.停用,1.正常)
*/
private
Integer
status
;
public
BaseAreaEntity
(){}
/**
* 获取 祖级列表,逗号分隔
* @return String
*/
public
String
getAncestors
(){
return
ancestors
;
}
/**
* 设置 祖级列表,逗号分隔
* @param ancestors
*/
public
void
setAncestors
(
String
ancestors
){
this
.
ancestors
=
ancestors
;
}
/**
* 获取 区域名称
* @return String
*/
public
String
getName
(){
return
name
;
}
/**
* 设置 区域名称
* @param name
*/
public
void
setName
(
String
name
){
this
.
name
=
name
;
}
/**
* 获取 一体化的ID号
* @return String
*/
public
String
getIid
(){
return
iid
;
}
/**
* 设置 一体化的ID号
* @param iid
*/
public
void
setIid
(
String
iid
){
this
.
iid
=
iid
;
}
/**
* 获取 一体化的父id
* @return String
*/
public
String
getPid
(){
return
pid
;
}
/**
* 设置 一体化的父id
* @param pid
*/
public
void
setPid
(
String
pid
){
this
.
pid
=
pid
;
}
/**
* 获取 是否有下级区域(True.是,False.否)
* @return String
*/
public
String
getHaveSonArea
(){
return
haveSonArea
;
}
/**
* 设置 是否有下级区域(True.是,False.否)
* @param haveSonArea
*/
public
void
setHaveSonArea
(
String
haveSonArea
){
this
.
haveSonArea
=
haveSonArea
;
}
/**
* 获取 是否有下级部门(True.是,False.否)
* @return String
*/
public
String
getHaveSonDept
(){
return
haveSonDept
;
}
/**
* 设置 是否有下级部门(True.是,False.否)
* @param haveSonDept
*/
public
void
setHaveSonDept
(
String
haveSonDept
){
this
.
haveSonDept
=
haveSonDept
;
}
/**
* 获取 是否获取部门(true.是,false.否)
* @return String
*/
public
String
getHaveGetDept
(){
return
haveGetDept
;
}
/**
* 设置 是否获取部门(true.是,false.否)
* @param haveGetDept
*/
public
void
setHaveGetDept
(
String
haveGetDept
){
this
.
haveGetDept
=
haveGetDept
;
}
/**
* 获取 是否获取事项列表(true.是,false.否)
* @return String
*/
public
String
getHaveGetMatterList
(){
return
haveGetMatterList
;
}
/**
* 设置 是否获取事项列表(true.是,false.否)
* @param haveGetMatterList
*/
public
void
setHaveGetMatterList
(
String
haveGetMatterList
){
this
.
haveGetMatterList
=
haveGetMatterList
;
}
/**
* 获取 区域编码
* @return String
*/
public
String
getAreaCode
(){
return
areaCode
;
}
/**
* 设置 区域编码
* @param areaCode
*/
public
void
setAreaCode
(
String
areaCode
){
this
.
areaCode
=
areaCode
;
}
/**
* 获取 区域等级(1.省,2.地市州,3.区县,4.街道,5.社区)
* @return Integer
*/
public
Integer
getAreaLevel
(){
return
areaLevel
;
}
/**
* 设置 区域等级(1.省,2.地市州,3.区县,4.街道,5.社区)
* @param areaLevel
*/
public
void
setAreaLevel
(
Integer
areaLevel
){
this
.
areaLevel
=
areaLevel
;
}
/**
* 获取 名称简称
* @return String
*/
public
String
getShortName
(){
return
shortName
;
}
/**
* 设置 名称简称
* @param shortName
*/
public
void
setShortName
(
String
shortName
){
this
.
shortName
=
shortName
;
}
/**
* 获取 访问地址
* @return String
*/
public
String
getDomain
(){
return
domain
;
}
/**
* 设置 访问地址
* @param domain
*/
public
void
setDomain
(
String
domain
){
this
.
domain
=
domain
;
}
/**
* 获取 区域状态 (0.停用,1.正常)
* @return Integer
*/
public
Integer
getStatus
(){
return
status
;
}
/**
* 设置 区域状态 (0.停用,1.正常)
* @param status
*/
public
void
setStatus
(
Integer
status
){
this
.
status
=
status
;
}
@Override
public
int
hashCode
()
{
return
this
.
getId
().
hashCode
();
...
...
@@ -269,50 +87,19 @@ public class BaseAreaEntity extends BaseAreaVo {
return
false
;
}
public
String
toString
(){
StringBuilder
sb
=
new
StringBuilder
(
""
);
sb
.
append
(
",ancestors:"
).
append
(
getAncestors
());
sb
.
append
(
",name:"
).
append
(
getName
());
sb
.
append
(
",iid:"
).
append
(
getIid
());
sb
.
append
(
",pid:"
).
append
(
getPid
());
sb
.
append
(
",haveSonArea:"
).
append
(
getHaveSonArea
());
sb
.
append
(
",haveSonDept:"
).
append
(
getHaveSonDept
());
sb
.
append
(
",haveGetDept:"
).
append
(
getHaveGetDept
());
sb
.
append
(
",haveGetMatterList:"
).
append
(
getHaveGetMatterList
());
sb
.
append
(
",areaCode:"
).
append
(
getAreaCode
());
sb
.
append
(
",areaLevel:"
).
append
(
getAreaLevel
());
sb
.
append
(
",shortName:"
).
append
(
getShortName
());
sb
.
append
(
",domain:"
).
append
(
getDomain
());
sb
.
append
(
",status:"
).
append
(
getStatus
());
return
sb
.
toString
();
}
public
void
initAttrValue
(){
this
.
ancestors
=
""
;
this
.
name
=
null
;
this
.
iid
=
null
;
this
.
pid
=
null
;
this
.
haveSonArea
=
null
;
this
.
haveSonDept
=
null
;
this
.
haveGetDept
=
null
;
this
.
haveGetMatterList
=
null
;
this
.
areaCode
=
null
;
this
.
name
=
""
;
this
.
iid
=
""
;
this
.
pid
=
""
;
this
.
haveSonArea
=
""
;
this
.
haveSonDept
=
""
;
this
.
haveGetDept
=
""
;
this
.
haveGetMatterList
=
""
;
this
.
areaCode
=
""
;
this
.
areaLevel
=
1
;
this
.
shortName
=
null
;
this
.
domain
=
null
;
this
.
shortName
=
""
;
this
.
domain
=
""
;
this
.
status
=
1
;
}
}
\ No newline at end of file
setup-project-manager/src/main/java/com/mortals/xhx/module/base/model/BaseAreaQuery.java
View file @
23fcd536
This diff is collapsed.
Click to expand it.
setup-project-manager/src/main/java/com/mortals/xhx/module/base/model/BaseAreaTreeSelect.java
0 → 100644
View file @
23fcd536
package
com.mortals.xhx.module.base.model
;
import
java.lang.reflect.Type
;
import
java.util.List
;
import
java.util.ArrayList
;
import
com.mortals.xhx.module.base.model.vo.BaseAreaVo
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.stream.Collectors
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.parser.DefaultJSONParser
;
import
com.alibaba.fastjson.parser.JSONToken
;
import
com.alibaba.fastjson.parser.deserializer.ObjectDeserializer
;
import
org.springframework.util.ObjectUtils
;
/**
* 区域前端映射树结构实体类
*
* @author zxfei
* @date 2024-11-01
*/
@Data
public
class
BaseAreaTreeSelect
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 节点ID
*/
private
Long
id
;
/**
* 节点名称
*/
private
String
label
;
/**
* 区域编码
*/
private
String
areaCode
;
/**
* 是否叶子节点
*/
private
Boolean
isLeaf
;
/**
* 节点类型
*/
private
String
type
;
/**
* 图标
*/
private
String
icon
;
/**
* 区域等级(1.省,2.地市州,3.区县,4.街道,5.社区)
*/
private
Integer
areaLevel
;
/**
* 子节点
*/
@JsonInclude
(
JsonInclude
.
Include
.
NON_EMPTY
)
private
List
<
BaseAreaTreeSelect
>
children
;
public
BaseAreaTreeSelect
()
{};
public
BaseAreaTreeSelect
(
BaseAreaEntity
entity
)
{
this
.
id
=
entity
.
getId
();
this
.
label
=
entity
.
getName
();
if
(
"False"
.
equalsIgnoreCase
(
entity
.
getHaveSonArea
()))
{
this
.
isLeaf
=
true
;
this
.
children
=
new
ArrayList
();
}
else
{
this
.
isLeaf
=
false
;
}
this
.
areaCode
=
entity
.
getAreaCode
();
this
.
areaLevel
=
entity
.
getAreaLevel
();
this
.
type
=
"area"
;
this
.
icon
=
"el-icon-folder"
;
if
(!
ObjectUtils
.
isEmpty
(
entity
.
getChildren
())){
this
.
children
=
entity
.
getChildren
().
stream
().
map
(
BaseAreaTreeSelect:
:
new
).
collect
(
Collectors
.
toList
());
}
}
// 反序列化器
public
class
Deserializer
implements
ObjectDeserializer
{
@Override
public
BaseAreaTreeSelect
deserialze
(
DefaultJSONParser
parser
,
Type
type
,
Object
fieldName
)
{
BaseAreaTreeSelect
node
=
new
BaseAreaTreeSelect
();
JSONObject
jsonObject
=
parser
.
parseObject
();
node
.
setId
(
jsonObject
.
getLong
(
"id"
));
node
.
setLabel
(
jsonObject
.
getString
(
"label"
));
JSONArray
jsonArray
=
jsonObject
.
getJSONArray
(
"children"
);
List
<
BaseAreaTreeSelect
>
children
=
new
ArrayList
<>();
if
(!
ObjectUtils
.
isEmpty
(
jsonArray
)){
for
(
int
i
=
0
;
i
<
jsonArray
.
size
();
i
++)
{
BaseAreaTreeSelect
child
=
JSON
.
parseObject
(
jsonArray
.
getJSONObject
(
i
).
toJSONString
(),
BaseAreaTreeSelect
.
class
);
children
.
add
(
child
);
}
}
node
.
setChildren
(
children
);
return
node
;
}
@Override
public
int
getFastMatchToken
()
{
return
JSONToken
.
LBRACE
;
}
}
}
\ No newline at end of file
setup-project-manager/src/main/java/com/mortals/xhx/module/base/model/vo/BaseAreaVo.java
View file @
23fcd536
package
com.mortals.xhx.module.base.model.vo
;
import
com.mortals.framework.model.BaseEntityLong
;
import
com.mortals.xhx.module.base.model.BaseAreaEntity
;
import
lombok.Data
;
import
java.util.ArrayList
;
import
java.util.List
;
import
lombok.Data
;
import
com.mortals.framework.annotation.Excel
;
import
java.math.BigDecimal
;
import
java.util.Date
;
/**
* 区域视图对象
*
* @author zxfei
* @date 2022-11-22
*/
* 区域视图对象
*
* @author zxfei
* @date 2024-11-01
*/
@Data
public
class
BaseAreaVo
extends
BaseEntityLong
{
private
List
<
BaseAreaEntity
>
children
=
new
ArrayList
<>();
/** 序号,主键,自增长列表 */
private
List
<
Long
>
idList
;
/** 子区域 */
private
List
<
BaseAreaEntity
>
children
=
new
ArrayList
<>();
}
\ No newline at end of file
setup-project-manager/src/main/java/com/mortals/xhx/module/base/service/BaseAreaService.java
View file @
23fcd536
package
com.mortals.xhx.module.base.service
;
import
com.mortals.framework.service.ICRUDService
;
import
com.mortals.xhx.module.base.model.BaseAreaEntity
;
import
com.mortals.xhx.module.base.model.BaseAreaTreeSelect
;
import
java.util.List
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.model.Context
;
/**
* BaseAreaService
* <p>
* 区域 service接口
* BaseAreaService
*
* 区域 service接口
*
* @author zxfei
* @date 2024-11-01
*/
public
interface
BaseAreaService
extends
ICRUDService
<
BaseAreaEntity
,
Long
>{
/**
* 是否存在区域节点
*
* @author zxfei
* @date 2022-11-22
* @param baseAreaId 区域ID
* @return 结果
*/
public
interface
BaseAreaService
extends
ICRUDService
<
BaseAreaEntity
,
Long
>
{
boolean
hasChildByBaseAreaId
(
String
baseAreaId
);
/**
* 构建前端所需要下拉树结构
*
* @param baseAreaList 区域列表
* @return 下拉树结构列表
*/
List
<
BaseAreaTreeSelect
>
buildBaseAreaTreeSelect
(
List
<
BaseAreaEntity
>
baseAreaList
);
/**
* 根据父id查询子节点
* @param parentId
* @param context
* @return
*/
List
<
BaseAreaTreeSelect
>
getListByParentId
(
String
parentId
,
Context
context
);
}
\ No newline at end of file
setup-project-manager/src/main/java/com/mortals/xhx/module/base/service/impl/BaseAreaServiceImpl.java
View file @
23fcd536
package
com.mortals.xhx.module.base.service.impl
;
import
org.springframework.stereotype.Service
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.model.Context
;
import
com.mortals.framework.service.impl.AbstractCRUDServiceImpl
;
import
com.mortals.xhx.module.base.dao.BaseAreaDao
;
import
com.mortals.xhx.module.base.model.BaseAreaEntity
;
import
com.mortals.xhx.module.base.model.BaseAreaQuery
;
import
com.mortals.xhx.module.base.service.BaseAreaService
;
import
org.springframework.stereotype.Service
;
import
com.mortals.xhx.module.base.model.BaseAreaTreeSelect
;
import
org.springframework.util.ObjectUtils
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
* BaseAreaService
* 区域 service实现
*
* @author zxfei
* @date 2022-11-22
*/
* BaseAreaService
* 区域 service实现
*
* @author zxfei
* @date 2024-11-01
*/
@Service
(
"baseAreaService"
)
public
class
BaseAreaServiceImpl
extends
AbstractCRUDServiceImpl
<
BaseAreaDao
,
BaseAreaEntity
,
Long
>
implements
BaseAreaService
{
/**
* 修改子元素关系
*
* @param baseAreaId 被修改的区域ID
* @param newAncestors 新的父ID集合
* @param oldAncestors 旧的父ID集合
*/
public
void
updateBaseAreaChildren
(
Long
baseAreaId
,
String
newAncestors
,
String
oldAncestors
,
Context
context
)
{
List
<
BaseAreaEntity
>
children
=
getDao
().
selectChildrenBaseAreaById
(
baseAreaId
.
toString
());
for
(
BaseAreaEntity
child
:
children
)
{
child
.
setAncestors
(
child
.
getAncestors
().
replace
(
oldAncestors
,
newAncestors
));
}
if
(
children
.
size
()
>
0
)
{
this
.
updateAfter
(
children
,
context
);
}
}
@Override
protected
void
removeBefore
(
Long
[]
ids
,
Context
context
)
throws
AppException
{
//有子节点 禁止删除
if
(!
ObjectUtils
.
isEmpty
(
ids
))
{
BaseAreaEntity
baseAreaEntity
=
this
.
get
(
ids
[
0
]);
if
(
hasChildByBaseAreaId
(
baseAreaEntity
.
getIid
())){
throw
new
AppException
(
"存在下级区域,不允许删除"
);
}
}
super
.
removeBefore
(
ids
,
context
);
}
@Override
public
boolean
hasChildByBaseAreaId
(
String
baseAreaId
)
{
List
<
BaseAreaEntity
>
list
=
this
.
find
(
new
BaseAreaQuery
().
pid
(
baseAreaId
));
return
list
.
size
()
>
0
?
true
:
false
;
}
@Override
public
List
<
BaseAreaTreeSelect
>
buildBaseAreaTreeSelect
(
List
<
BaseAreaEntity
>
list
)
{
List
<
BaseAreaEntity
>
returnList
=
new
ArrayList
<>();
List
<
Long
>
tempList
=
list
.
stream
().
map
(
BaseAreaEntity:
:
getId
).
collect
(
Collectors
.
toList
());
for
(
Iterator
<
BaseAreaEntity
>
iterator
=
list
.
iterator
();
iterator
.
hasNext
();
)
{
BaseAreaEntity
baseAreaEntity
=
iterator
.
next
();
if
(!
tempList
.
contains
(
baseAreaEntity
.
getPid
()))
{
recursionFn
(
list
,
baseAreaEntity
);
returnList
.
add
(
baseAreaEntity
);
}
}
if
(
returnList
.
isEmpty
())
{
returnList
=
list
;
}
return
returnList
.
stream
().
map
(
BaseAreaTreeSelect:
:
new
).
collect
(
Collectors
.
toList
());
}
/**
* 递归列表
*/
private
void
recursionFn
(
List
<
BaseAreaEntity
>
list
,
BaseAreaEntity
t
)
{
// 得到子节点列表
List
<
BaseAreaEntity
>
childList
=
getChildList
(
list
,
t
);
t
.
setChildren
(
childList
);
for
(
BaseAreaEntity
tChild
:
childList
)
{
if
(
hasChild
(
list
,
tChild
))
{
recursionFn
(
list
,
tChild
);
}
}
}
/**
* 判断是否有子节点
*/
private
boolean
hasChild
(
List
<
BaseAreaEntity
>
list
,
BaseAreaEntity
t
)
{
return
getChildList
(
list
,
t
).
size
()
>
0
?
true
:
false
;
}
/**
* 得到子节点列表
*/
private
List
<
BaseAreaEntity
>
getChildList
(
List
<
BaseAreaEntity
>
list
,
BaseAreaEntity
t
)
{
return
list
.
stream
().
map
(
item
->{
if
(!
ObjectUtils
.
isEmpty
(
item
.
getPid
())
&&
item
.
getPid
().
equals
(
t
.
getIid
()))
{
return
item
;
}
return
null
;
}).
filter
(
f
->
f
!=
null
).
collect
(
Collectors
.
toList
());
}
@Override
public
List
<
BaseAreaTreeSelect
>
getListByParentId
(
String
parentId
,
Context
context
)
{
if
(
ObjectUtils
.
isEmpty
(
parentId
))
{
parentId
=
"0"
;
}
//只做一层
List
<
BaseAreaTreeSelect
>
collect
=
this
.
find
(
new
BaseAreaQuery
().
pid
(
parentId
),
context
).
stream
().
map
(
item
->
new
BaseAreaTreeSelect
(
item
)
).
collect
(
Collectors
.
toList
());
return
collect
;
}
}
\ No newline at end of file
setup-project-manager/src/main/java/com/mortals/xhx/module/base/web/BaseAreaController.java
View file @
23fcd536
package
com.mortals.xhx.module.base.web
;
import
com.mortals.framework.model.Context
;
import
com.mortals.framework.service.ICacheService
;
import
com.mortals.framework.annotation.UnAuth
;
import
com.mortals.framework.web.BaseCRUDJsonBodyMappingController
;
import
com.mortals.xhx.base.system.param.service.ParamService
;
import
com.mortals.xhx.module.base.model.BaseAreaEntity
;
import
com.mortals.xhx.module.base.service.BaseAreaService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
import
com.mortals.framework.model.Context
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
com.mortals.framework.web.BaseCRUDJsonBodyMappingController
;
import
com.mortals.xhx.module.base.model.BaseAreaEntity
;
import
com.mortals.xhx.module.base.service.BaseAreaService
;
import
com.mortals.xhx.module.base.model.BaseAreaQuery
;
import
com.mortals.xhx.module.base.model.BaseAreaTreeSelect
;
import
org.apache.commons.lang3.ArrayUtils
;
import
com.mortals.framework.util.StringUtils
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
com.alibaba.fastjson.JSONObject
;
import
java.util.Arrays
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
static
com
.
mortals
.
framework
.
ap
.
SysConstains
.*;
import
com.mortals.xhx.common.code.*
;
/**
* 区域
*
* @author zxfei
* @date 2022-11-22
*/
*
* 区域
*
* @author zxfei
* @date 2024-11-01
*/
@RestController
@RequestMapping
(
"base/area"
)
public
class
BaseAreaController
extends
BaseCRUDJsonBodyMappingController
<
BaseAreaService
,
BaseAreaEntity
,
Long
>
{
public
class
BaseAreaController
extends
BaseCRUDJsonBodyMappingController
<
BaseAreaService
,
BaseAreaEntity
,
Long
>
{
@Autowired
private
ParamService
paramService
;
@Autowired
private
ICacheService
cacheService
;
public
BaseAreaController
()
{
super
.
setModuleDesc
(
"区域"
);
public
BaseAreaController
(){
super
.
setModuleDesc
(
"区域"
);
}
@Override
protected
void
init
(
Map
<
String
,
Object
>
model
,
Context
context
)
{
this
.
addDict
(
model
,
"haveSonArea"
,
paramService
.
getParamBySecondOrganize
(
"BaseArea"
,
"haveSonArea"
));
this
.
addDict
(
model
,
"haveSonDept"
,
paramService
.
getParamBySecondOrganize
(
"BaseArea"
,
"haveSonDept"
));
this
.
addDict
(
model
,
"haveGetDept"
,
paramService
.
getParamBySecondOrganize
(
"BaseArea"
,
"haveGetDept"
));
this
.
addDict
(
model
,
"haveGetMatterList"
,
paramService
.
getParamBySecondOrganize
(
"BaseArea"
,
"haveGetMatterList"
));
this
.
addDict
(
model
,
"areaLevel"
,
paramService
.
getParamBySecondOrganize
(
"BaseArea"
,
"areaLevel"
));
this
.
addDict
(
model
,
"status"
,
paramService
.
getParamBySecondOrganize
(
"BaseArea"
,
"status"
));
this
.
addDict
(
model
,
"haveSonArea"
,
HaveSonAreaEnum
.
getEnumMap
(
));
this
.
addDict
(
model
,
"haveSonDept"
,
HaveSonDeptEnum
.
getEnumMap
(
));
this
.
addDict
(
model
,
"haveGetDept"
,
HaveGetDeptEnum
.
getEnumMap
(
));
this
.
addDict
(
model
,
"haveGetMatterList"
,
HaveGetMatterListEnum
.
getEnumMap
(
));
this
.
addDict
(
model
,
"areaLevel"
,
AreaLevelEnum
.
getEnumMap
(
));
this
.
addDict
(
model
,
"status"
,
StatusEnum
.
getEnumMap
(
));
super
.
init
(
model
,
context
);
}
/**
* 获取站点下拉树列表
*/
@PostMapping
(
"treeselect"
)
@UnAuth
public
String
treeselect
()
{
Map
<
String
,
Object
>
model
=
new
HashMap
<>();
JSONObject
ret
=
new
JSONObject
();
String
busiDesc
=
"查询"
+
this
.
getModuleDesc
();
int
code
=
VALUE_RESULT_SUCCESS
;
try
{
List
<
BaseAreaEntity
>
list
=
this
.
service
.
find
(
new
BaseAreaQuery
());
List
<
BaseAreaTreeSelect
>
treeSelects
=
this
.
service
.
buildBaseAreaTreeSelect
(
list
);
model
.
put
(
"result"
,
treeSelects
);
recordSysLog
(
request
,
busiDesc
+
" 【成功】"
);
}
catch
(
Exception
e
)
{
code
=
VALUE_RESULT_FAILURE
;
this
.
doException
(
request
,
busiDesc
,
model
,
e
);
}
ret
.
put
(
KEY_RESULT_DATA
,
model
);
ret
.
put
(
KEY_RESULT_CODE
,
code
);
return
ret
.
toJSONString
();
}
/**
* 根据parentId查询子信息
*/
@GetMapping
(
value
=
"getListByParentId"
)
@UnAuth
public
String
getListByParentId
(
String
parentId
)
{
JSONObject
ret
=
new
JSONObject
();
Map
<
String
,
Object
>
model
=
new
HashMap
<>();
String
busiDesc
=
"查询"
+
this
.
getModuleDesc
()+
"子节点"
;
try
{
List
<
BaseAreaTreeSelect
>
treeList
=
this
.
service
.
getListByParentId
(
parentId
,
getContext
());
model
.
put
(
RESULT_KEY
,
treeList
);
ret
.
put
(
KEY_RESULT_CODE
,
VALUE_RESULT_SUCCESS
);
ret
.
put
(
KEY_RESULT_DATA
,
model
);
recordSysLog
(
request
,
busiDesc
+
"【成功】"
);
}
catch
(
Exception
e
)
{
log
.
error
(
"根据parentId查询子信息错误"
,
e
);
this
.
doException
(
request
,
busiDesc
,
model
,
e
);
ret
.
put
(
KEY_RESULT_CODE
,
VALUE_RESULT_FAILURE
);
ret
.
put
(
KEY_RESULT_MSG
,
e
.
getMessage
());
}
return
ret
.
toJSONString
();
}
}
\ No newline at end of file
setup-project-manager/src/main/resources/sqlmap/module/base/BaseAreaMapper.xml
View file @
23fcd536
This diff is collapsed.
Click to expand it.
setup-project-manager/src/test/java/com/mortals/httpclient/base/BaseAreaController.http
0 → 100644
View file @
23fcd536
###登录
POST {{baseUrl}}/login/login
Content-Type: application/json
{
"loginName":"admin",
"password":"admin",
"securityCode":"8888"
}
> {%
client.global.set("SmsSet_id", JSON.parse(response.body).data.id);
client.global.set("authToken", JSON.parse(response.body).data.token);
%}
###区域列表
POST {{baseUrl}}/base/area/list
Content-Type: application/json
{
"page":1,
"size":10
}
###区域更新与保存
POST {{baseUrl}}/base/area/save
Authorization: {{authToken}}
Content-Type: application/json
{
"ancestors":"LdZ2li",
"name":"i3SKJc",
"iid":"suSUQY",
"pid":"uRSFOx",
"haveSonArea":"BfkquZ",
"haveSonDept":"pCokey",
"haveGetDept":"2yYsnf",
"haveGetMatterList":"r9jokc",
"areaCode":"gWJcgU",
"areaLevel":1,
"shortName":"fWbdcd",
"domain":"u7GMku",
"status":1,
}
> {%
client.global.set("BaseArea_id", JSON.parse(response.body).data.id);
%}
###区域查看
GET {{baseUrl}}/base/area/info?id=1
###区域编辑
GET {{baseUrl}}/base/area/edit?id=1
Accept: application/json
###区域删除
GET {{baseUrl}}/base/area/delete?id=1
Authorization: {{authToken}}
Accept: application/json
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