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
8c4bbdfb
Commit
8c4bbdfb
authored
May 26, 2020
by
裴大威
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feat-1002916' into 'master'
1001916小程序书刊分类优化 See merge request rays/pcloud-book!741
parents
d82c4b64
b90a2f76
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
1427 additions
and
10 deletions
+1427
-10
AppletUserLabelDTO.java
...n/java/com/pcloud/book/applet/dto/AppletUserLabelDTO.java
+44
-0
AppletUserLabel.java
...n/java/com/pcloud/book/applet/entity/AppletUserLabel.java
+19
-0
AppletUserLabelRelation.java
...om/pcloud/book/applet/entity/AppletUserLabelRelation.java
+23
-0
AppletBookClassifyBiz.java
...ava/com/pcloud/book/applet/biz/AppletBookClassifyBiz.java
+104
-0
AppletBookClassifyBizImpl.java
...cloud/book/applet/biz/impl/AppletBookClassifyBizImpl.java
+235
-0
AppletBookClassifyDao.java
...ava/com/pcloud/book/applet/dao/AppletBookClassifyDao.java
+50
-0
AppletBookClassifyDaoImpl.java
...cloud/book/applet/dao/impl/AppletBookClassifyDaoImpl.java
+46
-0
AppletBookClassifyDTO.java
...ava/com/pcloud/book/applet/dto/AppletBookClassifyDTO.java
+59
-0
AppletBookClassifyRelationDTO.java
...pcloud/book/applet/dto/AppletBookClassifyRelationDTO.java
+31
-0
AppletLabelDTO.java
.../main/java/com/pcloud/book/applet/dto/AppletLabelDTO.java
+30
-0
AppletBookClassify.java
...ava/com/pcloud/book/applet/entity/AppletBookClassify.java
+55
-0
AppletBookClassifyFacade.java
...m/pcloud/book/applet/facade/AppletBookClassifyFacade.java
+121
-0
AppletUserLabelMapper.java
.../com/pcloud/book/applet/mapper/AppletUserLabelMapper.java
+29
-0
AppletUserLabelRelationMapper.java
...oud/book/applet/mapper/AppletUserLabelRelationMapper.java
+27
-0
BookBiz.java
...-book/src/main/java/com/pcloud/book/book/biz/BookBiz.java
+9
-0
BookBizImpl.java
.../main/java/com/pcloud/book/book/biz/impl/BookBizImpl.java
+86
-8
BookFacade.java
...src/main/java/com/pcloud/book/book/facade/BookFacade.java
+8
-0
BookFacadeImpl.java
...java/com/pcloud/book/book/facade/impl/BookFacadeImpl.java
+11
-0
BookSearchParamVO.java
...va/com/pcloud/book/book/vo/request/BookSearchParamVO.java
+32
-0
ESBookAndAdviserBiz.java
...main/java/com/pcloud/book/es/biz/ESBookAndAdviserBiz.java
+1
-0
ESBookAndAdviserBizImpl.java
.../com/pcloud/book/es/biz/impl/ESBookAndAdviserBizImpl.java
+35
-0
ESBookAndAdviser.java
...main/java/com/pcloud/book/es/entity/ESBookAndAdviser.java
+18
-0
AppletBookClassifyDao.xml
...rc/main/resources/mapper/applet/AppletBookClassifyDao.xml
+76
-0
AppletUserLabelMapper.xml
...rc/main/resources/mapper/applet/AppletUserLabelMapper.xml
+131
-0
AppletUserLabelRelationMapper.xml
...resources/mapper/applet/AppletUserLabelRelationMapper.xml
+137
-0
Book.Mapper.xml
...rvice-book/src/main/resources/mapper/book/Book.Mapper.xml
+10
-2
No files found.
pcloud-facade-book/src/main/java/com/pcloud/book/applet/dto/AppletUserLabelDTO.java
0 → 100644
View file @
8c4bbdfb
package
com
.
pcloud
.
book
.
applet
.
dto
;
import
com.pcloud.book.applet.entity.AppletUserLabel
;
import
com.pcloud.book.applet.entity.AppletUserLabelRelation
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.util.List
;
import
javax.validation.constraints.NotNull
;
import
lombok.Data
;
import
org.springframework.beans.BeanUtils
;
/**
* @ClassName com.pcloud.book.applet.dto.AppletUserLabelDTO
* @Author 吴博
* @Description 客户端标签
* @Date 2020/5/18 9:14
* @Version 1.0
**/
@ApiModel
@Data
public
class
AppletUserLabelDTO
{
private
Long
id
;
@ApiModelProperty
(
"客户端标签名称"
)
@NotNull
(
message
=
"标签名称不能为空"
)
private
String
labelName
;
@ApiModelProperty
(
"客户端分类id"
)
@NotNull
(
message
=
"客户端分类id不能为空"
)
private
Long
appletBookClassifyId
;
@ApiModelProperty
(
"关联年级及科目标签"
)
private
List
<
AppletUserLabelRelation
>
appletUserLabelRelations
;
public
AppletUserLabel
DTOToEntity
()
{
AppletUserLabel
appletUserLabel
=
new
AppletUserLabel
();
BeanUtils
.
copyProperties
(
this
,
appletUserLabel
);
return
appletUserLabel
;
}
}
\ No newline at end of file
pcloud-facade-book/src/main/java/com/pcloud/book/applet/entity/AppletUserLabel.java
0 → 100644
View file @
8c4bbdfb
package
com
.
pcloud
.
book
.
applet
.
entity
;
import
java.util.Date
;
import
lombok.Data
;
@Data
public
class
AppletUserLabel
{
private
Long
id
;
private
String
labelName
;
private
Long
appletBookClassifyId
;
private
Date
creatTime
;
private
Date
updateTime
;
}
\ No newline at end of file
pcloud-facade-book/src/main/java/com/pcloud/book/applet/entity/AppletUserLabelRelation.java
0 → 100644
View file @
8c4bbdfb
package
com
.
pcloud
.
book
.
applet
.
entity
;
import
java.util.Date
;
import
lombok.Data
;
@Data
public
class
AppletUserLabelRelation
{
private
Long
id
;
private
Long
appletUserLabelId
;
private
Long
bookLabelId
;
private
String
bookLabelName
;
private
Integer
labelType
;
private
Date
createTime
;
private
Date
updateTime
;
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/AppletBookClassifyBiz.java
0 → 100644
View file @
8c4bbdfb
package
com
.
pcloud
.
book
.
applet
.
biz
;
import
com.pcloud.book.applet.dto.AppletBookClassifyDTO
;
import
com.pcloud.book.applet.dto.AppletBookClassifyRelationDTO
;
import
com.pcloud.book.applet.dto.AppletUserLabelDTO
;
import
com.pcloud.book.applet.entity.AppletBookClassify
;
import
com.pcloud.book.applet.entity.AppletUserLabelRelation
;
import
java.util.List
;
/**
* 小程序书刊分类
* @author:zhuyajie
* @date:2020/5/15 16:30
* * @param null
*/
public
interface
AppletBookClassifyBiz
{
/**
* 书刊分类查询
* @author:zhuyajie
* @date:2020/5/15 16:31
* * @param null
*/
List
<
AppletBookClassifyDTO
>
getAppletBookClassifyList
(
Boolean
showState
);
/**
* 根据id查询
* @author:zhuyajie
* @date:2020/5/15 16:32
* * @param null
*/
AppletBookClassifyDTO
getById
(
Long
id
);
/**
* 修改书刊分类
* @author:zhuyajie
* @date:2020/5/15 16:33
* * @param null
*/
void
update
(
AppletBookClassify
appletBookClassify
);
/**
* 平台端新增客户端标签
* @param appletUserLabelDTO
*/
void
addUserLabel
(
AppletUserLabelDTO
appletUserLabelDTO
);
/**
* 关联书刊一级分类
* @author:zhuyajie
* @date:2020/5/18 13:59
* * @param null
*/
void
addBookTempletRelation
(
List
<
Long
>
templetIdList
,
Long
bookClassifyId
);
/**
* 根据小程序书刊分类id查书刊一级分类
* @author:zhuyajie
* @date:2020/5/18
* * @param null
*/
List
<
AppletBookClassifyRelationDTO
>
getRelationBookTempletByBookClassifyId
(
Long
bookClassifyId
);
/**
* 更新客户端标签
* @param appletUserLabelDTO
*/
void
updateUserLabel
(
AppletUserLabelDTO
appletUserLabelDTO
);
/**
* 删除客户端标签
* @param id
*/
void
deleteUserLabel
(
Long
id
);
/**
* 客户端标签列表
* @param appletBookClassifyId
* @return
*/
List
<
AppletUserLabelDTO
>
listUserLabel
(
Long
appletBookClassifyId
);
/**
* 获取书刊分类列表及其标签
* @author:zhuyajie
* @date:2020/5/18 16:14
* * @param null
*/
List
<
AppletBookClassifyDTO
>
getAllBookClassifyAndLabel
(
String
grayStatus
);
/**
* 查关联书刊分类
* @author:zhuyajie
* @date:2020/5/19 18:38
* * @param null
*/
List
<
Long
>
getRelationBookTempletByBookClassify
(
Long
bookClassifyId
);
/**
* 查关联标签
* @author:zhuyajie
* @date:2020/5/19 18:38
* * @param null
*/
List
<
AppletUserLabelRelation
>
getByAppletUserLabelId
(
Long
appletUserLabelId
);
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/impl/AppletBookClassifyBizImpl.java
0 → 100644
View file @
8c4bbdfb
package
com
.
pcloud
.
book
.
applet
.
biz
.
impl
;
import
com.pcloud.appcenter.assist.dto.AssistTempletDTO
;
import
com.pcloud.book.applet.biz.AppletBookClassifyBiz
;
import
com.pcloud.book.applet.dao.AppletBookClassifyDao
;
import
com.pcloud.book.applet.dto.AppletBookClassifyDTO
;
import
com.pcloud.book.applet.dto.AppletBookClassifyRelationDTO
;
import
com.pcloud.book.applet.dto.AppletLabelDTO
;
import
com.pcloud.book.applet.dto.AppletUserLabelDTO
;
import
com.pcloud.book.applet.entity.AppletBookClassify
;
import
com.pcloud.book.applet.entity.AppletUserLabel
;
import
com.pcloud.book.applet.entity.AppletUserLabelRelation
;
import
com.pcloud.book.applet.mapper.AppletUserLabelMapper
;
import
com.pcloud.book.applet.mapper.AppletUserLabelRelationMapper
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.book.dao.BookLabelDao
;
import
com.pcloud.book.book.entity.BookLabel
;
import
com.pcloud.book.consumer.app.AssistTempletConsr
;
import
com.pcloud.book.util.common.YesOrNoEnums
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.utils.ListUtils
;
import
org.apache.commons.collections.MapUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.util.ArrayList
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
import
lombok.extern.slf4j.Slf4j
;
/**
* @ClassName com.pcloud.book.applet.biz.impl.AppletBookClassifyBizImpl
* @Author zhuyajie
* @Description 小程序书刊分类
* @Date 2020/5/15 16:29
* @Version 1.0
**/
@Slf4j
@Component
public
class
AppletBookClassifyBizImpl
implements
AppletBookClassifyBiz
{
@Autowired
private
AppletBookClassifyDao
appletBookClassifyDao
;
@Autowired
private
AppletUserLabelMapper
appletUserLabelMapper
;
@Autowired
private
AppletUserLabelRelationMapper
relationMapper
;
@Autowired
private
AssistTempletConsr
assistTempletConsr
;
@Autowired
private
BookLabelDao
bookLabelDao
;
@Override
public
List
<
AppletBookClassifyDTO
>
getAppletBookClassifyList
(
Boolean
showState
)
{
return
appletBookClassifyDao
.
queryAll
(
showState
);
}
@Override
public
AppletBookClassifyDTO
getById
(
Long
id
)
{
AppletBookClassifyDTO
bookClassifyDTO
=
new
AppletBookClassifyDTO
();
AppletBookClassify
bookClassify
=
appletBookClassifyDao
.
queryById
(
id
);
if
(
null
!=
bookClassify
)
{
BeanUtils
.
copyProperties
(
bookClassify
,
bookClassifyDTO
);
}
return
bookClassifyDTO
;
}
@Override
public
void
update
(
AppletBookClassify
appletBookClassify
)
{
if
(
null
==
appletBookClassify
||
null
==
appletBookClassify
.
getId
())
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"缺少id"
);
}
appletBookClassifyDao
.
update
(
appletBookClassify
);
}
@Override
@ParamLog
(
"平台端新增客户端标签"
)
public
void
addUserLabel
(
AppletUserLabelDTO
appletUserLabelDTO
)
{
AppletUserLabel
appletUserLabel
=
appletUserLabelDTO
.
DTOToEntity
();
appletUserLabelMapper
.
insert
(
appletUserLabel
);
List
<
AppletUserLabelRelation
>
appletUserLabelRelations
=
appletUserLabelDTO
.
getAppletUserLabelRelations
();
if
(
ListUtils
.
isEmpty
(
appletUserLabelRelations
)){
return
;
}
appletUserLabelRelations
.
forEach
(
e
->
e
.
setAppletUserLabelId
(
appletUserLabel
.
getId
()));
relationMapper
.
batchInsert
(
appletUserLabelRelations
);
}
@Override
public
void
addBookTempletRelation
(
List
<
Long
>
templetIdList
,
Long
bookClassifyId
)
{
if
(
null
==
bookClassifyId
||
ListUtils
.
isEmpty
(
templetIdList
)){
return
;
}
List
<
AppletBookClassifyRelationDTO
>
list
=
new
ArrayList
<>();
for
(
Long
templetId
:
templetIdList
){
AppletBookClassifyRelationDTO
relation
=
new
AppletBookClassifyRelationDTO
();
relation
.
setAppletBookClassifyId
(
bookClassifyId
);
relation
.
setBookTempletId
(
templetId
);
list
.
add
(
relation
);
}
appletBookClassifyDao
.
addBookClassifyRelation
(
list
);
}
@Override
public
List
<
AppletBookClassifyRelationDTO
>
getRelationBookTempletByBookClassifyId
(
Long
bookClassifyId
)
{
List
<
AppletBookClassifyRelationDTO
>
relationDTOS
=
new
ArrayList
<>();
List
<
Long
>
templetIds
=
appletBookClassifyDao
.
getRelationBookTempletByBookClassify
(
bookClassifyId
);
if
(
ListUtils
.
isEmpty
(
templetIds
))
{
return
new
ArrayList
<>();
}
Map
<
Long
,
AssistTempletDTO
>
classifyMap
=
assistTempletConsr
.
mapByIds4Classify
(
templetIds
);
for
(
Long
templetId
:
templetIds
)
{
AppletBookClassifyRelationDTO
relationDTO
=
new
AppletBookClassifyRelationDTO
();
relationDTO
.
setBookTempletId
(
templetId
);
relationDTO
.
setAppletBookClassifyId
(
bookClassifyId
);
if
(!
MapUtils
.
isEmpty
(
classifyMap
)
&&
classifyMap
.
containsKey
(
templetId
))
{
relationDTO
.
setBookTempletName
(
classifyMap
.
get
(
templetId
).
getTempletName
());
}
relationDTOS
.
add
(
relationDTO
);
}
return
relationDTOS
;
}
@Override
@ParamLog
(
"更新客户端标签"
)
public
void
updateUserLabel
(
AppletUserLabelDTO
appletUserLabelDTO
)
{
if
(
null
==
appletUserLabelDTO
||
null
==
appletUserLabelDTO
.
getId
()){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"appletUserLabelId为空更新失败"
);
}
AppletUserLabel
appletUserLabel
=
appletUserLabelDTO
.
DTOToEntity
();
appletUserLabelMapper
.
updateByPrimaryKey
(
appletUserLabel
);
relationMapper
.
deleteByUserLabelId
(
appletUserLabelDTO
.
getId
());
List
<
AppletUserLabelRelation
>
appletUserLabelRelations
=
appletUserLabelDTO
.
getAppletUserLabelRelations
();
if
(
ListUtils
.
isEmpty
(
appletUserLabelRelations
)){
return
;
}
appletUserLabelRelations
.
forEach
(
e
->
e
.
setAppletUserLabelId
(
appletUserLabel
.
getId
()));
relationMapper
.
batchInsert
(
appletUserLabelRelations
);
}
@Override
@ParamLog
(
"删除客户端标签"
)
public
void
deleteUserLabel
(
Long
id
)
{
appletUserLabelMapper
.
deleteByPrimaryKey
(
id
);
relationMapper
.
deleteByUserLabelId
(
id
);
}
@Override
@ParamLog
(
"客户端标签列表"
)
public
List
<
AppletUserLabelDTO
>
listUserLabel
(
Long
appletBookClassifyId
)
{
List
<
AppletUserLabelDTO
>
appletUserLabelDTOS
=
appletUserLabelMapper
.
listUserLabel
(
appletBookClassifyId
);
if
(
ListUtils
.
isEmpty
(
appletUserLabelDTOS
))
{
return
new
ArrayList
<>();
}
List
<
AppletUserLabelRelation
>
appletUserLabelRelations
=
new
ArrayList
<>();
Set
<
Long
>
LabelIds
=
new
HashSet
<>();
appletUserLabelDTOS
.
forEach
(
e
->
{
if
(!
ListUtils
.
isEmpty
(
e
.
getAppletUserLabelRelations
()))
{
appletUserLabelRelations
.
addAll
(
e
.
getAppletUserLabelRelations
());
}
});
if
(
ListUtils
.
isEmpty
(
appletUserLabelRelations
))
{
return
appletUserLabelDTOS
;
}
LabelIds
=
appletUserLabelRelations
.
stream
().
map
(
e
->
e
.
getBookLabelId
()).
collect
(
Collectors
.
toSet
());
//填充标签名称
fillLabelName
(
appletUserLabelDTOS
,
LabelIds
);
return
appletUserLabelDTOS
;
}
private
void
fillLabelName
(
List
<
AppletUserLabelDTO
>
appletUserLabelDTOS
,
Set
<
Long
>
labelIds
)
{
log
.
info
(
"填充标签名称"
);
Map
<
Long
,
BookLabel
>
bookLabelMap
=
bookLabelDao
.
getMapByIds
(
new
ArrayList
<>(
labelIds
));
appletUserLabelDTOS
.
forEach
(
e
->
{
if
(
ListUtils
.
isEmpty
(
e
.
getAppletUserLabelRelations
()))
{
return
;
}
e
.
getAppletUserLabelRelations
().
forEach
(
m
->
{
if
(!
bookLabelMap
.
containsKey
(
m
.
getBookLabelId
()))
{
return
;
}
m
.
setBookLabelName
(
bookLabelMap
.
get
(
m
.
getBookLabelId
()).
getName
());
});
});
}
@Override
public
List
<
AppletBookClassifyDTO
>
getAllBookClassifyAndLabel
(
String
grayStatus
)
{
List
<
AppletBookClassifyDTO
>
classifyAndLabelDTOS
=
appletBookClassifyDao
.
queryAll
(
true
);
if
(
ListUtils
.
isEmpty
(
classifyAndLabelDTOS
))
{
return
new
ArrayList
<>();
}
//过滤测试分类
if
(
YesOrNoEnums
.
YES
.
getCode
().
equals
(
grayStatus
))
{
for
(
int
i
=
0
;
i
<
classifyAndLabelDTOS
.
size
();
i
++)
{
if
(
"质检测试"
.
equals
(
classifyAndLabelDTOS
.
get
(
i
).
getClassify
())){
classifyAndLabelDTOS
.
remove
(
i
);
}
}
}
List
<
AppletLabelDTO
>
userLabelDTOS
=
appletUserLabelMapper
.
getBookClassifyAndLabel
();
if
(
ListUtils
.
isEmpty
(
userLabelDTOS
))
{
return
classifyAndLabelDTOS
;
}
Map
<
Long
,
List
<
AppletLabelDTO
>>
map
=
userLabelDTOS
.
stream
().
collect
(
Collectors
.
groupingBy
(
AppletLabelDTO:
:
getAppletBookClassifyId
));
for
(
AppletBookClassifyDTO
classifyDTO
:
classifyAndLabelDTOS
)
{
if
(!
MapUtils
.
isEmpty
(
map
)
&&
map
.
containsKey
(
classifyDTO
.
getId
()))
{
List
<
AppletLabelDTO
>
list
=
map
.
get
(
classifyDTO
.
getId
());
classifyDTO
.
setUserLabelDTOS
(
list
);
}
}
return
classifyAndLabelDTOS
;
}
@Override
public
List
<
Long
>
getRelationBookTempletByBookClassify
(
Long
bookClassifyId
)
{
return
appletBookClassifyDao
.
getRelationBookTempletByBookClassify
(
bookClassifyId
);
}
@Override
public
List
<
AppletUserLabelRelation
>
getByAppletUserLabelId
(
Long
appletUserLabelId
)
{
return
relationMapper
.
getByAppletUserLabelId
(
appletUserLabelId
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/dao/AppletBookClassifyDao.java
0 → 100644
View file @
8c4bbdfb
package
com
.
pcloud
.
book
.
applet
.
dao
;
import
com.pcloud.book.applet.dto.AppletBookClassifyDTO
;
import
com.pcloud.book.applet.dto.AppletBookClassifyRelationDTO
;
import
com.pcloud.book.applet.entity.AppletBookClassify
;
import
com.pcloud.common.core.dao.BaseDao
;
import
java.util.List
;
/**
* 小程序客户端书刊分类(AppletBookClassify)表数据库访问层
*
* @author makejava
* @since 2020-05-15 16:10:59
*/
public
interface
AppletBookClassifyDao
extends
BaseDao
<
AppletBookClassify
>{
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
AppletBookClassify
queryById
(
Long
id
);
/**
* 条件查询
*
* @return 对象列表
*/
List
<
AppletBookClassifyDTO
>
queryAll
(
Boolean
showState
);
/**
* 关联书刊一级分类
* @author:zhuyajie
* @date:2020/5/18 14:18
* * @param null
*/
void
addBookClassifyRelation
(
List
<
AppletBookClassifyRelationDTO
>
bookClassifyRelations
);
/**
* 查关联书刊分类
* @author:zhuyajie
* @date:2020/5/18 15:43
* * @param null
*/
List
<
Long
>
getRelationBookTempletByBookClassify
(
Long
bookClassifyId
);
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/applet/dao/impl/AppletBookClassifyDaoImpl.java
0 → 100644
View file @
8c4bbdfb
package
com
.
pcloud
.
book
.
applet
.
dao
.
impl
;
import
com.pcloud.book.applet.dao.AppletBookClassifyDao
;
import
com.pcloud.book.applet.dto.AppletBookClassifyDTO
;
import
com.pcloud.book.applet.entity.AppletBookClassify
;
import
com.pcloud.book.applet.dto.AppletBookClassifyRelationDTO
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Component
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* @ClassName com.pcloud.book.applet.dao.impl.AppletBookClassifyDaoImpl
* @Author zhuyajie
* @Description 小程序书刊分类
* @Date 2020/5/15 16:23
* @Version 1.0
**/
@Component
public
class
AppletBookClassifyDaoImpl
extends
BaseDaoImpl
<
AppletBookClassify
>
implements
AppletBookClassifyDao
{
@Override
public
AppletBookClassify
queryById
(
Long
id
)
{
return
getSessionTemplate
().
selectOne
(
getStatement
(
"queryById"
),
id
);
}
@Override
public
List
<
AppletBookClassifyDTO
>
queryAll
(
Boolean
showState
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"showState"
,
showState
);
return
getSessionTemplate
().
selectList
(
getStatement
(
"queryAll"
),
map
);
}
@Override
public
void
addBookClassifyRelation
(
List
<
AppletBookClassifyRelationDTO
>
bookClassifyRelations
)
{
getSessionTemplate
().
insert
(
getStatement
(
"addBookClassifyRelation"
),
bookClassifyRelations
);
}
@Override
public
List
<
Long
>
getRelationBookTempletByBookClassify
(
Long
bookClassifyId
)
{
return
getSessionTemplate
().
selectList
(
getStatement
(
"getRelationBookTempletByBookClassify"
),
bookClassifyId
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/dto/AppletBookClassifyDTO.java
0 → 100644
View file @
8c4bbdfb
package
com
.
pcloud
.
book
.
applet
.
dto
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.pcloud.common.dto.BaseDto
;
import
java.util.Date
;
import
java.util.List
;
import
lombok.Data
;
/**
* @ClassName com.pcloud.book.applet.dto.AppletBookClassifyDTO
* @Author zhuyajie
* @Description 小程序书刊分类
* @Date 2020/5/15 16:17
* @Version 1.0
**/
@Data
public
class
AppletBookClassifyDTO
extends
BaseDto
{
/**
* 分类id
*/
private
Long
id
;
/**
* 分类
*/
private
String
classify
;
/**
* 分类名称
*/
private
String
classifyName
;
/**
* 排序值
*/
private
Integer
seq
;
/**
* 图标
*/
private
String
pic
;
/**
* 客户端是否展示
*/
private
Boolean
showState
;
/**
* 创建时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
createTime
;
/**
* 修改时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
updateTime
;
/**
* 客户端标签
*/
private
List
<
AppletLabelDTO
>
userLabelDTOS
;
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/dto/AppletBookClassifyRelationDTO.java
0 → 100644
View file @
8c4bbdfb
package
com
.
pcloud
.
book
.
applet
.
dto
;
import
lombok.Data
;
/**
* 小程序书刊分类与书刊一级分类关联(AppletBookClassifyRelationDTO)实体类
*
* @author makejava
* @since 2020-05-18 10:50:51
*/
@Data
public
class
AppletBookClassifyRelationDTO
{
private
static
final
long
serialVersionUID
=
332833766395787980L
;
/**
* 小程序书刊分类id
*/
private
Long
appletBookClassifyId
;
/**
* 书刊一级分类id
*/
private
Long
bookTempletId
;
/**
* 书刊一级分类
*/
private
String
bookTempletName
;
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/applet/dto/AppletLabelDTO.java
0 → 100644
View file @
8c4bbdfb
package
com
.
pcloud
.
book
.
applet
.
dto
;
import
com.pcloud.common.dto.BaseDto
;
import
lombok.Data
;
/**
* @ClassName com.pcloud.book.applet.dto.AppletUserLabelDTO
* @Author zhuyajie
* @Description 客户端标签
* @Date 2020/5/18 16:06
* @Version 1.0
**/
@Data
public
class
AppletLabelDTO
extends
BaseDto
{
/**
* 小程序客户端标签id
*/
private
Long
appletUserLabelId
;
/**
* 小程序客户端标签名称
*/
private
String
labelName
;
/**
* 小程序书刊分类id
*/
private
Long
appletBookClassifyId
;
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/entity/AppletBookClassify.java
0 → 100644
View file @
8c4bbdfb
package
com
.
pcloud
.
book
.
applet
.
entity
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.pcloud.common.entity.BaseEntity
;
import
java.util.Date
;
import
java.io.Serializable
;
import
lombok.Data
;
/**
* 小程序客户端书刊分类(AppletBookClassify)实体类
*
* @author makejava
* @since 2020-05-15 16:10:59
*/
@Data
public
class
AppletBookClassify
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
337057609923325418L
;
/**
* 分类
*/
private
String
classify
;
/**
* 分类名称
*/
private
String
classifyName
;
/**
* 排序值
*/
private
Integer
seq
;
/**
* 图标
*/
private
String
pic
;
/**
* 客户端是否展示
*/
private
Boolean
showState
;
/**
* 创建时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
createTime
;
/**
* 修改时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
updateTime
;
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/applet/facade/AppletBookClassifyFacade.java
0 → 100644
View file @
8c4bbdfb
package
com
.
pcloud
.
book
.
applet
.
facade
;
import
com.pcloud.book.applet.biz.AppletBookClassifyBiz
;
import
com.pcloud.book.applet.dto.AppletBookClassifyDTO
;
import
com.pcloud.book.applet.dto.AppletBookClassifyRelationDTO
;
import
com.pcloud.book.applet.dto.AppletUserLabelDTO
;
import
com.pcloud.book.applet.entity.AppletBookClassify
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.utils.SessionUtil
;
import
io.swagger.annotations.ApiParam
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestHeader
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
/**
* @ClassName com.pcloud.book.applet.facade.AppletBookClassifyFacade
* @Author zhuyajie
* @Description 小程序书刊分类
* @Date 2020/5/15 16:27
* @Version 1.0
**/
@Api
(
description
=
"小程序书刊分类"
)
@RestController
(
"appletBookClassifyFacade"
)
@RequestMapping
(
"appletBookClassify"
)
public
class
AppletBookClassifyFacade
{
@Autowired
private
AppletBookClassifyBiz
appletBookClassifyBiz
;
@ApiOperation
(
"书刊分类查询"
)
@GetMapping
(
"getAppletBookClassifyList"
)
public
ResponseDto
<
List
<
AppletBookClassifyDTO
>>
getAppletBookClassifyList
(
@RequestParam
(
value
=
"showState"
,
required
=
false
)
Boolean
showState
)
{
return
new
ResponseDto
<>(
appletBookClassifyBiz
.
getAppletBookClassifyList
(
showState
));
}
@ApiOperation
(
"根据id查询"
)
@GetMapping
(
"getById"
)
public
ResponseDto
<
AppletBookClassifyDTO
>
getById
(
@RequestParam
(
"id"
)
Long
id
)
{
return
new
ResponseDto
<>(
appletBookClassifyBiz
.
getById
(
id
));
}
@ApiOperation
(
"修改书刊分类基本信息"
)
@PostMapping
(
"updateBaseInfo"
)
public
ResponseDto
<?>
updateBaseInfo
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
AppletBookClassify
appletBookClassify
)
{
SessionUtil
.
getToken4Redis
(
token
);
appletBookClassifyBiz
.
update
(
appletBookClassify
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
"平台端新增客户端标签"
)
@PostMapping
(
"addUserLabel"
)
public
ResponseDto
<?>
addUserLabel
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
@ApiParam
(
"客户端的标签"
)
@Validated
AppletUserLabelDTO
appletUserLabelDTO
)
{
SessionUtil
.
getToken4Redis
(
token
);
appletBookClassifyBiz
.
addUserLabel
(
appletUserLabelDTO
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
"关联书刊一级分类"
)
@PostMapping
(
"addBookTempletRelation"
)
public
ResponseDto
<?>
addBookTempletRelation
(
@RequestBody
List
<
Long
>
templetIdList
,
@RequestParam
(
"bookClassifyId"
)
Long
bookClassifyId
){
appletBookClassifyBiz
.
addBookTempletRelation
(
templetIdList
,
bookClassifyId
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
"根据小程序书刊分类id查书刊一级分类"
)
@GetMapping
(
"getRelationBookTempletByBookClassifyId"
)
public
ResponseDto
<
List
<
AppletBookClassifyRelationDTO
>>
getRelationBookTempletByBookClassifyId
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
"bookClassifyId"
)
@ApiParam
(
"小程序书刊分类id"
)
Long
bookClassifyId
){
SessionUtil
.
getToken4Redis
(
token
);
return
new
ResponseDto
<>(
appletBookClassifyBiz
.
getRelationBookTempletByBookClassifyId
(
bookClassifyId
));
}
@ApiOperation
(
"平台端修改客户端标签"
)
@PostMapping
(
"updateUserLabel"
)
public
ResponseDto
<?>
updateUserLabel
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
@ApiParam
(
"客户端的标签"
)
@Validated
AppletUserLabelDTO
appletUserLabelDTO
)
{
SessionUtil
.
getToken4Redis
(
token
);
appletBookClassifyBiz
.
updateUserLabel
(
appletUserLabelDTO
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
"平台端删除客户端标签"
)
@GetMapping
(
"deleteUserLabel"
)
public
ResponseDto
<?>
deleteUserLabel
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
"id"
)
Long
id
)
{
SessionUtil
.
getToken4Redis
(
token
);
appletBookClassifyBiz
.
deleteUserLabel
(
id
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
"平台端客户端标签列表"
)
@GetMapping
(
"listUserLabel"
)
public
ResponseDto
<
List
<
AppletUserLabelDTO
>>
listUserLabel
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
"appletBookClassifyId"
)
Long
appletBookClassifyId
)
{
SessionUtil
.
getToken4Redis
(
token
);
List
<
AppletUserLabelDTO
>
appletUserLabelDTOS
=
appletBookClassifyBiz
.
listUserLabel
(
appletBookClassifyId
);
return
new
ResponseDto
<>(
appletUserLabelDTOS
);
}
@ApiOperation
(
"获取书刊分类列表及其标签"
)
@GetMapping
(
"getAllBookClassifyAndLabel4Wechat"
)
public
ResponseDto
<
List
<
AppletBookClassifyDTO
>>
getAllBookClassifyAndLabel4Wechat
(
@RequestParam
(
value
=
"grayStatus"
,
required
=
false
)
String
grayStatus
){
return
new
ResponseDto
<>(
appletBookClassifyBiz
.
getAllBookClassifyAndLabel
(
grayStatus
));
}
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/mapper/AppletUserLabelMapper.java
0 → 100644
View file @
8c4bbdfb
package
com
.
pcloud
.
book
.
applet
.
mapper
;
import
com.pcloud.book.applet.dto.AppletLabelDTO
;
import
com.pcloud.book.applet.dto.AppletUserLabelDTO
;
import
com.pcloud.book.applet.entity.AppletUserLabel
;
import
java.util.List
;
import
org.apache.ibatis.annotations.Mapper
;
import
java.util.List
;
@Mapper
public
interface
AppletUserLabelMapper
{
int
deleteByPrimaryKey
(
Long
id
);
int
insert
(
AppletUserLabel
record
);
int
insertSelective
(
AppletUserLabel
record
);
AppletUserLabel
selectByPrimaryKey
(
Long
id
);
int
updateByPrimaryKeySelective
(
AppletUserLabel
record
);
int
updateByPrimaryKey
(
AppletUserLabel
record
);
List
<
AppletLabelDTO
>
getBookClassifyAndLabel
();
List
<
AppletUserLabelDTO
>
listUserLabel
(
Long
appletBookClassifyId
);
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/applet/mapper/AppletUserLabelRelationMapper.java
0 → 100644
View file @
8c4bbdfb
package
com
.
pcloud
.
book
.
applet
.
mapper
;
import
com.pcloud.book.applet.entity.AppletUserLabelRelation
;
import
java.util.List
;
import
org.apache.ibatis.annotations.Mapper
;
@Mapper
public
interface
AppletUserLabelRelationMapper
{
int
deleteByPrimaryKey
(
Long
id
);
int
insert
(
AppletUserLabelRelation
record
);
int
insertSelective
(
AppletUserLabelRelation
record
);
AppletUserLabelRelation
selectByPrimaryKey
(
Long
id
);
int
updateByPrimaryKeySelective
(
AppletUserLabelRelation
record
);
int
updateByPrimaryKey
(
AppletUserLabelRelation
record
);
void
batchInsert
(
List
<
AppletUserLabelRelation
>
appletUserLabelRelations
);
void
deleteByUserLabelId
(
Long
UserLabelId
);
List
<
AppletUserLabelRelation
>
getByAppletUserLabelId
(
Long
appletUserLabelId
);
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/book/biz/BookBiz.java
View file @
8c4bbdfb
...
@@ -19,6 +19,7 @@ import com.pcloud.book.book.vo.ListNoAuthBookParam;
...
@@ -19,6 +19,7 @@ import com.pcloud.book.book.vo.ListNoAuthBookParam;
import
com.pcloud.book.book.vo.ListNoAuthGroupBookParam
;
import
com.pcloud.book.book.vo.ListNoAuthGroupBookParam
;
import
com.pcloud.book.book.vo.SearchBookVO
;
import
com.pcloud.book.book.vo.SearchBookVO
;
import
com.pcloud.book.book.vo.request.BookQualifyInfoVO
;
import
com.pcloud.book.book.vo.request.BookQualifyInfoVO
;
import
com.pcloud.book.book.vo.request.BookSearchParamVO
;
import
com.pcloud.book.book.vo.request.UpdateBookRobotProcessDto
;
import
com.pcloud.book.book.vo.request.UpdateBookRobotProcessDto
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.page.PageBean
;
import
com.pcloud.common.page.PageBean
;
...
@@ -654,4 +655,12 @@ public interface BookBiz {
...
@@ -654,4 +655,12 @@ public interface BookBiz {
void
updateIsOpenRobotProcess4Now
(
Long
adviserId
,
UpdateBookRobotProcessDto
robotProcessDto
);
void
updateIsOpenRobotProcess4Now
(
Long
adviserId
,
UpdateBookRobotProcessDto
robotProcessDto
);
PageBeanNew
<
BookDto
>
getAdviserBooks4Rights
(
String
keyword
,
Long
agentId
,
Long
templetId
,
Long
secondTempletId
,
String
typeCode
,
Integer
currentPage
,
Integer
numPerPage
);
PageBeanNew
<
BookDto
>
getAdviserBooks4Rights
(
String
keyword
,
Long
agentId
,
Long
templetId
,
Long
secondTempletId
,
String
typeCode
,
Integer
currentPage
,
Integer
numPerPage
);
/**
* 小程序首页书刊搜索
* @author:zhuyajie
* @date:2020/5/19 18:26
* * @param null
*/
PageBeanNew
<
BookDto
>
getAdviserBooks4Applet
(
BookSearchParamVO
bookSearchParamVO
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/book/biz/impl/BookBizImpl.java
View file @
8c4bbdfb
...
@@ -3,24 +3,45 @@
...
@@ -3,24 +3,45 @@
*/
*/
package
com
.
pcloud
.
book
.
book
.
biz
.
impl
;
package
com
.
pcloud
.
book
.
book
.
biz
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Maps
;
import
com.google.common.collect.Maps
;
import
com.alibaba.fastjson.JSONObject
;
import
com.pcloud.analysisengine.qrcode.dto.BookTimeSourceDto
;
import
com.pcloud.analysisengine.qrcode.dto.BookTimeSourceDto
;
import
com.pcloud.appcenter.assist.dto.AssistTempletDTO
;
import
com.pcloud.appcenter.assist.dto.AssistTempletDTO
;
import
com.pcloud.appcenter.base.exception.AppBizException
;
import
com.pcloud.appcenter.base.exception.AppBizException
;
import
com.pcloud.book.applet.biz.AppletBookClassifyBiz
;
import
com.pcloud.book.applet.entity.AppletUserLabelRelation
;
import
com.pcloud.book.base.enums.BookFreezeEnum
;
import
com.pcloud.book.base.enums.BookFreezeEnum
;
import
com.pcloud.book.base.enums.BookStatusEnum
;
import
com.pcloud.book.base.enums.BookStatusEnum
;
import
com.pcloud.book.base.enums.BookTypeEnum
;
import
com.pcloud.book.base.enums.BookTypeEnum
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.book.biz.*
;
import
com.pcloud.book.book.biz.BookAdviserBiz
;
import
com.pcloud.book.book.biz.BookAppBiz
;
import
com.pcloud.book.book.biz.BookBiz
;
import
com.pcloud.book.book.biz.BookFreezeBiz
;
import
com.pcloud.book.book.biz.BookFundBiz
;
import
com.pcloud.book.book.biz.BookProductBiz
;
import
com.pcloud.book.book.biz.BookResourceBiz
;
import
com.pcloud.book.book.cache.BookCache
;
import
com.pcloud.book.book.cache.BookCache
;
import
com.pcloud.book.book.constant.BookConstant
;
import
com.pcloud.book.book.constant.BookConstant
;
import
com.pcloud.book.book.dao.BookAdviserDao
;
import
com.pcloud.book.book.dao.BookAdviserDao
;
import
com.pcloud.book.book.dao.BookDao
;
import
com.pcloud.book.book.dao.BookDao
;
import
com.pcloud.book.book.dao.BookLabelDao
;
import
com.pcloud.book.book.dao.BookLabelDao
;
import
com.pcloud.book.book.dao.BookRaysClassifyDao
;
import
com.pcloud.book.book.dao.BookRaysClassifyDao
;
import
com.pcloud.book.book.dto.*
;
import
com.pcloud.book.book.dto.AdviserBookInfoDTO
;
import
com.pcloud.book.book.dto.BookAdviserDto
;
import
com.pcloud.book.book.dto.BookAdviserUpdateTimeDTO
;
import
com.pcloud.book.book.dto.BookAssocCount
;
import
com.pcloud.book.book.dto.BookCoverImgUpdateDTO
;
import
com.pcloud.book.book.dto.BookDetialDTO
;
import
com.pcloud.book.book.dto.BookDto
;
import
com.pcloud.book.book.dto.BookFreezeDto
;
import
com.pcloud.book.book.dto.BookFundDto
;
import
com.pcloud.book.book.dto.BookInfo4AnlysicsDTO
;
import
com.pcloud.book.book.dto.BookInfoAnalysicsDTO
;
import
com.pcloud.book.book.dto.BookInfoAndAuthStatusDTO
;
import
com.pcloud.book.book.dto.BookNameUpdateDTO
;
import
com.pcloud.book.book.entity.Book
;
import
com.pcloud.book.book.entity.Book
;
import
com.pcloud.book.book.entity.BookAdviser
;
import
com.pcloud.book.book.entity.BookAdviser
;
import
com.pcloud.book.book.entity.BookLabel
;
import
com.pcloud.book.book.entity.BookLabel
;
...
@@ -32,6 +53,7 @@ import com.pcloud.book.book.vo.ListNoAuthBookParam;
...
@@ -32,6 +53,7 @@ import com.pcloud.book.book.vo.ListNoAuthBookParam;
import
com.pcloud.book.book.vo.ListNoAuthGroupBookParam
;
import
com.pcloud.book.book.vo.ListNoAuthGroupBookParam
;
import
com.pcloud.book.book.vo.SearchBookVO
;
import
com.pcloud.book.book.vo.SearchBookVO
;
import
com.pcloud.book.book.vo.request.BookQualifyInfoVO
;
import
com.pcloud.book.book.vo.request.BookQualifyInfoVO
;
import
com.pcloud.book.book.vo.request.BookSearchParamVO
;
import
com.pcloud.book.book.vo.request.UpdateBookRobotProcessDto
;
import
com.pcloud.book.book.vo.request.UpdateBookRobotProcessDto
;
import
com.pcloud.book.consumer.analysisengine.SceneRecordConsr
;
import
com.pcloud.book.consumer.analysisengine.SceneRecordConsr
;
import
com.pcloud.book.consumer.app.AssistTempletConsr
;
import
com.pcloud.book.consumer.app.AssistTempletConsr
;
...
@@ -74,6 +96,7 @@ import com.pcloud.common.utils.cache.redis.JedisClusterUtils;
...
@@ -74,6 +96,7 @@ import com.pcloud.common.utils.cache.redis.JedisClusterUtils;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.commoncenter.export.service.ExportService
;
import
com.pcloud.commoncenter.export.service.ExportService
;
import
com.pcloud.usercenter.party.adviser.dto.AdviserBaseInfoDto
;
import
com.pcloud.usercenter.party.adviser.dto.AdviserBaseInfoDto
;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
...
@@ -86,7 +109,16 @@ import org.springframework.transaction.annotation.Transactional;
...
@@ -86,7 +109,16 @@ import org.springframework.transaction.annotation.Transactional;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.*
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.Optional
;
import
java.util.Random
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.Executors
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -175,6 +207,14 @@ public class BookBizImpl implements BookBiz {
...
@@ -175,6 +207,14 @@ public class BookBizImpl implements BookBiz {
private
RightsSettingBookRelationMapper
rightsSettingBookRelationMapper
;
private
RightsSettingBookRelationMapper
rightsSettingBookRelationMapper
;
@Autowired
private
AppletBookClassifyBiz
appletBookClassifyBiz
;
/**
/**
* 创建书籍,同时建立与编辑的推广关系
* 创建书籍,同时建立与编辑的推广关系
*/
*/
...
@@ -2030,6 +2070,10 @@ public class BookBizImpl implements BookBiz {
...
@@ -2030,6 +2070,10 @@ public class BookBizImpl implements BookBiz {
bookDto
.
setIsbn
(
esBookAndAdviser
.
getIsbn
());
bookDto
.
setIsbn
(
esBookAndAdviser
.
getIsbn
());
bookDto
.
setBookName
(
esBookAndAdviser
.
getBookName
());
bookDto
.
setBookName
(
esBookAndAdviser
.
getBookName
());
bookDto
.
setLastModifiedDate
(
esBookAndAdviser
.
getLastModifiedDate
());
bookDto
.
setLastModifiedDate
(
esBookAndAdviser
.
getLastModifiedDate
());
bookDto
.
setGraLabelId
(
esBookAndAdviser
.
getGraLabelId
());
bookDto
.
setSubLabelId
(
esBookAndAdviser
.
getSubLabelId
());
bookDto
.
setAreaLabelId
(
esBookAndAdviser
.
getAreaLabelId
());
bookDto
.
setVerLabelId
(
esBookAndAdviser
.
getVerLabelId
());
bookDtos
.
add
(
bookDto
);
bookDtos
.
add
(
bookDto
);
}
}
return
bookDtos
;
return
bookDtos
;
...
@@ -2146,7 +2190,6 @@ public class BookBizImpl implements BookBiz {
...
@@ -2146,7 +2190,6 @@ public class BookBizImpl implements BookBiz {
//填充出版社信息
//填充出版社信息
List
<
Long
>
adviserIds
=
list
.
stream
().
filter
(
s
->
s
.
getAdviserId
()!=
null
).
map
(
BookDto:
:
getAdviserId
).
distinct
().
collect
(
Collectors
.
toList
());
List
<
Long
>
adviserIds
=
list
.
stream
().
filter
(
s
->
s
.
getAdviserId
()!=
null
).
map
(
BookDto:
:
getAdviserId
).
distinct
().
collect
(
Collectors
.
toList
());
Map
<
Long
,
AdviserBaseInfoDto
>
infoDtoMap
=
adviserConsr
.
getAdviserId2AdviserInfoDtoMap
(
adviserIds
);
Map
<
Long
,
AdviserBaseInfoDto
>
infoDtoMap
=
adviserConsr
.
getAdviserId2AdviserInfoDtoMap
(
adviserIds
);
Map
<
Long
,
String
>
adviserMap
=
adviserConsr
.
getNames
(
adviserIds
);
List
<
Long
>
templetIds
=
new
ArrayList
<>();
List
<
Long
>
templetIds
=
new
ArrayList
<>();
list
.
forEach
(
BookDto
->
{
list
.
forEach
(
BookDto
->
{
if
(
Objects
.
nonNull
(
BookDto
.
getTempletId
()))
{
if
(
Objects
.
nonNull
(
BookDto
.
getTempletId
()))
{
...
@@ -2174,11 +2217,9 @@ public class BookBizImpl implements BookBiz {
...
@@ -2174,11 +2217,9 @@ public class BookBizImpl implements BookBiz {
if
(
infoDto
!=
null
){
if
(
infoDto
!=
null
){
bookDto
.
setAgentId
(
infoDto
.
getAgentId
());
bookDto
.
setAgentId
(
infoDto
.
getAgentId
());
bookDto
.
setAgentName
(
infoDto
.
getAgentName
());
bookDto
.
setAgentName
(
infoDto
.
getAgentName
());
bookDto
.
setAdviserName
(
infoDto
.
getPartyName
());
}
}
}
}
if
(
adviserMap
!=
null
){
bookDto
.
setAdviserName
(
adviserMap
.
get
(
adviserId
));
}
});
});
}
}
...
@@ -2327,4 +2368,41 @@ public class BookBizImpl implements BookBiz {
...
@@ -2327,4 +2368,41 @@ public class BookBizImpl implements BookBiz {
}
}
return
s
;
return
s
;
}
}
@Override
public
PageBeanNew
<
BookDto
>
getAdviserBooks4Applet
(
BookSearchParamVO
bookSearchParamVO
)
{
List
<
Long
>
templetIds
=
new
ArrayList
<>();
if
(
null
!=
bookSearchParamVO
.
getBookClassifyId
())
{
templetIds
=
appletBookClassifyBiz
.
getRelationBookTempletByBookClassify
(
bookSearchParamVO
.
getBookClassifyId
());
}
List
<
Long
>
graLabelIds
=
new
ArrayList
<>();
List
<
Long
>
subLabelIds
=
new
ArrayList
<>();
if
(!
ListUtils
.
isEmpty
(
bookSearchParamVO
.
getAppletUserLabelIdList
()))
{
Long
appletUserLabelId
=
bookSearchParamVO
.
getAppletUserLabelIdList
().
get
(
0
);
//先支持一个标签
List
<
AppletUserLabelRelation
>
relations
=
appletBookClassifyBiz
.
getByAppletUserLabelId
(
appletUserLabelId
);
if
(!
ListUtils
.
isEmpty
(
relations
))
{
for
(
AppletUserLabelRelation
relation
:
relations
)
{
if
(
relation
.
getLabelType
()
==
1
)
{
graLabelIds
.
add
(
relation
.
getBookLabelId
());
}
else
if
(
relation
.
getLabelType
()
==
2
)
{
subLabelIds
.
add
(
relation
.
getBookLabelId
());
}
}
}
}
String
grayStatus
=
StringUtils
.
isEmpty
(
bookSearchParamVO
.
getGrayStatus
())
?
"0"
:
bookSearchParamVO
.
getGrayStatus
();
String
keyword
=
bookSearchParamVO
.
getKeyword
();
Integer
currentPage
=
bookSearchParamVO
.
getCurrentPage
();
Integer
numPerPage
=
bookSearchParamVO
.
getNumPerPage
();
Page
<
ESBookAndAdviser
>
esPage
=
esBookAndAdviserBiz
.
getESAdviserBooks4Applet
(
grayStatus
,
keyword
,
templetIds
,
graLabelIds
,
subLabelIds
,
currentPage
,
numPerPage
);
List
<
ESBookAndAdviser
>
esBookAndAdvisers
=
esPage
.
getContent
();
if
(
ListUtils
.
isEmpty
(
esBookAndAdvisers
))
{
return
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
0
,
new
ArrayList
<>());
}
List
<
BookDto
>
bookDtos
=
changeToBookDto
(
esBookAndAdvisers
);
fillOtherBookInfo
(
bookDtos
);
fillBookInfo
(
bookDtos
);
PageBeanNew
<
BookDto
>
page
=
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
(
int
)
esPage
.
getTotalElements
(),
bookDtos
);
return
page
;
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/book/facade/BookFacade.java
View file @
8c4bbdfb
...
@@ -10,6 +10,7 @@ import com.pcloud.book.book.entity.Book;
...
@@ -10,6 +10,7 @@ import com.pcloud.book.book.entity.Book;
import
com.pcloud.book.book.vo.ListNoAuthBookParam
;
import
com.pcloud.book.book.vo.ListNoAuthBookParam
;
import
com.pcloud.book.book.vo.ListNoAuthGroupBookParam
;
import
com.pcloud.book.book.vo.ListNoAuthGroupBookParam
;
import
com.pcloud.book.book.vo.request.BookQualifyInfoVO
;
import
com.pcloud.book.book.vo.request.BookQualifyInfoVO
;
import
com.pcloud.book.book.vo.request.BookSearchParamVO
;
import
com.pcloud.book.book.vo.request.UpdateBookRobotProcessDto
;
import
com.pcloud.book.book.vo.request.UpdateBookRobotProcessDto
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.exceptions.BizException
;
...
@@ -20,6 +21,7 @@ import com.pcloud.common.permission.PermissionException;
...
@@ -20,6 +21,7 @@ import com.pcloud.common.permission.PermissionException;
import
io.swagger.annotations.*
;
import
io.swagger.annotations.*
;
import
org.codehaus.jackson.JsonParseException
;
import
org.codehaus.jackson.JsonParseException
;
import
org.springframework.cloud.netflix.feign.FeignClient
;
import
org.springframework.cloud.netflix.feign.FeignClient
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.CookieValue
;
import
org.springframework.web.bind.annotation.CookieValue
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
...
@@ -751,4 +753,10 @@ public interface BookFacade {
...
@@ -751,4 +753,10 @@ public interface BookFacade {
@ApiOperation
(
value
=
"现代纸书更新书刊是否开启小睿流程"
,
httpMethod
=
"POST"
)
@ApiOperation
(
value
=
"现代纸书更新书刊是否开启小睿流程"
,
httpMethod
=
"POST"
)
@RequestMapping
(
value
=
"updateIsOpenRobotProcess4Now"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"updateIsOpenRobotProcess4Now"
,
method
=
RequestMethod
.
POST
)
public
ResponseDto
<?>
updateIsOpenRobotProcess4Now
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
UpdateBookRobotProcessDto
robotProcessDto
)
throws
PermissionException
;
public
ResponseDto
<?>
updateIsOpenRobotProcess4Now
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
UpdateBookRobotProcessDto
robotProcessDto
)
throws
PermissionException
;
@ApiOperation
(
"小程序首页书刊搜索"
)
@PostMapping
(
"getAdviserBooks4Applet"
)
public
ResponseDto
<?>
getAdviserBooks4Applet
(
@RequestBody
@Validated
BookSearchParamVO
bookSearchParamVO
)
throws
BizException
,
PermissionException
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/book/facade/impl/BookFacadeImpl.java
View file @
8c4bbdfb
...
@@ -17,6 +17,7 @@ import com.pcloud.book.book.vo.ListNoAuthBookParam;
...
@@ -17,6 +17,7 @@ import com.pcloud.book.book.vo.ListNoAuthBookParam;
import
com.pcloud.book.book.vo.ListNoAuthGroupBookParam
;
import
com.pcloud.book.book.vo.ListNoAuthGroupBookParam
;
import
com.pcloud.book.book.vo.SearchBookVO
;
import
com.pcloud.book.book.vo.SearchBookVO
;
import
com.pcloud.book.book.vo.request.BookQualifyInfoVO
;
import
com.pcloud.book.book.vo.request.BookQualifyInfoVO
;
import
com.pcloud.book.book.vo.request.BookSearchParamVO
;
import
com.pcloud.book.book.vo.request.UpdateBookRobotProcessDto
;
import
com.pcloud.book.book.vo.request.UpdateBookRobotProcessDto
;
import
com.pcloud.common.core.constant.SystemCode
;
import
com.pcloud.common.core.constant.SystemCode
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.dto.ResponseDto
;
...
@@ -38,6 +39,7 @@ import io.swagger.annotations.ApiOperation;
...
@@ -38,6 +39,7 @@ import io.swagger.annotations.ApiOperation;
import
org.codehaus.jackson.JsonParseException
;
import
org.codehaus.jackson.JsonParseException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.CookieValue
;
import
org.springframework.web.bind.annotation.CookieValue
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
...
@@ -1069,4 +1071,12 @@ public class BookFacadeImpl implements BookFacade {
...
@@ -1069,4 +1071,12 @@ public class BookFacadeImpl implements BookFacade {
return
new
ResponseDto
<>(
bookBiz
.
getAdviserBooks4Rights
(
keyword
,
agentId
,
templetId
,
secondTempletId
,
typeCode
,
currentPage
,
numPerPage
));
return
new
ResponseDto
<>(
bookBiz
.
getAdviserBooks4Rights
(
keyword
,
agentId
,
templetId
,
secondTempletId
,
typeCode
,
currentPage
,
numPerPage
));
}
}
@Override
@PostMapping
(
"getAdviserBooks4Applet"
)
public
ResponseDto
<?>
getAdviserBooks4Applet
(
@RequestBody
@Validated
BookSearchParamVO
bookSearchParamVO
)
throws
BizException
,
PermissionException
{
return
new
ResponseDto
<>(
bookBiz
.
getAdviserBooks4Applet
(
bookSearchParamVO
));
}
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/book/vo/request/BookSearchParamVO.java
0 → 100644
View file @
8c4bbdfb
package
com
.
pcloud
.
book
.
book
.
vo
.
request
;
import
java.util.List
;
import
javax.validation.constraints.NotNull
;
import
lombok.Data
;
/**
* @ClassName com.pcloud.book.book.vo.request.BookSearchParamVO
* @Author zhuyajie
* @Description 书刊搜索
* @Date 2020/5/22 17:19
* @Version 1.0
**/
@Data
public
class
BookSearchParamVO
{
private
String
grayStatus
;
private
String
keyword
;
private
Long
bookClassifyId
;
private
List
<
Long
>
appletUserLabelIdList
;
@NotNull
private
Integer
currentPage
;
@NotNull
private
Integer
numPerPage
;
}
pcloud-service-book/src/main/java/com/pcloud/book/es/biz/ESBookAndAdviserBiz.java
View file @
8c4bbdfb
...
@@ -17,4 +17,5 @@ public interface ESBookAndAdviserBiz {
...
@@ -17,4 +17,5 @@ public interface ESBookAndAdviserBiz {
Page
<
ESBookAndAdviser
>
getAdviserBooks4ES
(
String
grayStatus
,
String
keyword
,
Long
templetId
,
Long
secondTempletId
,
Integer
currentPage
,
Integer
numPerPage
);
Page
<
ESBookAndAdviser
>
getAdviserBooks4ES
(
String
grayStatus
,
String
keyword
,
Long
templetId
,
Long
secondTempletId
,
Integer
currentPage
,
Integer
numPerPage
);
Page
<
ESBookAndAdviser
>
getESAdviserBooks4Applet
(
String
grayStatus
,
String
keyword
,
List
<
Long
>
templetIds
,
List
<
Long
>
graLabelIds
,
List
<
Long
>
subLabelIds
,
Integer
currentPage
,
Integer
numPerPage
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/es/biz/impl/ESBookAndAdviserBizImpl.java
View file @
8c4bbdfb
...
@@ -120,4 +120,39 @@ public class ESBookAndAdviserBizImpl implements ESBookAndAdviserBiz {
...
@@ -120,4 +120,39 @@ public class ESBookAndAdviserBizImpl implements ESBookAndAdviserBiz {
return
search
;
return
search
;
}
}
@Override
public
Page
<
ESBookAndAdviser
>
getESAdviserBooks4Applet
(
String
grayStatus
,
String
keyword
,
List
<
Long
>
templetIds
,
List
<
Long
>
graLabelIds
,
List
<
Long
>
subLabelIds
,
Integer
currentPage
,
Integer
numPerPage
)
{
BoolQueryBuilder
boolQueryBuilder
=
QueryBuilders
.
boolQuery
()
.
filter
(
QueryBuilders
.
termQuery
(
"isBookDelete"
,
0
))
.
filter
(
ListUtils
.
isEmpty
(
templetIds
)
?
QueryBuilders
.
boolQuery
()
:
QueryBuilders
.
termsQuery
(
"templetId"
,
templetIds
))
.
filter
(
ListUtils
.
isEmpty
(
graLabelIds
)
?
QueryBuilders
.
boolQuery
()
:
QueryBuilders
.
termsQuery
(
"graLabelId"
,
graLabelIds
))
.
filter
(
ListUtils
.
isEmpty
(
subLabelIds
)
?
QueryBuilders
.
boolQuery
()
:
QueryBuilders
.
termsQuery
(
"subLabelId"
,
subLabelIds
));
BoolQueryBuilder
should
=
QueryBuilders
.
boolQuery
()
.
should
(
StringUtil
.
isEmpty
(
keyword
)
?
QueryBuilders
.
boolQuery
()
:
QueryBuilders
.
wildcardQuery
(
"bookName"
,
"*"
+
keyword
+
"*"
))
.
should
(
StringUtil
.
isEmpty
(
keyword
)
?
QueryBuilders
.
boolQuery
()
:
QueryBuilders
.
wildcardQuery
(
"isbn"
,
"*"
+
keyword
+
"*"
));
BoolQueryBuilder
should1
=
QueryBuilders
.
boolQuery
()
.
should
(
QueryBuilders
.
termQuery
(
"isBookAdviserDelete"
,
0
))
.
should
(
QueryBuilders
.
termQuery
(
"isAdviserBook"
,
0
));
// 审核通过之后屏蔽掉测试编辑的书刊
BoolQueryBuilder
adviserIdBuilder
=
QueryBuilders
.
boolQuery
();
if
(
YesOrNoEnums
.
YES
.
getCode
().
equals
(
grayStatus
))
{
if
(
"test"
.
equalsIgnoreCase
(
BookProps
.
getSystemEnv
()))
{
adviserIdBuilder
=
QueryBuilders
.
boolQuery
().
mustNot
(
QueryBuilders
.
termQuery
(
"adviserId"
,
1404
));
}
if
(
"uat"
.
equalsIgnoreCase
(
BookProps
.
getSystemEnv
()))
{
adviserIdBuilder
=
QueryBuilders
.
boolQuery
().
mustNot
(
QueryBuilders
.
termQuery
(
"adviserId"
,
12829
));
}
if
(
"pro"
.
equalsIgnoreCase
(
BookProps
.
getSystemEnv
()))
{
adviserIdBuilder
=
QueryBuilders
.
boolQuery
().
mustNot
(
QueryBuilders
.
termQuery
(
"adviserId"
,
1362
));
}
}
boolQueryBuilder
.
must
(
should
);
boolQueryBuilder
.
must
(
should1
);
boolQueryBuilder
.
must
(
adviserIdBuilder
);
Sort
sort
=
new
Sort
(
Sort
.
Direction
.
DESC
,
"isAdviserBook"
,
"lastModifiedDate"
,
"bookId"
);
PageRequest
pageRequest
=
new
PageRequest
(
currentPage
,
numPerPage
,
sort
);
Page
<
ESBookAndAdviser
>
search
=
bookAndAdviserRepository
.
search
(
boolQueryBuilder
,
pageRequest
);
return
search
;
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/es/entity/ESBookAndAdviser.java
View file @
8c4bbdfb
...
@@ -95,6 +95,24 @@ public class ESBookAndAdviser {
...
@@ -95,6 +95,24 @@ public class ESBookAndAdviser {
*/
*/
private
String
isAdviserBook
;
private
String
isAdviserBook
;
/**
* 年级标签id
*/
private
Long
graLabelId
;
/**
* 科目标签id
*/
private
Long
subLabelId
;
/**
* 版本标签id
*/
private
Long
verLabelId
;
/**
* 地域标签id
*/
private
Long
areaLabelId
;
}
}
pcloud-service-book/src/main/resources/mapper/applet/AppletBookClassifyDao.xml
0 → 100644
View file @
8c4bbdfb
<?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.applet.dao.impl.AppletBookClassifyDaoImpl"
>
<resultMap
type=
"com.pcloud.book.applet.entity.AppletBookClassify"
id=
"AppletBookClassifyMap"
>
<result
property=
"id"
column=
"id"
jdbcType=
"INTEGER"
/>
<result
property=
"classify"
column=
"classify"
jdbcType=
"VARCHAR"
/>
<result
property=
"classifyName"
column=
"classify_name"
jdbcType=
"VARCHAR"
/>
<result
property=
"seq"
column=
"seq"
jdbcType=
"INTEGER"
/>
<result
property=
"pic"
column=
"pic"
jdbcType=
"VARCHAR"
/>
<result
property=
"showState"
column=
"show_state"
jdbcType=
"BOOLEAN"
/>
<result
property=
"createTime"
column=
"create_time"
jdbcType=
"TIMESTAMP"
/>
<result
property=
"updateTime"
column=
"update_time"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<!--查询单个-->
<select
id=
"queryById"
resultMap=
"AppletBookClassifyMap"
>
select
id, classify, classify_name, seq, pic, show_state, create_time, update_time
from book.applet_book_classify
where id = #{id}
</select>
<!--通过实体作为筛选条件查询-->
<select
id=
"queryAll"
parameterType=
"map"
resultType=
"com.pcloud.book.applet.dto.AppletBookClassifyDTO"
>
select
id, classify, classify_name classifyName, seq, pic, show_state showState
from book.applet_book_classify
WHERE 1=1
<if
test=
"showState != null"
>
and show_state = #{showState}
</if>
order by seq asc, id asc
</select>
<!--通过主键修改数据-->
<update
id=
"update"
>
update book.applet_book_classify
<set>
<if
test=
"classifyName != null and classifyName != ''"
>
classify_name = #{classifyName},
</if>
<if
test=
"seq != null"
>
seq = #{seq},
</if>
<if
test=
"pic != null and pic != ''"
>
pic = #{pic},
</if>
<if
test=
"showState != null"
>
show_state = #{showState},
</if>
update_time = now(),
</set>
where id = #{id}
</update>
<insert
id=
"addBookClassifyRelation"
parameterType=
"list"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into book.applet_book_classify_relation (
applet_book_classify_id, book_templet_id, create_time)
values
<foreach
collection=
"list"
item=
"item"
index=
"index"
separator=
","
>
( #{item.appletBookClassifyId}, #{item.bookTempletId}, NOW() )
</foreach>
</insert>
<select
id=
"getRelationBookTempletByBookClassify"
parameterType=
"long"
resultType=
"long"
>
SELECT
book_templet_id bookTempletId
FROM book.applet_book_classify_relation
WHERE applet_book_classify_id = #{bookClassifyId}
</select>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/applet/AppletUserLabelMapper.xml
0 → 100644
View file @
8c4bbdfb
<?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.applet.mapper.AppletUserLabelMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.applet.entity.AppletUserLabel"
>
<id
column=
"id"
jdbcType=
"BIGINT"
property=
"id"
/>
<result
column=
"label_name"
jdbcType=
"VARCHAR"
property=
"labelName"
/>
<result
column=
"applet_book_classify_id"
jdbcType=
"BIGINT"
property=
"appletBookClassifyId"
/>
<result
column=
"creat_time"
jdbcType=
"TIMESTAMP"
property=
"creatTime"
/>
<result
column=
"update_time"
jdbcType=
"TIMESTAMP"
property=
"updateTime"
/>
</resultMap>
<resultMap
id=
"DTOResultMap"
type=
"com.pcloud.book.applet.dto.AppletUserLabelDTO"
>
<id
column=
"aid"
jdbcType=
"BIGINT"
property=
"id"
/>
<result
column=
"label_name"
jdbcType=
"VARCHAR"
property=
"labelName"
/>
<result
column=
"applet_book_classify_id"
jdbcType=
"BIGINT"
property=
"appletBookClassifyId"
/>
<collection
property=
"appletUserLabelRelations"
ofType=
"com.pcloud.book.applet.entity.AppletUserLabelRelation"
>
<id
column=
"arid"
property=
"id"
jdbcType=
"BIGINT"
/>
<id
column=
"aid"
property=
"appletUserLabelId"
jdbcType=
"BIGINT"
/>
<result
column=
"book_label_id"
property=
"bookLabelId"
jdbcType=
"BIGINT"
/>
<result
column=
"label_type"
property=
"labelType"
jdbcType=
"TINYINT"
/>
</collection>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, label_name, applet_book_classify_id, creat_time, update_time
</sql>
<select
id=
"selectByPrimaryKey"
parameterType=
"java.lang.Long"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from applet_user_label
where id = #{id,jdbcType=BIGINT}
</select>
<select
id=
"listUserLabel"
resultMap=
"DTOResultMap"
parameterType=
"long"
>
select
a.id aid, label_name, applet_book_classify_id,
ar.id arid, ar.book_label_id, ar.label_type
from
applet_user_label a
left join applet_user_label_relation ar on a.id = ar.applet_user_label_id
where
a.applet_book_classify_id = #{appletBookClassifyId}
order by create_time desc
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Long"
>
delete from applet_user_label
where id = #{id,jdbcType=BIGINT}
</delete>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.applet.entity.AppletUserLabel"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into applet_user_label (id, label_name, applet_book_classify_id,
creat_time, update_time)
values (#{id,jdbcType=BIGINT}, #{labelName,jdbcType=VARCHAR}, #{appletBookClassifyId,jdbcType=BIGINT},
now(), now())
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.pcloud.book.applet.entity.AppletUserLabel"
>
insert into applet_user_label
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
id,
</if>
<if
test=
"labelName != null"
>
label_name,
</if>
<if
test=
"appletBookClassifyId != null"
>
applet_book_classify_id,
</if>
<if
test=
"creatTime != null"
>
creat_time,
</if>
<if
test=
"updateTime != null"
>
update_time,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
#{id,jdbcType=BIGINT},
</if>
<if
test=
"labelName != null"
>
#{labelName,jdbcType=VARCHAR},
</if>
<if
test=
"appletBookClassifyId != null"
>
#{appletBookClassifyId,jdbcType=BIGINT},
</if>
<if
test=
"creatTime != null"
>
#{creatTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"updateTime != null"
>
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"com.pcloud.book.applet.entity.AppletUserLabel"
>
update applet_user_label
<set>
<if
test=
"labelName != null"
>
label_name = #{labelName,jdbcType=VARCHAR},
</if>
<if
test=
"appletBookClassifyId != null"
>
applet_book_classify_id = #{appletBookClassifyId,jdbcType=BIGINT},
</if>
<if
test=
"creatTime != null"
>
creat_time = #{creatTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"updateTime != null"
>
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update
id=
"updateByPrimaryKey"
parameterType=
"com.pcloud.book.applet.entity.AppletUserLabel"
>
update applet_user_label
set label_name = #{labelName,jdbcType=VARCHAR},
applet_book_classify_id = #{appletBookClassifyId,jdbcType=BIGINT},
update_time = now()
where id = #{id,jdbcType=BIGINT}
</update>
<select
id=
"getBookClassifyAndLabel"
resultType=
"com.pcloud.book.applet.dto.AppletLabelDTO"
>
SELECT
l.id appletUserLabelId,
l.label_name labelName,
c.id appletBookClassifyId
FROM
applet_user_label l
LEFT JOIN applet_book_classify c ON l.applet_book_classify_id = c.id
ORDER BY l.creat_time DESC
</select>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/applet/AppletUserLabelRelationMapper.xml
0 → 100644
View file @
8c4bbdfb
<?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.applet.mapper.AppletUserLabelRelationMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.applet.entity.AppletUserLabelRelation"
>
<id
column=
"id"
property=
"id"
jdbcType=
"BIGINT"
/>
<result
column=
"applet_user_label_id"
property=
"appletUserLabelId"
jdbcType=
"BIGINT"
/>
<result
column=
"book_label_id"
property=
"bookLabelId"
jdbcType=
"BIGINT"
/>
<result
column=
"label_type"
property=
"labelType"
jdbcType=
"INTEGER"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"update_time"
property=
"updateTime"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, applet_user_label_id, book_label_id, label_type, create_time, update_time
</sql>
<select
id=
"selectByPrimaryKey"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.Long"
>
select
<include
refid=
"Base_Column_List"
/>
from applet_user_label_relation
where id = #{id,jdbcType=BIGINT}
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Long"
>
delete from applet_user_label_relation
where id = #{id,jdbcType=BIGINT}
</delete>
<!-- 删除用户标签与年级标签和科目标签的关联关系-->
<delete
id=
"deleteByUserLabelId"
parameterType=
"long"
>
delete
from
applet_user_label_relation
where
applet_user_label_id = #{UserLabelId}
</delete>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.applet.entity.AppletUserLabelRelation"
>
insert into applet_user_label_relation (id, applet_user_label_id, book_label_id,
label_type, create_time, update_time
)
values (#{id,jdbcType=BIGINT}, #{appletUserLabelId,jdbcType=BIGINT}, #{bookLabelId,jdbcType=BIGINT},
#{labelType,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
)
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.pcloud.book.applet.entity.AppletUserLabelRelation"
>
insert into applet_user_label_relation
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
id,
</if>
<if
test=
"appletUserLabelId != null"
>
applet_user_label_id,
</if>
<if
test=
"bookLabelId != null"
>
book_label_id,
</if>
<if
test=
"labelType != null"
>
label_type,
</if>
<if
test=
"createTime != null"
>
create_time,
</if>
<if
test=
"updateTime != null"
>
update_time,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
#{id,jdbcType=BIGINT},
</if>
<if
test=
"appletUserLabelId != null"
>
#{appletUserLabelId,jdbcType=BIGINT},
</if>
<if
test=
"bookLabelId != null"
>
#{bookLabelId,jdbcType=BIGINT},
</if>
<if
test=
"labelType != null"
>
#{labelType,jdbcType=INTEGER},
</if>
<if
test=
"createTime != null"
>
#{createTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"updateTime != null"
>
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<insert
id=
"batchInsert"
parameterType=
"com.pcloud.book.applet.entity.AppletUserLabelRelation"
>
insert into applet_user_label_relation (applet_user_label_id, book_label_id,
label_type, create_time, update_time
)
values
<foreach
collection=
"list"
item=
"item"
index=
"index"
separator=
","
>
(#{item.appletUserLabelId,jdbcType=BIGINT}, #{item.bookLabelId,jdbcType=BIGINT},
#{item.labelType,jdbcType=INTEGER}, now(),now()
)
</foreach>
</insert>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"com.pcloud.book.applet.entity.AppletUserLabelRelation"
>
update applet_user_label_relation
<set
>
<if
test=
"appletUserLabelId != null"
>
applet_user_label_id = #{appletUserLabelId,jdbcType=BIGINT},
</if>
<if
test=
"bookLabelId != null"
>
book_label_id = #{bookLabelId,jdbcType=BIGINT},
</if>
<if
test=
"labelType != null"
>
label_type = #{labelType,jdbcType=INTEGER},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"updateTime != null"
>
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update
id=
"updateByPrimaryKey"
parameterType=
"com.pcloud.book.applet.entity.AppletUserLabelRelation"
>
update applet_user_label_relation
set applet_user_label_id = #{appletUserLabelId,jdbcType=BIGINT},
book_label_id = #{bookLabelId,jdbcType=BIGINT},
label_type = #{labelType,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=BIGINT}
</update>
<select
id=
"getByAppletUserLabelId"
parameterType=
"long"
resultMap=
"BaseResultMap"
>
SELECT
<include
refid=
"Base_Column_List"
/>
FROM
applet_user_label_relation
WHERE
applet_user_label_id = #{appletUserLabelId,jdbcType=BIGINT}
</select>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/book/Book.Mapper.xml
View file @
8c4bbdfb
...
@@ -2277,7 +2277,11 @@
...
@@ -2277,7 +2277,11 @@
IF(A.SECOND_TEMPLET_ID is NULL, 0, A.SECOND_TEMPLET_ID) secondTempletId,
IF(A.SECOND_TEMPLET_ID is NULL, 0, A.SECOND_TEMPLET_ID) secondTempletId,
IF(A.LAST_MODIFIED_DATE is NULL, "2001-01-01 00:00:00", A.LAST_MODIFIED_DATE) lastModifiedDate,
IF(A.LAST_MODIFIED_DATE is NULL, "2001-01-01 00:00:00", A.LAST_MODIFIED_DATE) lastModifiedDate,
IF(A.BOOK_ADVISER_ID is NULL, 0, A.BOOK_ADVISER_ID) bookAdviserId,
IF(A.BOOK_ADVISER_ID is NULL, 0, A.BOOK_ADVISER_ID) bookAdviserId,
IF(A.BOOK_ADVISER_ID is NULL, 0, 1) isAdviserBook
IF(A.BOOK_ADVISER_ID is NULL, 0, 1) isAdviserBook,
IF(A.GRA_LABEL_ID is NULL, 0, A.GRA_LABEL_ID) graLabelId,
IF(A.SUB_LABEL_ID is NULL, 0, A.SUB_LABEL_ID) subLabelId,
IF(A.AREA_LABEL_ID is NULL, 0, A.AREA_LABEL_ID) areaLabelId,
IF(A.VER_LABEL_ID is NULL, 0, A.VER_LABEL_ID) verLabelId
FROM
FROM
BOOK B
BOOK B
LEFT JOIN BOOK_ADVISER A ON A.BOOK_ID = B.BOOK_ID and A.IS_MAIN_EDITOR=1
LEFT JOIN BOOK_ADVISER A ON A.BOOK_ID = B.BOOK_ID and A.IS_MAIN_EDITOR=1
...
@@ -2302,7 +2306,11 @@
...
@@ -2302,7 +2306,11 @@
IF(A.SECOND_TEMPLET_ID is NULL, 0, A.SECOND_TEMPLET_ID) secondTempletId,
IF(A.SECOND_TEMPLET_ID is NULL, 0, A.SECOND_TEMPLET_ID) secondTempletId,
IF(A.LAST_MODIFIED_DATE is NULL, "2001-01-01 00:00:00", A.LAST_MODIFIED_DATE) lastModifiedDate,
IF(A.LAST_MODIFIED_DATE is NULL, "2001-01-01 00:00:00", A.LAST_MODIFIED_DATE) lastModifiedDate,
IF(A.BOOK_ADVISER_ID is NULL, 0, A.BOOK_ADVISER_ID) bookAdviserId,
IF(A.BOOK_ADVISER_ID is NULL, 0, A.BOOK_ADVISER_ID) bookAdviserId,
IF(A.BOOK_ADVISER_ID is NULL, 0, 1) isAdviserBook
IF(A.BOOK_ADVISER_ID is NULL, 0, 1) isAdviserBook,
IF(A.GRA_LABEL_ID is NULL, 0, A.GRA_LABEL_ID) graLabelId,
IF(A.SUB_LABEL_ID is NULL, 0, A.SUB_LABEL_ID) subLabelId,
IF(A.AREA_LABEL_ID is NULL, 0, A.AREA_LABEL_ID) areaLabelId,
IF(A.VER_LABEL_ID is NULL, 0, A.VER_LABEL_ID) verLabelId
FROM
FROM
BOOK B
BOOK B
LEFT JOIN BOOK_ADVISER A ON A.BOOK_ID = B.BOOK_ID and A.IS_MAIN_EDITOR=1
LEFT JOIN BOOK_ADVISER A ON A.BOOK_ID = B.BOOK_ID and A.IS_MAIN_EDITOR=1
...
...
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