Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
govdna
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
开发共享交流平台
govdna
Commits
bbe8cb75
Commit
bbe8cb75
authored
Aug 14, 2018
by
Fred
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://115.233.227.46:8066/root/govdna.git
parents
50541076
1c07f07b
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
68 additions
and
12 deletions
+68
-12
AreaController.java
...com/govmade/modules/system/controller/AreaController.java
+6
-4
AreaDao.java
src/main/java/com/govmade/modules/system/dao/AreaDao.java
+6
-0
AreaEntity.java
...in/java/com/govmade/modules/system/entity/AreaEntity.java
+11
-2
AreaService.java
.../java/com/govmade/modules/system/service/AreaService.java
+8
-1
AreaServiceImpl.java
.../govmade/modules/system/service/impl/AreaServiceImpl.java
+10
-5
AreaDao.xml
src/main/resources/mapper/system/AreaDao.xml
+27
-0
No files found.
src/main/java/com/govmade/modules/system/controller/AreaController.java
View file @
bbe8cb75
package
com
.
govmade
.
modules
.
system
.
controller
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -11,6 +12,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.govmade.common.utils.PageUtils
;
import
com.govmade.common.utils.R
;
import
com.govmade.common.validator.Assert
;
import
com.govmade.modules.basic.controller.AbstractController
;
...
...
@@ -34,10 +36,10 @@ public class AreaController extends AbstractController{
/**
* 所有区划数据树结构
*/
@GetMapping
(
"/
allList
"
)
public
R
allList
(
)
{
List
<
AreaEntity
>
data
=
areaService
.
queryAll
(
);
return
R
.
ok
().
put
(
"data"
,
data
);
@GetMapping
(
"/
listTree
"
)
public
R
listTree
(
@RequestParam
Map
<
String
,
Object
>
params
)
{
PageUtils
page
=
areaService
.
queryPage
(
params
);
return
R
.
ok
().
put
(
"page"
,
page
);
}
/**
...
...
src/main/java/com/govmade/modules/system/dao/AreaDao.java
View file @
bbe8cb75
package
com
.
govmade
.
modules
.
system
.
dao
;
import
java.util.List
;
import
java.util.Set
;
import
org.apache.ibatis.annotations.Mapper
;
...
...
@@ -21,4 +22,9 @@ public interface AreaDao extends BaseMapper<AreaEntity> {
* 批量删除或删除
*/
void
deleteBatch
(
@Param
(
"ids"
)
Set
<
Long
>
ids
);
/**
* 查询树形数据
*/
List
<
AreaEntity
>
listTree
(
@Param
(
"name"
)
String
name
);
}
src/main/java/com/govmade/modules/system/entity/AreaEntity.java
View file @
bbe8cb75
...
...
@@ -21,6 +21,8 @@ public class AreaEntity extends BaseEntity<Long>{
private
String
name
;
//区划名称
private
Long
rootId
;
//根ID
private
String
code
;
//区划代码
private
Integer
level
;
//区划级别
...
...
@@ -79,6 +81,13 @@ public class AreaEntity extends BaseEntity<Long>{
public
void
setChildren
(
List
<
AreaEntity
>
children
)
{
this
.
children
=
children
;
}
public
Long
getRootId
()
{
return
rootId
;
}
public
void
setRootId
(
Long
rootId
)
{
this
.
rootId
=
rootId
;
}
}
src/main/java/com/govmade/modules/system/service/AreaService.java
View file @
bbe8cb75
package
com
.
govmade
.
modules
.
system
.
service
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
com.baomidou.mybatisplus.service.IService
;
import
com.govmade.common.utils.PageUtils
;
import
com.govmade.modules.system.entity.AreaEntity
;
/**
...
...
@@ -17,7 +19,12 @@ public interface AreaService extends IService<AreaEntity>{
/**
* 查询所有数据树结构
*/
List
<
AreaEntity
>
queryAll
();
/*List<AreaEntity> queryAll();*/
/**
* 查看列表
*/
PageUtils
queryPage
(
Map
<
String
,
Object
>
params
);
/**
* 保存或修改行政区划
...
...
src/main/java/com/govmade/modules/system/service/impl/AreaServiceImpl.java
View file @
bbe8cb75
package
com
.
govmade
.
modules
.
system
.
service
.
impl
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
org.springframework.stereotype.Service
;
import
com.baomidou.mybatisplus.mapper.EntityWrapper
;
import
com.baomidou.mybatisplus.plugins.Page
;
import
com.baomidou.mybatisplus.service.impl.ServiceImpl
;
import
com.google.common.collect.Lists
;
import
com.govmade.common.utils.PageUtils
;
import
com.govmade.modules.system.dao.AreaDao
;
import
com.govmade.modules.system.entity.AreaEntity
;
import
com.govmade.modules.system.service.AreaService
;
...
...
@@ -22,13 +25,15 @@ import com.govmade.modules.system.service.AreaService;
public
class
AreaServiceImpl
extends
ServiceImpl
<
AreaDao
,
AreaEntity
>
implements
AreaService
{
@Override
public
List
<
AreaEntity
>
queryAll
(
)
{
public
PageUtils
queryPage
(
Map
<
String
,
Object
>
params
)
{
List
<
AreaEntity
>
areaList
=
this
.
selectList
(
new
EntityWrapper
<
AreaEntity
>().
eq
(
"state"
,
1
));
List
<
AreaEntity
>
aTreeList
=
buildAreaTree
(
areaList
,
0L
);
String
name
=
(
String
)
params
.
get
(
"name"
);
List
<
AreaEntity
>
allList
=
this
.
baseMapper
.
listTree
(
name
);
List
<
AreaEntity
>
list
=
buildAreaTree
(
allList
,
0
);
Page
<
AreaEntity
>
page
=
new
Page
<
AreaEntity
>();
page
.
setRecords
(
list
);
return
new
PageUtils
(
page
);
return
aTreeList
;
}
...
...
src/main/resources/mapper/system/AreaDao.xml
View file @
bbe8cb75
...
...
@@ -10,4 +10,30 @@
#{id}
</foreach>
</update>
<!-- 查询树形数据-->
<select
id=
"listTree"
resultType=
"AreaEntity"
>
SELECT * FROM system_areas AS t
INNER JOIN (
SELECT id AS id2 FROM system_areas
WHERE
pid = 0
<if
test=
"name != null and name !=''"
>
AND NAME LIKE CONCAT('%',#{name},'%')
</if>
LIMIT 10
) AS t2 ON t.root_id = t2.id2
UNION ALL(SELECT *, 0 AS id2 FROM system_areas
WHERE
pid = 0
<if
test=
"name != null and name !=''"
>
AND NAME LIKE CONCAT('%',#{name},'%')
</if>
LIMIT 10
)
ORDER BY id
</select>
</mapper>
\ No newline at end of file
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