Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
wangxiaolu-link-report
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
sfa
wangxiaolu-link-report
Commits
44cf4776
提交
44cf4776
authored
3月 20, 2025
作者:
吕本才
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1、修改报表分组列表查询接口
上级
b0321c2f
隐藏空白字符变更
内嵌
并排
正在显示
15 个修改的文件
包含
202 行增加
和
41 行删除
+202
-41
CustomerReportGroupQueryController.java
.../controller/query/CustomerReportGroupQueryController.java
+4
-3
CustomerReportQueryController.java
...eport/controller/query/CustomerReportQueryController.java
+4
-3
ReportShareQueryController.java
...k/report/controller/query/ReportShareQueryController.java
+2
-0
CustomerGroupDao.java
...ain/java/com/link/report/domain/dao/CustomerGroupDao.java
+10
-0
CustomerGroupDaoImpl.java
...com/link/report/domain/dao/impl/CustomerGroupDaoImpl.java
+42
-0
CustomerGroup.java
...ain/java/com/link/report/domain/entity/CustomerGroup.java
+57
-0
CustomerReportGroup.java
...va/com/link/report/domain/entity/CustomerReportGroup.java
+1
-0
CustomerGroupMapper.java
...va/com/link/report/domain/mapper/CustomerGroupMapper.java
+9
-0
CustomerGroupQueryWq.java
.../java/com/link/report/domain/wq/CustomerGroupQueryWq.java
+9
-0
CustomerReportQueryListVo.java
...m/link/report/pojo/request/CustomerReportQueryListVo.java
+1
-1
CustomerGroupDto.java
.../java/com/link/report/pojo/response/CustomerGroupDto.java
+11
-0
CustomerReportGroupQueryListDto.java
...report/pojo/response/CustomerReportGroupQueryListDto.java
+2
-1
CustomerReportGroupService.java
...a/com/link/report/service/CustomerReportGroupService.java
+2
-1
CustomerReportGroupServiceImpl.java
...k/report/service/impl/CustomerReportGroupServiceImpl.java
+31
-23
CustomerReportGroupMapper.xml
...ain/resources/mapper/report/CustomerReportGroupMapper.xml
+17
-9
没有找到文件。
src/main/java/com/link/report/controller/query/CustomerReportGroupQueryController.java
浏览文件 @
44cf4776
package
com
.
link
.
report
.
controller
.
query
;
import
com.link.report.pojo.request.CustomerReportQueryListVo
;
import
com.link.report.pojo.response.CustomerReportGroupResDto
;
import
com.link.report.service.CustomerReportGroupService
;
import
com.sfa.common.core.domain.R
;
...
...
@@ -23,10 +24,10 @@ public class CustomerReportGroupQueryController {
@Autowired
CustomerReportGroupService
customerReportGroupService
;
@RequiresPermissions
(
"bi:
customerReport
:list"
)
@RequiresPermissions
(
"bi:
supply
:list"
)
@GetMapping
(
"/group/list"
)
public
R
<
List
<
CustomerReportGroupResDto
>>
queryList
()
{
List
<
CustomerReportGroupResDto
>
dtos
=
customerReportGroupService
.
queryList
();
public
R
<
List
<
CustomerReportGroupResDto
>>
queryList
(
CustomerReportQueryListVo
vo
)
{
List
<
CustomerReportGroupResDto
>
dtos
=
customerReportGroupService
.
queryList
(
vo
);
return
R
.
ok
(
dtos
);
}
}
src/main/java/com/link/report/controller/query/CustomerReportQueryController.java
浏览文件 @
44cf4776
package
com
.
link
.
report
.
controller
.
query
;
import
com.link.report.pojo.request.CustomerReportQueryListVo
;
import
com.link.report.pojo.response.CustomerReportListDto
;
import
com.link.report.service.CustomerReportService
;
import
com.sfa.common.core.domain.R
;
import
com.sfa.common.security.annotation.RequiresPermissions
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
...
...
@@ -22,7 +23,7 @@ public class CustomerReportQueryController {
@Autowired
CustomerReportService
customerReportService
;
@RequiresPermissions
(
"bi:
customerReport
:list"
)
@RequiresPermissions
(
"bi:
supply
:list"
)
@GetMapping
(
"/list"
)
public
R
<
List
<
CustomerReportListDto
>>
queryList
()
{
List
<
CustomerReportListDto
>
customerReportListDtos
=
customerReportService
.
queryCustomerReportList
();
...
...
src/main/java/com/link/report/controller/query/ReportShareQueryController.java
浏览文件 @
44cf4776
...
...
@@ -6,6 +6,7 @@ import com.link.report.service.ReportShareService;
import
com.sfa.common.core.domain.R
;
import
com.sfa.common.core.web.controller.BaseController
;
import
com.sfa.common.datascope.annotation.DataScope
;
import
com.sfa.common.security.annotation.RequiresPermissions
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
...
@@ -34,6 +35,7 @@ public class ReportShareQueryController extends BaseController {
*/
@DataScope
(
deptAlias
=
"d"
,
userAlias
=
"u"
)
@GetMapping
(
"/list"
)
@RequiresPermissions
(
"bi:supply:list"
)
public
R
<
List
<
ReportShareBiListDto
>>
selectList
(
ReportShareListVo
reportShareListVo
)
{
List
<
ReportShareBiListDto
>
reportShareBiListDtos
=
reportShareService
.
selectList
(
reportShareListVo
);
return
R
.
ok
(
reportShareBiListDtos
);
...
...
src/main/java/com/link/report/domain/dao/CustomerGroupDao.java
0 → 100644
浏览文件 @
44cf4776
package
com
.
link
.
report
.
domain
.
dao
;
import
com.link.report.domain.wq.CustomerGroupQueryWq
;
import
com.link.report.pojo.response.CustomerGroupDto
;
import
java.util.List
;
public
interface
CustomerGroupDao
{
List
<
CustomerGroupDto
>
queryList
(
CustomerGroupQueryWq
wq
);
}
src/main/java/com/link/report/domain/dao/impl/CustomerGroupDaoImpl.java
0 → 100644
浏览文件 @
44cf4776
package
com
.
link
.
report
.
domain
.
dao
.
impl
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.baomidou.mybatisplus.core.conditions.Wrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.link.report.domain.dao.CustomerGroupDao
;
import
com.link.report.domain.entity.CustomerGroup
;
import
com.link.report.domain.mapper.CustomerGroupMapper
;
import
com.link.report.domain.wq.CustomerGroupQueryWq
;
import
com.link.report.pojo.response.CustomerGroupDto
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* 报表分享数据
*/
@Component
public
class
CustomerGroupDaoImpl
implements
CustomerGroupDao
{
@Autowired
private
CustomerGroupMapper
groupMapper
;
@Override
public
List
<
CustomerGroupDto
>
queryList
(
CustomerGroupQueryWq
wq
)
{
Wrapper
<
CustomerGroup
>
wraper
=
new
LambdaQueryWrapper
<
CustomerGroup
>()
.
eq
(
ObjectUtil
.
isNotEmpty
(
wq
.
getCategoryName
()),
CustomerGroup:
:
getCategoryName
,
wq
.
getCategoryName
());
List
<
CustomerGroup
>
customerGroups
=
groupMapper
.
selectList
(
wraper
);
List
<
CustomerGroupDto
>
result
=
new
ArrayList
<>();
for
(
CustomerGroup
customerGroup
:
customerGroups
)
{
CustomerGroupDto
dto
=
new
CustomerGroupDto
();
dto
.
setGroupId
(
customerGroup
.
getId
());
dto
.
setGroupName
(
customerGroup
.
getName
());
dto
.
setCatalogName
(
customerGroup
.
getCategoryName
());
result
.
add
(
dto
);
}
return
result
;
}
}
src/main/java/com/link/report/domain/entity/CustomerGroup.java
0 → 100644
浏览文件 @
44cf4776
package
com
.
link
.
report
.
domain
.
entity
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
lombok.Data
;
import
java.util.Date
;
/**
* 对应数据库自定义分组表 customer_group 的 Java Bean 类
*/
@TableName
(
value
=
"customer_group"
)
@Data
public
class
CustomerGroup
{
/**
* 主键
*/
private
String
id
;
/**
* 分组名称
*/
private
String
name
;
/**
* 说明
*/
private
String
remark
;
/**
* 分类名称
*/
private
String
categoryName
;
/**
* 创建人
*/
private
String
createBy
;
/**
* 创建时间
*/
private
Date
createTime
;
/**
* 修改人
*/
private
String
updateBy
;
/**
* 修改时间
*/
private
Date
updateTime
;
/**
* 删除标识,0 表示正常,1 表示已删除
*/
private
Integer
delFlag
;
/**
* 多租户标识
*/
private
String
tenantId
;
/**
* 乐观锁版本
*/
private
Integer
updateCount
;
}
src/main/java/com/link/report/domain/entity/CustomerReportGroup.java
浏览文件 @
44cf4776
...
...
@@ -9,6 +9,7 @@ import java.util.Date;
public
class
CustomerReportGroup
{
private
String
id
;
private
String
reportId
;
private
Integer
reportType
;
private
String
groupId
;
private
String
createBy
;
private
Date
createTime
;
...
...
src/main/java/com/link/report/domain/mapper/CustomerGroupMapper.java
0 → 100644
浏览文件 @
44cf4776
package
com
.
link
.
report
.
domain
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.link.report.domain.entity.CustomerGroup
;
import
org.apache.ibatis.annotations.Mapper
;
@Mapper
public
interface
CustomerGroupMapper
extends
BaseMapper
<
CustomerGroup
>
{
}
src/main/java/com/link/report/domain/wq/CustomerGroupQueryWq.java
0 → 100644
浏览文件 @
44cf4776
package
com
.
link
.
report
.
domain
.
wq
;
import
lombok.Data
;
@Data
public
class
CustomerGroupQueryWq
{
private
String
categoryName
;
}
src/main/java/com/link/report/pojo/request/CustomerReportQueryListVo.java
浏览文件 @
44cf4776
...
...
@@ -9,5 +9,5 @@ import lombok.Data;
*/
@Data
public
class
CustomerReportQueryListVo
{
private
String
categoryName
;
}
src/main/java/com/link/report/pojo/response/CustomerGroupDto.java
0 → 100644
浏览文件 @
44cf4776
package
com
.
link
.
report
.
pojo
.
response
;
import
lombok.Data
;
@Data
public
class
CustomerGroupDto
{
private
String
groupId
;
private
String
groupName
;
private
String
catalogName
;
}
src/main/java/com/link/report/pojo/response/CustomerReportGroupQueryListDto.java
浏览文件 @
44cf4776
...
...
@@ -4,9 +4,10 @@ import lombok.Data;
@Data
public
class
CustomerReportGroupQueryListDto
{
private
String
reportId
;
private
String
groupId
;
private
String
groupName
;
private
String
reportId
;
private
String
reportName
;
private
Integer
reportType
;
private
String
previewUrl
;
}
src/main/java/com/link/report/service/CustomerReportGroupService.java
浏览文件 @
44cf4776
package
com
.
link
.
report
.
service
;
import
com.link.report.pojo.request.CustomerReportGroupVo
;
import
com.link.report.pojo.request.CustomerReportQueryListVo
;
import
com.link.report.pojo.response.CustomerReportGroupResDto
;
import
java.util.List
;
public
interface
CustomerReportGroupService
{
List
<
CustomerReportGroupResDto
>
queryList
();
List
<
CustomerReportGroupResDto
>
queryList
(
CustomerReportQueryListVo
vo
);
void
save
(
List
<
CustomerReportGroupVo
>
customerReportAddVo
);
}
src/main/java/com/link/report/service/impl/CustomerReportGroupServiceImpl.java
浏览文件 @
44cf4776
package
com
.
link
.
report
.
service
.
impl
;
import
cn.hutool.core.util.IdUtil
;
import
c
n.hutool.core.util.ObjectUtil
;
import
c
om.link.report.domain.dao.CustomerGroupDao
;
import
com.link.report.domain.dao.CustomerReportGroupDao
;
import
com.link.report.domain.entity.CustomerReportGroup
;
import
com.link.report.domain.wq.CustomerGroupQueryWq
;
import
com.link.report.pojo.request.CustomerReportGroupVo
;
import
com.link.report.pojo.request.CustomerReportQueryListVo
;
import
com.link.report.pojo.response.CustomerGroupDto
;
import
com.link.report.pojo.response.CustomerReportGroupQueryListDto
;
import
com.link.report.pojo.response.CustomerReportGroupResDto
;
import
com.link.report.pojo.response.ReportItemsDto
;
...
...
@@ -16,52 +19,56 @@ import org.springframework.transaction.annotation.Transactional;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
* 报表分享数据
*/
@Service
public
class
CustomerReportGroupServiceImpl
implements
CustomerReportGroupService
{
public
class
CustomerReportGroupServiceImpl
implements
CustomerReportGroupService
{
@Autowired
private
CustomerReportGroupDao
customerReportGroupDao
;
@Autowired
private
CustomerGroupDao
customerGroupDao
;
@Override
public
List
<
CustomerReportGroupResDto
>
queryList
()
{
List
<
CustomerReportGroupQueryListDto
>
list
=
customerReportGroupDao
.
queryList
();
// 根据dtos 依照groupId,作为key,转换成 Map结构
Map
<
String
,
List
<
CustomerReportGroupQueryListDto
>>
groupedMap
=
list
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
CustomerReportGroupQueryListDto:
:
getGroupId
)
);
public
List
<
CustomerReportGroupResDto
>
queryList
(
CustomerReportQueryListVo
vo
)
{
CustomerGroupQueryWq
wq
=
new
CustomerGroupQueryWq
();
wq
.
setCategoryName
(
vo
.
getCategoryName
());
// 先查询分组
List
<
CustomerGroupDto
>
groupDtos
=
customerGroupDao
.
queryList
(
wq
);
List
<
CustomerReportGroupQueryListDto
>
list
=
customerReportGroupDao
.
queryList
();
// 转换成list结构
List
<
CustomerReportGroupResDto
>
result
=
new
ArrayList
<>();
for
(
CustomerReportGroupQueryListDto
dto
:
list
)
{
List
<
CustomerReportGroupResDto
>
result
=
new
ArrayList
<>();
for
(
CustomerGroupDto
dto
:
groupDtos
)
{
// 先看分组
CustomerReportGroupResDto
resDto
=
new
CustomerReportGroupResDto
();
resDto
.
setGroupId
(
dto
.
getGroupId
());
resDto
.
setGroupName
(
dto
.
getGroupName
());
List
<
CustomerReportGroupQueryListDto
>
groupListDtos
=
groupedMap
.
get
(
dto
.
getGroupId
()
);
if
(
ObjectUtil
.
isNotEmpty
(
groupListDtos
)){
List
<
ReportItemsDto
>
itemsDtos
=
new
ArrayList
<>();
// 转换成ReportShareBiListDto
for
(
CustomerReportGroupQueryListDto
groupListDto
:
groupListDtos
)
{
List
<
ReportItemsDto
>
itemsDtos
=
new
ArrayList
<>(
);
// 在看报表
for
(
CustomerReportGroupQueryListDto
reportGroupQueryListDto
:
list
)
{
if
(
reportGroupQueryListDto
.
getGroupId
().
equals
(
dto
.
getGroupId
()))
{
// 转换成ReportShareBiListDto
ReportItemsDto
itemsDto
=
new
ReportItemsDto
();
itemsDto
.
setReportId
(
group
ListDto
.
getReportId
());
itemsDto
.
setReportName
(
group
ListDto
.
getReportName
());
itemsDto
.
setPreviewUrl
(
group
ListDto
.
getPreviewUrl
());
itemsDto
.
setReportId
(
reportGroupQuery
ListDto
.
getReportId
());
itemsDto
.
setReportName
(
reportGroupQuery
ListDto
.
getReportName
());
itemsDto
.
setPreviewUrl
(
reportGroupQuery
ListDto
.
getPreviewUrl
());
itemsDtos
.
add
(
itemsDto
);
}
resDto
.
setItems
(
itemsDtos
);
}
resDto
.
setItems
(
itemsDtos
);
result
.
add
(
resDto
);
}
return
result
;
}
/**
* 新增或者修改
*
* @param customerReportGroupVo
*/
@Transactional
(
rollbackFor
=
Exception
.
class
)
...
...
@@ -72,7 +79,7 @@ public class CustomerReportGroupServiceImpl implements CustomerReportGroupServic
customerReportGroupDao
.
deleteByCreatorId
(
userId
);
// 新增
List
<
CustomerReportGroup
>
items
=
new
ArrayList
<>();
List
<
CustomerReportGroup
>
items
=
new
ArrayList
<>();
for
(
CustomerReportGroupVo
vo
:
customerReportGroupVo
)
{
List
<
ReportItemsDto
>
itemsDtos
=
vo
.
getItems
();
for
(
ReportItemsDto
item
:
itemsDtos
)
{
...
...
@@ -81,7 +88,8 @@ public class CustomerReportGroupServiceImpl implements CustomerReportGroupServic
dto
.
setId
(
IdUtil
.
getSnowflakeNextIdStr
());
dto
.
setGroupId
(
vo
.
getId
());
dto
.
setReportId
(
item
.
getReportId
());
dto
.
setCreateBy
(
String
.
valueOf
(
userId
));
dto
.
setReportType
(
item
.
getReportType
());
dto
.
setCreateBy
(
String
.
valueOf
(
userId
));
dto
.
setTenantId
(
String
.
valueOf
(
userId
));
items
.
add
(
dto
);
}
...
...
src/main/resources/mapper/report/CustomerReportGroupMapper.xml
浏览文件 @
44cf4776
...
...
@@ -7,6 +7,7 @@
INSERT INTO customer_report_group (
id,
report_id,
report_type,
group_id,
create_by,
create_time,
...
...
@@ -20,6 +21,7 @@
(
#{item.id},
#{item.reportId},
#{item.reportType},
#{item.groupId},
#{item.createBy},
#{item.createTime},
...
...
@@ -35,16 +37,18 @@
<select
id=
"queryReportGroupList"
resultType=
"com.link.report.pojo.response.CustomerReportGroupQueryListDto"
>
<!-- 自定义报表关联 -->
select distinct groupId ,groupName,reportId,reportName,previewUrl,reportType from (
SELECT
crg.report_id as reportId,
crg.group_id as groupId,
cg.id as groupId,
cg.name as groupName,
crg.report_type as reportType,
crg.report_id as reportId,
cr.name as reportName,
cr.preview_url as previewUrl
FROM
customer_
report_group cr
g
join customer_report
cr on crg.report_id = cr
.id
join customer_
group cg on crg.group_id = cg.id
customer_
group c
g
join customer_report
_group crg on crg.group_id = cg
.id
join customer_
report cr on crg.report_id = cr.id and crg.report_type = cr.report_type
<where>
<if
test=
"userId != null and userId != ''"
>
...
...
@@ -54,20 +58,24 @@
<!-- 积木报表关联 -->
union
SELECT
crg.report_id as reportId,
crg.group_id as groupId,
cg.id as groupId,
cg.name as groupName,
crg.report_type as reportType,
jr.id as reportId,
jr.name as reportName,
jrs.preview_url as previewUrl
FROM
customer_report_group crg
customer_group cg
join customer_report_group crg on crg.group_id = cg.id and crg.report_type = 1
join jimu_report jr on crg.report_id = jr.id
join customer_group cg on crg.group_id = cg.id
join jimu_report_share jrs on jr.id = jrs.report_id
<where>
<if
test=
"userId!= null and userId!= ''"
>
AND crg.create_by = #{userId}
</if>
</where>
) tmp
</select>
</mapper>
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论