Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
C
chinafrica
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
zhengfg
chinafrica
Commits
5253e4e7
提交
5253e4e7
authored
10月 28, 2020
作者:
吴德鹏
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
条款管理
上级
94d783a3
显示空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
200 行增加
和
58 行删除
+200
-58
TermController.java
...src/main/java/com/platform/controller/TermController.java
+21
-2
TermDao.java
platform-admin/src/main/java/com/platform/dao/TermDao.java
+6
-0
TermEntity.java
...m-admin/src/main/java/com/platform/entity/TermEntity.java
+17
-0
TermService.java
...admin/src/main/java/com/platform/service/TermService.java
+4
-1
TermServiceImpl.java
.../main/java/com/platform/service/impl/TermServiceImpl.java
+24
-2
TermVo.java
platform-admin/src/main/java/com/platform/vo/TermVo.java
+23
-0
TermDao.xml
...orm-admin/src/main/resources/com/platform/dao/TermDao.xml
+105
-53
没有找到文件。
platform-admin/src/main/java/com/platform/controller/TermController.java
浏览文件 @
5253e4e7
...
...
@@ -5,6 +5,9 @@ import com.platform.service.TermService;
import
com.platform.utils.PageUtils
;
import
com.platform.utils.Query
;
import
com.platform.utils.R
;
import
com.platform.utils.RRException
;
import
com.platform.vo.TermVo
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.shiro.authz.annotation.RequiresPermissions
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
...
...
@@ -39,7 +42,7 @@ public class TermController {
//查询列表数据
Query
query
=
new
Query
(
params
);
List
<
Term
Entity
>
termList
=
termService
.
queryList
(
query
);
List
<
Term
Vo
>
termList
=
termService
.
queryList
(
query
);
int
total
=
termService
.
queryTotal
(
query
);
PageUtils
pageUtil
=
new
PageUtils
(
termList
,
total
,
query
.
getLimit
(),
query
.
getPage
());
...
...
@@ -47,6 +50,22 @@ public class TermController {
return
R
.
ok
().
put
(
"page"
,
pageUtil
);
}
/**
* 根据Id查询子条款
*
* @return
*/
@RequestMapping
(
"/queryChildrenTerms/{id}"
)
@ResponseBody
public
R
queryChildrenTerms
(
@PathVariable
(
"id"
)
String
id
)
{
if
(
StringUtils
.
isBlank
(
id
))
{
throw
new
RRException
(
"参数不能为空"
);
}
List
<
TermEntity
>
list
=
termService
.
queryChildrenTerms
(
id
);
return
R
.
ok
().
put
(
"list"
,
list
);
}
/**
* 查看信息
*/
...
...
@@ -102,7 +121,7 @@ public class TermController {
@ResponseBody
public
R
queryAll
(
@RequestParam
Map
<
String
,
Object
>
params
)
{
List
<
Term
Entity
>
list
=
termService
.
queryList
(
params
);
List
<
Term
Vo
>
list
=
termService
.
queryList
(
params
);
return
R
.
ok
().
put
(
"list"
,
list
);
}
...
...
platform-admin/src/main/java/com/platform/dao/TermDao.java
浏览文件 @
5253e4e7
package
com
.
platform
.
dao
;
import
com.platform.entity.TermEntity
;
import
com.platform.vo.TermVo
;
import
java.util.List
;
import
java.util.Map
;
/**
* Dao
...
...
@@ -10,4 +14,6 @@ import com.platform.entity.TermEntity;
*/
public
interface
TermDao
extends
BaseDao
<
TermEntity
>
{
List
<
TermVo
>
queryTermsList
(
Map
<
String
,
Object
>
map
);
List
<
TermEntity
>
queryChildrenTerms
(
String
parentId
);
}
platform-admin/src/main/java/com/platform/entity/TermEntity.java
浏览文件 @
5253e4e7
...
...
@@ -2,6 +2,7 @@ package com.platform.entity;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.List
;
/**
* 实体
...
...
@@ -25,6 +26,10 @@ public class TermEntity implements Serializable {
* 条款名称
*/
private
String
termName
;
/**
* 父条款名称
*/
private
String
parentName
;
/**
* 条款内容
*/
...
...
@@ -46,6 +51,8 @@ public class TermEntity implements Serializable {
*/
private
Integer
sort
;
/**
* 设置:条款ID
*/
...
...
@@ -150,4 +157,14 @@ public class TermEntity implements Serializable {
public
Integer
getSort
()
{
return
sort
;
}
public
String
getParentName
()
{
return
parentName
;
}
public
void
setParentName
(
String
parentName
)
{
this
.
parentName
=
parentName
;
}
}
platform-admin/src/main/java/com/platform/service/TermService.java
浏览文件 @
5253e4e7
package
com
.
platform
.
service
;
import
com.platform.entity.TermEntity
;
import
com.platform.vo.TermVo
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -27,7 +28,7 @@ public interface TermService {
* @param map 参数
* @return list
*/
List
<
Term
Entity
>
queryList
(
Map
<
String
,
Object
>
map
);
List
<
Term
Vo
>
queryList
(
Map
<
String
,
Object
>
map
);
/**
* 分页统计总数
...
...
@@ -68,4 +69,6 @@ public interface TermService {
* @return 删除条数
*/
int
deleteBatch
(
String
[]
ids
);
List
<
TermEntity
>
queryChildrenTerms
(
String
parentId
);
}
platform-admin/src/main/java/com/platform/service/impl/TermServiceImpl.java
浏览文件 @
5253e4e7
...
...
@@ -4,9 +4,12 @@ import com.platform.dao.TermDao;
import
com.platform.entity.TermEntity
;
import
com.platform.service.TermService
;
import
com.platform.utils.IdUtil
;
import
com.platform.vo.TermVo
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -27,8 +30,15 @@ public class TermServiceImpl implements TermService {
}
@Override
public
List
<
TermEntity
>
queryList
(
Map
<
String
,
Object
>
map
)
{
return
termDao
.
queryList
(
map
);
public
List
<
TermVo
>
queryList
(
Map
<
String
,
Object
>
map
)
{
//查询所有一级条款
map
.
put
(
"parentId"
,
"0"
);
List
<
TermVo
>
termList
=
termDao
.
queryTermsList
(
map
);
for
(
TermVo
term
:
termList
)
{
List
<
TermEntity
>
childrenTerms
=
termDao
.
queryChildrenTerms
(
term
.
getId
());
term
.
setChildrenList
(
childrenTerms
);
}
return
termList
;
}
@Override
...
...
@@ -39,11 +49,18 @@ public class TermServiceImpl implements TermService {
@Override
public
int
save
(
TermEntity
term
)
{
term
.
setId
(
IdUtil
.
createIdbyUUID
());
term
.
setCreateTime
(
new
Date
());
term
.
setUpdateTime
(
new
Date
());
if
(
StringUtils
.
isBlank
(
term
.
getParentId
()))
{
//一级条款父Id为0
term
.
setParentId
(
"0"
);
}
return
termDao
.
save
(
term
);
}
@Override
public
int
update
(
TermEntity
term
)
{
term
.
setUpdateTime
(
new
Date
());
return
termDao
.
update
(
term
);
}
...
...
@@ -56,4 +73,9 @@ public class TermServiceImpl implements TermService {
public
int
deleteBatch
(
String
[]
ids
)
{
return
termDao
.
deleteBatch
(
ids
);
}
@Override
public
List
<
TermEntity
>
queryChildrenTerms
(
String
parentId
)
{
return
termDao
.
queryChildrenTerms
(
parentId
);
}
}
platform-admin/src/main/java/com/platform/vo/TermVo.java
0 → 100644
浏览文件 @
5253e4e7
package
com
.
platform
.
vo
;
import
com.platform.entity.TermEntity
;
import
java.util.List
;
/**
* @Auther: wudepeng
* @Date: 2020/10/28
* @Description:
*/
public
class
TermVo
extends
TermEntity
{
private
List
<
TermEntity
>
childrenList
;
public
List
<
TermEntity
>
getChildrenList
()
{
return
childrenList
;
}
public
void
setChildrenList
(
List
<
TermEntity
>
childrenList
)
{
this
.
childrenList
=
childrenList
;
}
}
platform-admin/src/main/resources/com/platform/dao/TermDao.xml
浏览文件 @
5253e4e7
...
...
@@ -28,7 +28,7 @@
where id = #{id}
</select>
<select
id=
"queryList"
resultType=
"com.platform.entity.TermEntity
"
>
<select
id=
"queryList"
resultType=
"com.platform.vo.TermVo
"
>
select
`id`,
`parent_id`,
...
...
@@ -43,12 +43,15 @@
<if
test=
"name != null and name.trim() != ''"
>
AND name LIKE concat('%',#{name},'%')
</if>
<if
test=
"parentId != null and parentId.trim() != ''"
>
AND parent_id=#{parentId}
</if>
<choose>
<when
test=
"sidx != null and sidx.trim() != ''"
>
order by ${sidx} ${order}
</when>
<otherwise>
order by
id
desc
order by
create_time
desc
</otherwise>
</choose>
<if
test=
"offset != null and limit != null"
>
...
...
@@ -56,12 +59,61 @@
</if>
</select>
<select
id=
"queryTermsList"
resultType=
"com.platform.vo.TermVo"
>
select
`id`,
`parent_id`,
`term_name`,
`term_content`,
`create_time`,
`update_time`,
`status`,
`sort`
from term
WHERE 1=1
<if
test=
"name != null and name.trim() != ''"
>
AND name LIKE concat('%',#{name},'%')
</if>
<if
test=
"parentId != null and parentId.trim() != ''"
>
AND parent_id=#{parentId}
</if>
<choose>
<when
test=
"sidx != null and sidx.trim() != ''"
>
order by ${sidx} ${order}
</when>
<otherwise>
order by sort
</otherwise>
</choose>
<if
test=
"offset != null and limit != null"
>
limit #{offset}, #{limit}
</if>
</select>
<select
id=
"queryChildrenTerms"
resultType=
"com.platform.entity.TermEntity"
>
select
t2.`id`,
t2.`parent_id`,
t2.`term_name`,
t2.`term_content`,
t2.`create_time`,
t2.`update_time`,
t2.`status`,
t2.`sort`,
t1.term_name parentName
from term t2 left join term t1 on t1.id=t2.parent_id
where t2.parent_id=#{parentId}
order by t2.`sort` asc
</select>
<select
id=
"queryTotal"
resultType=
"int"
>
select count(*) from term
WHERE 1=1
<if
test=
"name != null and name.trim() != ''"
>
AND name LIKE concat('%',#{name},'%')
</if>
<if
test=
"parentId != null and parentId.trim() != ''"
>
AND parent_id=#{parentId}
</if>
</select>
<insert
id=
"save"
parameterType=
"com.platform.entity.TermEntity"
>
...
...
@@ -88,12 +140,12 @@
<update
id=
"update"
parameterType=
"com.platform.entity.TermEntity"
>
update term
<set>
<if
test=
"parentId != null"
>
`parent_id` = #{parentId},
</if>
<if
test=
"termName != null"
>
`term_name` = #{termName},
</if>
<if
test=
"termContent != null"
>
`term_content` = #{termContent},
</if>
<if
test=
"createTime != null"
>
`create_time` = #{createTime},
</if>
<if
test=
"updateTime != null"
>
`update_time` = #{updateTime},
</if>
<if
test=
"status != null"
>
`status` = #{status},
</if>
<if
test=
"parentId != null"
>
`parent_id` = #{parentId},
</if>
<if
test=
"termName != null"
>
`term_name` = #{termName},
</if>
<if
test=
"termContent != null"
>
`term_content` = #{termContent},
</if>
<if
test=
"createTime != null"
>
`create_time` = #{createTime},
</if>
<if
test=
"updateTime != null"
>
`update_time` = #{updateTime},
</if>
<if
test=
"status != null"
>
`status` = #{status},
</if>
<if
test=
"sort != null"
>
`sort` = #{sort}
</if>
</set>
where id = #{id}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论