Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
midjourney-proxy
Overview
Overview
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
徐少华
midjourney-proxy
Commits
93d8e9bf
Commit
93d8e9bf
authored
Mar 31, 2021
by
桂前礼
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: [1004526] 业务(bm\trade\book)\接口\数据库层面推动优化
parent
9a388a5f
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
133 additions
and
35 deletions
+133
-35
BookGroupBiz.java
...src/main/java/com/pcloud/book/group/biz/BookGroupBiz.java
+2
-1
BookGroupBizImpl.java
...java/com/pcloud/book/group/biz/impl/BookGroupBizImpl.java
+45
-31
BookGroupFacade.java
...in/java/com/pcloud/book/group/facade/BookGroupFacade.java
+2
-1
BookGroupFacadeImpl.java
...om/pcloud/book/group/facade/impl/BookGroupFacadeImpl.java
+3
-2
BookMapper.java
...in/java/com/pcloud/book/mapper/clickhouse/BookMapper.java
+18
-0
BookMapper.xml
...ce-book/src/main/resources/clickhouse/book/BookMapper.xml
+63
-0
No files found.
pcloud-service-book/src/main/java/com/pcloud/book/group/biz/BookGroupBiz.java
View file @
93d8e9bf
...
@@ -58,6 +58,7 @@ import com.pcloud.book.group.vo.GroupIncomeStaticParamVO;
...
@@ -58,6 +58,7 @@ import com.pcloud.book.group.vo.GroupIncomeStaticParamVO;
import
com.pcloud.book.group.vo.GroupScanTrendParamVO
;
import
com.pcloud.book.group.vo.GroupScanTrendParamVO
;
import
com.pcloud.book.group.vo.GroupScanTrendVO
;
import
com.pcloud.book.group.vo.GroupScanTrendVO
;
import
com.pcloud.book.group.vo.GroupStatisticVO
;
import
com.pcloud.book.group.vo.GroupStatisticVO
;
import
com.pcloud.book.group.vo.ListBook4ChannelVO
;
import
com.pcloud.book.group.vo.ListBookGroup4ChannelParamVO
;
import
com.pcloud.book.group.vo.ListBookGroup4ChannelParamVO
;
import
com.pcloud.book.group.vo.ResourcesStatisticVO
;
import
com.pcloud.book.group.vo.ResourcesStatisticVO
;
import
com.pcloud.book.group.vo.StatisticVO
;
import
com.pcloud.book.group.vo.StatisticVO
;
...
@@ -206,7 +207,7 @@ public interface BookGroupBiz {
...
@@ -206,7 +207,7 @@ public interface BookGroupBiz {
* @author 戴兴
* @author 戴兴
* @date 2019/7/23 15:39
* @date 2019/7/23 15:39
*/
*/
PageBean
listBookGroup4Channel
(
Long
channelId
,
ListBookGroup4ChannelParamVO
listBookGroup4ChannelParamVO
);
PageBean
New
<
ListBook4ChannelVO
>
listBookGroup4Channel
(
Long
channelId
,
ListBookGroup4ChannelParamVO
listBookGroup4ChannelParamVO
);
/**
/**
* 获取社群书列表(编辑)
* 获取社群书列表(编辑)
...
...
pcloud-service-book/src/main/java/com/pcloud/book/group/biz/impl/BookGroupBizImpl.java
View file @
93d8e9bf
...
@@ -195,6 +195,7 @@ import com.pcloud.book.keywords.dao.BookKeywordDao;
...
@@ -195,6 +195,7 @@ import com.pcloud.book.keywords.dao.BookKeywordDao;
import
com.pcloud.book.keywords.dto.KeywordDTO
;
import
com.pcloud.book.keywords.dto.KeywordDTO
;
import
com.pcloud.book.keywords.enums.ReplyTypeEnum
;
import
com.pcloud.book.keywords.enums.ReplyTypeEnum
;
import
com.pcloud.book.keywords.vo.ListKeywordVO
;
import
com.pcloud.book.keywords.vo.ListKeywordVO
;
import
com.pcloud.book.mapper.clickhouse.BookMapper
;
import
com.pcloud.book.pcloudkeyword.biz.PcloudRobotBiz
;
import
com.pcloud.book.pcloudkeyword.biz.PcloudRobotBiz
;
import
com.pcloud.book.pcloudkeyword.entity.PcloudRobot
;
import
com.pcloud.book.pcloudkeyword.entity.PcloudRobot
;
import
com.pcloud.book.push.enums.AltTypeEnum
;
import
com.pcloud.book.push.enums.AltTypeEnum
;
...
@@ -499,6 +500,8 @@ public class BookGroupBizImpl implements BookGroupBiz {
...
@@ -499,6 +500,8 @@ public class BookGroupBizImpl implements BookGroupBiz {
private
WordappConsr
wordappConsr
;
private
WordappConsr
wordappConsr
;
@Autowired
@Autowired
private
ExerciseBookConsr
exerciseBookConsr
;
private
ExerciseBookConsr
exerciseBookConsr
;
@Autowired
private
BookMapper
bookMapper
;
private
static
final
ThreadPoolExecutor
PLATFORM_STATISTICS_EXPORT_THREAD
=
new
ThreadPoolExecutor
(
2
,
2
,
private
static
final
ThreadPoolExecutor
PLATFORM_STATISTICS_EXPORT_THREAD
=
new
ThreadPoolExecutor
(
2
,
2
,
0
,
TimeUnit
.
SECONDS
,
new
LinkedBlockingQueue
<>(),
0
,
TimeUnit
.
SECONDS
,
new
LinkedBlockingQueue
<>(),
...
@@ -1300,7 +1303,7 @@ public class BookGroupBizImpl implements BookGroupBiz {
...
@@ -1300,7 +1303,7 @@ public class BookGroupBizImpl implements BookGroupBiz {
}
}
@Override
@Override
public
PageBean
listBookGroup4Channel
(
Long
channelId
,
ListBookGroup4ChannelParamVO
listBookGroup4ChannelParamVO
)
{
public
PageBean
New
<
ListBook4ChannelVO
>
listBookGroup4Channel
(
Long
channelId
,
ListBookGroup4ChannelParamVO
listBookGroup4ChannelParamVO
)
{
Integer
currentPage
=
listBookGroup4ChannelParamVO
.
getCurrentPage
();
Integer
currentPage
=
listBookGroup4ChannelParamVO
.
getCurrentPage
();
Integer
numPerPage
=
listBookGroup4ChannelParamVO
.
getNumPerPage
();
Integer
numPerPage
=
listBookGroup4ChannelParamVO
.
getNumPerPage
();
if
(
currentPage
==
null
||
numPerPage
==
null
||
currentPage
<
0
||
numPerPage
<
0
)
{
if
(
currentPage
==
null
||
numPerPage
==
null
||
currentPage
<
0
||
numPerPage
<
0
)
{
...
@@ -1319,29 +1322,32 @@ public class BookGroupBizImpl implements BookGroupBiz {
...
@@ -1319,29 +1322,32 @@ public class BookGroupBizImpl implements BookGroupBiz {
if
(
endTime
!=
null
)
{
if
(
endTime
!=
null
)
{
paramMap
.
put
(
"endTime"
,
endTime
+
" 23:59:59"
);
paramMap
.
put
(
"endTime"
,
endTime
+
" 23:59:59"
);
}
}
PageBean
listBookGroup4Channel
=
bookDao
.
listPage
(
pageParam
,
paramMap
,
"listBookGroup4Channel"
);
paramMap
.
put
(
"offset"
,
currentPage
*
numPerPage
);
List
<
Long
>
bookGroupIds
=
new
ArrayList
<>();
paramMap
.
put
(
"limit"
,
numPerPage
);
listBookGroup4Channel
.
getRecordList
().
forEach
(
e
->
{
ListBook4ChannelVO
listBook4ChannelVO
=
(
ListBook4ChannelVO
)
e
;
Integer
totalCount
=
bookMapper
.
countBookGroup4Channel
(
paramMap
);
bookGroupIds
.
add
(
listBook4ChannelVO
.
getBookGroupId
());
if
(
totalCount
<
1
)
{
});
return
new
PageBeanNew
(
currentPage
,
numPerPage
,
new
ArrayList
<>());
}
List
<
ListBook4ChannelVO
>
recordList
=
bookMapper
.
listBookGroup4Channel
(
paramMap
);
List
<
Long
>
bookGroupIds
=
recordList
.
stream
().
filter
(
x
->
ObjectUtil
.
isAllNotEmpty
(
x
,
x
.
getBookGroupId
())).
map
(
ListBook4ChannelVO:
:
getBookGroupId
).
distinct
().
collect
(
Collectors
.
toList
());
if
(
ListUtils
.
isEmpty
(
bookGroupIds
))
{
if
(
ListUtils
.
isEmpty
(
bookGroupIds
))
{
return
new
PageBean
(
0
,
0
,
new
ArrayList
<>());
return
new
PageBean
New
(
currentPage
,
numPerPage
,
new
ArrayList
<>());
}
}
Map
<
Long
,
BookGroupStatisticDTO
>
statisMap
=
bookGroupClassifyDao
.
getClassifyCountAbout
(
bookGroupIds
);
Map
<
Long
,
BookGroupStatisticDTO
>
statisMap
=
bookGroupClassifyDao
.
getClassifyCountAbout
(
bookGroupIds
);
listBookGroup4Channel
.
getRecordList
().
forEach
(
e
->
{
recordList
.
forEach
(
e
->
{
ListBook4ChannelVO
listBook4ChannelVO
=
(
ListBook4ChannelVO
)
e
;
if
(!
MapUtils
.
isEmpty
(
statisMap
)
&&
statisMap
.
containsKey
(
e
.
getBookGroupId
()))
{
if
(!
MapUtils
.
isEmpty
(
statisMap
)
&&
statisMap
.
containsKey
(
listBook4ChannelVO
.
getBookGroupId
()))
{
BookGroupStatisticDTO
dto
=
statisMap
.
get
(
e
.
getBookGroupId
());
BookGroupStatisticDTO
dto
=
statisMap
.
get
(
listBook4ChannelVO
.
getBookGroupId
());
e
.
setClassifyNum
(
null
!=
dto
.
getClassifyCount
()
?
dto
.
getClassifyCount
().
longValue
()
:
0L
);
listBook4ChannelVO
.
setClassifyNum
(
null
!=
dto
.
getClassifyCount
()
?
dto
.
getClassifyCount
().
longValue
()
:
0L
);
e
.
setTotalNum
(
null
!=
dto
.
getUserNumber
()
?
dto
.
getUserNumber
().
longValue
()
:
0L
);
listBook4ChannelVO
.
setTotalNum
(
null
!=
dto
.
getUserNumber
()
?
dto
.
getUserNumber
().
longValue
()
:
0L
);
}
else
{
}
else
{
listBook4ChannelVO
.
setClassifyNum
(
0L
);
e
.
setClassifyNum
(
0L
);
listBook4ChannelVO
.
setTotalNum
(
0L
);
e
.
setTotalNum
(
0L
);
}
}
});
});
return
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
totalCount
,
recordList
);
return
listBookGroup4Channel
;
}
}
/**
/**
...
@@ -2261,21 +2267,22 @@ public class BookGroupBizImpl implements BookGroupBiz {
...
@@ -2261,21 +2267,22 @@ public class BookGroupBizImpl implements BookGroupBiz {
@Override
@Override
public
Map
<
Long
,
StoreFlowInfoDto
>
getBookGroupInfoByChannelId
(
Long
channelId
,
Integer
itemNum
)
{
public
Map
<
Long
,
StoreFlowInfoDto
>
getBookGroupInfoByChannelId
(
Long
channelId
,
Integer
itemNum
)
{
Map
<
Long
,
StoreFlowInfoDto
>
result
=
new
HashMap
<>();
Map
<
Long
,
StoreFlowInfoDto
>
result
=
new
HashMap
<>();
PageParam
pageParam
=
new
PageParam
(
0
,
itemNum
);
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"channelId"
,
channelId
);
paramMap
.
put
(
"channelId"
,
channelId
);
PageBean
listBookGroup4Channel
=
bookDao
.
listPage
(
pageParam
,
paramMap
,
"listBookGroup4Channel"
);
paramMap
.
put
(
"offset"
,
0
);
List
<
Long
>
bookGroupIds
=
new
ArrayList
<>();
paramMap
.
put
(
"limit"
,
itemNum
);
listBookGroup4Channel
.
getRecordList
().
forEach
(
e
->
{
ListBook4ChannelVO
listBook4ChannelVO
=
(
ListBook4ChannelVO
)
e
;
Integer
totalCount
=
bookMapper
.
countBookGroup4Channel
(
paramMap
);
bookGroupIds
.
add
(
listBook4ChannelVO
.
getBookGroupId
());
if
(
totalCount
<
1
)
{
});
return
new
HashMap
<>();
}
List
<
ListBook4ChannelVO
>
recordList
=
bookMapper
.
listBookGroup4Channel
(
paramMap
);
List
<
Long
>
bookGroupIds
=
recordList
.
stream
().
filter
(
x
->
ObjectUtil
.
isAllNotEmpty
(
x
,
x
.
getBookGroupId
())).
map
(
ListBook4ChannelVO:
:
getBookGroupId
).
distinct
().
collect
(
Collectors
.
toList
());
if
(
ListUtils
.
isEmpty
(
bookGroupIds
))
{
if
(
ListUtils
.
isEmpty
(
bookGroupIds
))
{
return
new
HashMap
<>();
return
new
HashMap
<>();
}
}
Map
<
Long
,
BookGroupStatisticDTO
>
statisMap
=
bookGroupClassifyBiz
.
getBookGroupStatistic
(
bookGroupIds
);
Map
<
Long
,
BookGroupStatisticDTO
>
statisMap
=
bookGroupClassifyBiz
.
getBookGroupStatistic
(
bookGroupIds
);
listBookGroup4Channel
.
getRecordList
().
forEach
(
e
->
{
recordList
.
forEach
(
listBook4ChannelVO
->
{
ListBook4ChannelVO
listBook4ChannelVO
=
(
ListBook4ChannelVO
)
e
;
StoreFlowInfoDto
storeFlowInfoDto
=
new
StoreFlowInfoDto
();
StoreFlowInfoDto
storeFlowInfoDto
=
new
StoreFlowInfoDto
();
storeFlowInfoDto
.
setOriginId
(
listBook4ChannelVO
.
getBookGroupId
());
storeFlowInfoDto
.
setOriginId
(
listBook4ChannelVO
.
getBookGroupId
());
storeFlowInfoDto
.
setOriginType
(
StoreCons
.
OriginTypeEnum
.
BOOK_GROUP
.
getCode
());
storeFlowInfoDto
.
setOriginType
(
StoreCons
.
OriginTypeEnum
.
BOOK_GROUP
.
getCode
());
...
@@ -2302,13 +2309,20 @@ public class BookGroupBizImpl implements BookGroupBiz {
...
@@ -2302,13 +2309,20 @@ public class BookGroupBizImpl implements BookGroupBiz {
PageParam
pageParam
=
new
PageParam
(
currentPage
,
numPerPage
);
PageParam
pageParam
=
new
PageParam
(
currentPage
,
numPerPage
);
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"channelId"
,
channelId
);
paramMap
.
put
(
"channelId"
,
channelId
);
PageBeanNew
<
ListBook4ChannelVO
>
resultInfos
=
bookDao
.
listPageNew
(
pageParam
,
paramMap
,
"listBookGroup4Channel"
);
paramMap
.
put
(
"offset"
,
currentPage
*
numPerPage
);
List
<
Long
>
bookGroupIds
=
resultInfos
.
getRecordList
().
stream
().
map
(
ListBook4ChannelVO:
:
getBookGroupId
).
collect
(
Collectors
.
toList
());
paramMap
.
put
(
"limit"
,
numPerPage
);
Integer
totalCount
=
bookMapper
.
countBookGroup4Channel
(
paramMap
);
if
(
totalCount
<
1
)
{
return
new
PageBeanNew
(
currentPage
,
numPerPage
,
new
ArrayList
<>());
}
List
<
ListBook4ChannelVO
>
recordList
=
bookMapper
.
listBookGroup4Channel
(
paramMap
);
List
<
Long
>
bookGroupIds
=
recordList
.
stream
().
map
(
ListBook4ChannelVO:
:
getBookGroupId
).
collect
(
Collectors
.
toList
());
if
(
ListUtils
.
isEmpty
(
bookGroupIds
))
{
if
(
ListUtils
.
isEmpty
(
bookGroupIds
))
{
return
new
PageBeanNew
(
currentPage
,
numPerPage
,
0
,
new
ArrayList
<>());
return
new
PageBeanNew
(
currentPage
,
numPerPage
,
0
,
new
ArrayList
<>());
}
}
Map
<
Long
,
BookGroupStatisticDTO
>
statisMap
=
bookGroupClassifyBiz
.
getBookGroupStatistic
(
bookGroupIds
);
Map
<
Long
,
BookGroupStatisticDTO
>
statisMap
=
bookGroupClassifyBiz
.
getBookGroupStatistic
(
bookGroupIds
);
for
(
ListBook4ChannelVO
listBook4ChannelVO
:
re
sultInfos
.
getRecordList
()
)
{
for
(
ListBook4ChannelVO
listBook4ChannelVO
:
re
cordList
)
{
StoreFlowInfoDto
storeFlowInfoDto
=
new
StoreFlowInfoDto
();
StoreFlowInfoDto
storeFlowInfoDto
=
new
StoreFlowInfoDto
();
storeFlowInfoDto
.
setOriginId
(
listBook4ChannelVO
.
getBookGroupId
());
storeFlowInfoDto
.
setOriginId
(
listBook4ChannelVO
.
getBookGroupId
());
storeFlowInfoDto
.
setOriginType
(
StoreCons
.
OriginTypeEnum
.
BOOK_GROUP
.
getCode
());
storeFlowInfoDto
.
setOriginType
(
StoreCons
.
OriginTypeEnum
.
BOOK_GROUP
.
getCode
());
...
@@ -2324,7 +2338,7 @@ public class BookGroupBizImpl implements BookGroupBiz {
...
@@ -2324,7 +2338,7 @@ public class BookGroupBizImpl implements BookGroupBiz {
}
}
results
.
add
(
storeFlowInfoDto
);
results
.
add
(
storeFlowInfoDto
);
}
}
return
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
resultInfos
.
getTotalCount
()
,
results
);
return
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
totalCount
,
results
);
}
}
@ParamLog
(
"获取用户购买或者参与过的社群书信息"
)
@ParamLog
(
"获取用户购买或者参与过的社群书信息"
)
...
...
pcloud-service-book/src/main/java/com/pcloud/book/group/facade/BookGroupFacade.java
View file @
93d8e9bf
...
@@ -18,6 +18,7 @@ import com.pcloud.book.group.vo.FriendsVO;
...
@@ -18,6 +18,7 @@ import com.pcloud.book.group.vo.FriendsVO;
import
com.pcloud.book.group.vo.GroupIncomeStaticParamVO
;
import
com.pcloud.book.group.vo.GroupIncomeStaticParamVO
;
import
com.pcloud.book.group.vo.GroupScanTrendParamVO
;
import
com.pcloud.book.group.vo.GroupScanTrendParamVO
;
import
com.pcloud.book.group.vo.GroupScanTrendVO
;
import
com.pcloud.book.group.vo.GroupScanTrendVO
;
import
com.pcloud.book.group.vo.ListBook4ChannelVO
;
import
com.pcloud.book.group.vo.ListBookGroup4ChannelParamVO
;
import
com.pcloud.book.group.vo.ListBookGroup4ChannelParamVO
;
import
com.pcloud.book.group.vo.ResourcesStatisticVO
;
import
com.pcloud.book.group.vo.ResourcesStatisticVO
;
import
com.pcloud.book.group.vo.UpdateRankTypeVO
;
import
com.pcloud.book.group.vo.UpdateRankTypeVO
;
...
@@ -181,7 +182,7 @@ public interface BookGroupFacade {
...
@@ -181,7 +182,7 @@ public interface BookGroupFacade {
@ApiImplicitParam
(
name
=
"listBookGroup4ChannelParamVO"
,
value
=
"ListBookGroup4ChannelParamVO"
,
dataType
=
"ListBookGroup4ChannelParamVO"
,
paramType
=
"body"
)
@ApiImplicitParam
(
name
=
"listBookGroup4ChannelParamVO"
,
value
=
"ListBookGroup4ChannelParamVO"
,
dataType
=
"ListBookGroup4ChannelParamVO"
,
paramType
=
"body"
)
})
})
@RequestMapping
(
value
=
"listBookGroup4Channel"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"listBookGroup4Channel"
,
method
=
RequestMethod
.
POST
)
ResponseDto
<
PageBean
>
listBookGroup4Channel
(
@RequestHeader
(
"token"
)
String
token
,
ResponseDto
<
PageBean
New
<
ListBook4ChannelVO
>
>
listBookGroup4Channel
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
ListBookGroup4ChannelParamVO
listBookGroup4ChannelParamVO
)
@RequestBody
ListBookGroup4ChannelParamVO
listBookGroup4ChannelParamVO
)
throws
BizException
,
PermissionException
;
throws
BizException
,
PermissionException
;
...
...
pcloud-service-book/src/main/java/com/pcloud/book/group/facade/impl/BookGroupFacadeImpl.java
View file @
93d8e9bf
...
@@ -33,6 +33,7 @@ import com.pcloud.book.group.vo.GroupIncomeStaticParamVO;
...
@@ -33,6 +33,7 @@ import com.pcloud.book.group.vo.GroupIncomeStaticParamVO;
import
com.pcloud.book.group.vo.GroupScanTrendParamVO
;
import
com.pcloud.book.group.vo.GroupScanTrendParamVO
;
import
com.pcloud.book.group.vo.GroupScanTrendVO
;
import
com.pcloud.book.group.vo.GroupScanTrendVO
;
import
com.pcloud.book.group.vo.GroupStatisticVO
;
import
com.pcloud.book.group.vo.GroupStatisticVO
;
import
com.pcloud.book.group.vo.ListBook4ChannelVO
;
import
com.pcloud.book.group.vo.ListBookGroup4ChannelParamVO
;
import
com.pcloud.book.group.vo.ListBookGroup4ChannelParamVO
;
import
com.pcloud.book.group.vo.ResourcesStatisticVO
;
import
com.pcloud.book.group.vo.ResourcesStatisticVO
;
import
com.pcloud.book.group.vo.TotalRescourceDataVO
;
import
com.pcloud.book.group.vo.TotalRescourceDataVO
;
...
@@ -297,10 +298,10 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
...
@@ -297,10 +298,10 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
@Override
@Override
@RequestMapping
(
value
=
"listBookGroup4Channel"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"listBookGroup4Channel"
,
method
=
RequestMethod
.
POST
)
public
ResponseDto
<
PageBean
>
listBookGroup4Channel
(
@RequestHeader
(
"token"
)
String
token
,
public
ResponseDto
<
PageBean
New
<
ListBook4ChannelVO
>
>
listBookGroup4Channel
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
ListBookGroup4ChannelParamVO
listBookGroup4ChannelParamVO
)
throws
BizException
,
PermissionException
{
@RequestBody
ListBookGroup4ChannelParamVO
listBookGroup4ChannelParamVO
)
throws
BizException
,
PermissionException
{
Long
channelId
=
(
Long
)
SessionUtil
.
getVlaue
(
token
,
SessionUtil
.
PARTY_ID
);
Long
channelId
=
(
Long
)
SessionUtil
.
getVlaue
(
token
,
SessionUtil
.
PARTY_ID
);
PageBean
pageBean
=
bookGroupBiz
.
listBookGroup4Channel
(
channelId
,
listBookGroup4ChannelParamVO
);
PageBean
New
<
ListBook4ChannelVO
>
pageBean
=
bookGroupBiz
.
listBookGroup4Channel
(
channelId
,
listBookGroup4ChannelParamVO
);
return
new
ResponseDto
<>(
pageBean
);
return
new
ResponseDto
<>(
pageBean
);
}
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/mapper/clickhouse/BookMapper.java
0 → 100644
View file @
93d8e9bf
package
com
.
pcloud
.
book
.
mapper
.
clickhouse
;
import
com.pcloud.book.group.vo.ListBook4ChannelVO
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
import
java.util.Map
;
@Mapper
@Component
public
interface
BookMapper
{
List
<
ListBook4ChannelVO
>
listBookGroup4Channel
(
Map
<
String
,
Object
>
params
);
Integer
countBookGroup4Channel
(
Map
<
String
,
Object
>
params
);
}
pcloud-service-book/src/main/resources/clickhouse/book/BookMapper.xml
0 → 100644
View file @
93d8e9bf
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.pcloud.book.mapper.clickhouse.BookMapper"
>
<select
id=
"listBookGroup4Channel"
resultType=
"com.pcloud.book.group.vo.ListBook4ChannelVO"
parameterType=
"map"
>
SELECT b.BOOK_ID bookId,
any(b.COVER_IMG) coverImg,
any(bg.id) bookGroupId,
any(b.ISBN) isbn,
any(b.BOOK_NAME) bookName,
any(concat('BK', toString(b.BOOK_ID))) bookNumber
FROM (SELECT BOOK_ID, COVER_IMG, ISBN, BOOK_NAME
FROM book
WHERE IS_DELETE = 0
AND BOOK_NAME NOT LIKE concat('%', '红榜', '%')
AND BOOK_ID IN (SELECT toInt64(BOOK_ID) FROM book_adviser WHERE IS_PRINT = 1)
AND CHAR_LENGTH(BOOK_NAME) >= 8
) b
JOIN ( SELECT id, book_id, create_time, group_qrcode_name
FROM book_group
WHERE id IN (SELECT toInt64(book_group_id) FROM book_group_classify WHERE is_delete = 0)
AND is_delete = 0
<if
test=
"channelId != null"
>
AND channel_id = ${channelId}
</if>
<if
test=
"startTime != null "
>
AND create_time
>
= #{startTime}
</if>
<if
test=
"endTime != null "
>
AND create_time
<
= #{endTime}
</if>
<if
test=
"isFundBook != null and isFundBook == 1"
>
AND book_id IN (SELECT BOOK_ID FROM book_fund WHERE END_TIME
<
now() AND START_TIME > now())
</if>
) bg ON b.BOOK_ID = bg.book_id
<if
test=
"keywords != null"
>
WHERE b.ISBN like concat('%',#{keywords},'%') OR b.BOOK_NAME like concat('%',#{keywords},'%') OR bg.group_qrcode_name like concat('%',#{keywords},'%')
</if>
GROUP BY b.BOOK_ID
ORDER BY b.BOOK_ID DESC
LIMIT ${offset}, ${limit}
</select>
<select
id=
"countBookGroup4Channel"
resultType=
"java.lang.Integer"
>
SELECT uniqExact(b.BOOK_ID)
FROM (SELECT BOOK_ID, COVER_IMG, ISBN, BOOK_NAME
FROM book
WHERE IS_DELETE = 0
AND BOOK_NAME NOT LIKE concat('%', '红榜', '%')
AND BOOK_ID IN (SELECT toInt64(BOOK_ID) FROM book_adviser WHERE IS_PRINT = 1)
AND CHAR_LENGTH(BOOK_NAME) >= 8
) b
JOIN ( SELECT id, book_id, create_time, group_qrcode_name
FROM book_group
WHERE id IN (SELECT toInt64(book_group_id) FROM book_group_classify WHERE is_delete = 0)
AND is_delete = 0
<if
test=
"channelId != null"
>
AND channel_id = ${channelId}
</if>
<if
test=
"startTime != null "
>
AND create_time
>
= #{startTime}
</if>
<if
test=
"endTime != null "
>
AND create_time
<
= #{endTime}
</if>
<if
test=
"isFundBook != null and isFundBook == 1"
>
AND book_id IN (SELECT BOOK_ID FROM book_fund WHERE END_TIME
<
now() AND START_TIME > now())
</if>
) bg ON b.BOOK_ID = bg.book_id
<if
test=
"keywords != null"
>
WHERE b.ISBN like concat('%',#{keywords},'%') OR b.BOOK_NAME like concat('%',#{keywords},'%') OR bg.group_qrcode_name like concat('%',#{keywords},'%')
</if>
</select>
</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