Commit 51e43c65 by 田超

Merge branch 'feature/1005965' into 'master'

feat: [1005965] 编辑端新手引导

See merge request rays/pcloud-book!1466
parents e2177025 51129de7
......@@ -854,6 +854,23 @@ public class BookDto extends BaseDto {
*/
private Integer isJumpBook;
/**
* 是否案例书刊 1-案例书刊
*/
private Integer appointBook;
public Integer getAppointBook() {
return appointBook;
}
public void setAppointBook(Integer appointBook) {
this.appointBook = appointBook;
}
public static long getSerialVersionUID() {
return serialVersionUID;
}
public Integer getIsJumpBook() {
return isJumpBook;
}
......@@ -2588,6 +2605,7 @@ public class BookDto extends BaseDto {
", openCatalogPermission=" + openCatalogPermission +
", qrcodeType='" + qrcodeType + '\'' +
", bookAdviserDto=" + bookAdviserDto +
", appointBook=" + appointBook +
'}';
}
}
......@@ -286,6 +286,19 @@ public class Book extends BaseEntity {
*/
private Integer forceUpdateSerialNumber;
/**
* 是否新手引导创建书刊
*/
private Boolean guideCreate;
public Boolean getGuideCreate() {
return guideCreate;
}
public void setGuideCreate(Boolean guideCreate) {
this.guideCreate = guideCreate;
}
public String getServeType() {
return serveType;
}
......
......@@ -185,7 +185,7 @@ public interface BookBiz {
* @return
* @throws BizException
*/
PageBean getListPage4Adviser(Map<String, Object> paramMap, PageParam pageParam, Long adviserId, Integer hasQrcode) throws BizException;
PageBean getListPage4Adviser(Map<String, Object> paramMap, PageParam pageParam, Long adviserId, Integer hasQrcode,Integer appointBook) throws BizException;
/**
* 首页展示正在做的图书
......@@ -806,4 +806,19 @@ public interface BookBiz {
PageBean listAdviserBook(AviserBookInfoParam aviserBookInfoParam);
void exportListPage4Agent(Map<String, Object> paramMap, Long agentId, Long partyId, String systemCode);
/**
* 获取指定展示书刊(新手引导)
*/
List<Object> getAppointBooks(Long adviserId, Long channelId);
/**
* 移除展示书刊(新手引导)
*/
void removeGuideBook(Long adviserId, Long bookId);
/**
* 超过10人扫码书刊(新手引导)
*/
BookDto getOver10ScanBook(Long adviserId);
}
......@@ -79,6 +79,7 @@ import com.pcloud.book.rightsSetting.dao.RightsNowItemDao;
import com.pcloud.book.rightsSetting.mapper.RightsSettingBookRelationMapper;
import com.pcloud.book.util.common.ThreadPoolUtils;
import com.pcloud.book.util.common.YesOrNoEnums;
import com.pcloud.channelcenter.catalog.dto.NoviceGuideCreateDTO;
import com.pcloud.channelcenter.qrcode.dto.QrcodeLocationDto;
import com.pcloud.channelcenter.qrcode.dto.QrcodeSceneDto;
import com.pcloud.channelcenter.qrcode.entity.QrcodeLabel;
......@@ -277,6 +278,11 @@ public class BookBizImpl implements BookBiz {
private ResourcePageItemDao resourcePageItemDao;
@Autowired
private AdviserTaskConsr adviserTaskConsr;
@Value("${appointBookIds}")
private List<Long> appointBookIds;
@Autowired
private NoviceGuideDeleteDao noviceGuideDeleteDao;
/**
* 创建书籍,同时建立与编辑的推广关系
*/
......@@ -886,9 +892,32 @@ public class BookBizImpl implements BookBiz {
* 获取书籍列表(编辑)
*/
@Override
public PageBean getListPage4Adviser(Map<String, Object> paramMap, PageParam pageParam, Long adviserId, Integer hasQrcode) throws BizException {
public PageBean getListPage4Adviser(Map<String, Object> paramMap, PageParam pageParam, Long adviserId, Integer hasQrcode,Integer appointBook) throws BizException {
LOGGER.info("【书籍应用】获取书籍列表,<START>.[paramMap]=" + paramMap);
PageBean pageBean = bookDao.listPage(pageParam, paramMap, "getListPage4Adviser");
PageBean pageBean=bookDao.listPage(pageParam, paramMap, "getListPage4Adviser");
LOGGER.info("appointBook=" + appointBook);
if (null != appointBook) {
//全是案列书,编辑可以自行删除决定不展示
List<Long> selectBookIds=new ArrayList<>(appointBookIds);
LOGGER.info("【书籍应用】内置书刊列表,<START>.[selectBookIds]=" + selectBookIds);
if(CollUtil.isNotEmpty(selectBookIds)){
//编辑自行删除的案例书
List<Long> deleteBookIds=noviceGuideDeleteDao.getDeleteBookIds(adviserId);
//案列书确实属于改编辑的
List<Long> selfBookIds=bookAdviserDao.getSelfBookIds(adviserId,selectBookIds);
if(CollUtil.isNotEmpty(deleteBookIds)) {
selectBookIds.removeAll(deleteBookIds);
}
if(CollUtil.isNotEmpty(selectBookIds) && CollUtil.isNotEmpty(selfBookIds)) {
selectBookIds.removeAll(selfBookIds);
}
LOGGER.info("【书籍应用】内置书刊列表,<end>.[selectBookIds]=" + selectBookIds);
if (CollUtil.isNotEmpty(selectBookIds)){
paramMap.put("selectBookIds",selectBookIds);
pageBean = bookDao.listPage(pageParam, paramMap, "getListPage4AdviserAndAppoint");
}
}
}
if (pageBean == null || ListUtils.isEmpty(pageBean.getRecordList())) {
return new PageBean(0, 0, new ArrayList<>());
}
......@@ -1666,6 +1695,16 @@ public class BookBizImpl implements BookBiz {
book.setLastModifiedUser(book.getCreatedUser());
book.setBookId(bookDto.getBookId());
}
ThreadPoolUtils.OTHER_THREAD_POOL.execute(()->{
//新手引导创建的书。默认创建书刊目录和二维码
if(null!=book.getGuideCreate() && book.getGuideCreate()){
NoviceGuideCreateDTO noviceGuideCreateDTO=new NoviceGuideCreateDTO();
noviceGuideCreateDTO.setBookId(book.getBookId());
noviceGuideCreateDTO.setChannelId(book.getChannelId());
noviceGuideCreateDTO.setPartyId(book.getCreatedUser());
qrcodeSceneConsr.noviceGuideCreateQr(noviceGuideCreateDTO);
}
});
// 查看现代纸书是否存在
final BookGroupDTO dtoByBookId = bookGroupBiz.getDTOByBookId(book.getBookId(), book.getChannelId(), book.getCreatedUser());
// 新增图书与编辑关联关系
......@@ -4422,4 +4461,82 @@ public class BookBizImpl implements BookBiz {
}
return pageBean;
}
/**
* 获取指定展示书刊(新手引导)
*/
@Override
public List<Object> getAppointBooks(Long adviserId, Long channelId) {
//全是案列书,编辑可以自行删除决定不展示
List<Long> bookIds=appointBookIds;
if(CollUtil.isEmpty(bookIds)){
return new ArrayList<>();
}
List<Long> deleteBookIds=noviceGuideDeleteDao.getDeleteBookIds(adviserId);
if(CollUtil.isNotEmpty(deleteBookIds)) {
bookIds.removeAll(deleteBookIds);
}
List<Object> list = bookDao.getAppointBooks(channelId,bookIds);
if (CollUtil.isEmpty(list)) {
return new ArrayList<>();
}
// 填充渠道基础信息
bookSet.setChannelInfoList(list);
bookSet.setBookSvUvPv4Object(list, adviserId);
// 填充模板信息
bookSet.setTemplateName(list);
// 设置图书是否关联二维码
bookSet.setIsRelationQrcodeAndCount(list,adviserId);
//设置图书收益
bookSet.setBookIncome(list);
// 设置二维码相关信息
bookSet.setQrInfo(list);
//社群书相关信息
bookSet.setBookGroupInfo(list);
//设置书刊是否是小睿书(开启小睿流程)
bookSet.setOpenRobotProcess(list);
return list;
}
/**
* 移除展示书刊(新手引导)
*/
@Override
public void removeGuideBook(Long adviserId, Long bookId) {
NoviceGuideDelete build = NoviceGuideDelete.builder().adviserId(adviserId).bookId(bookId).build();
noviceGuideDeleteDao.insert(build);
}
@Override
public BookDto getOver10ScanBook(Long adviserId) {
int i=0;
while (true){
Map<String, Object> paramMap = Maps.newHashMap();
paramMap.put("adviserId", adviserId);
PageParam pageParam=new PageParam(i,10);
PageBean pageBean = bookDao.listPage(pageParam, paramMap, "getListPage4Adviser");
if (pageBean == null || ListUtils.isEmpty(pageBean.getRecordList())) {
return null;
}
// 设置图书扫码量读者量浏览量
bookSet.setBookSvUvPv4Object(pageBean.getRecordList(), adviserId);
List<Object> recordList = pageBean.getRecordList();
for (Object object : recordList) {
BookDto bookDto = (BookDto) object;
if(null!=bookDto.getScanCount() && bookDto.getScanCount()>10){
return bookDto;
}
}
i++;
try {
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
if(i>10){
return null;
}
}
}
}
......@@ -348,4 +348,6 @@ public interface BookAdviserDao extends BaseDao<BookAdviser> {
void updateOpenRecommend(Long bookId, Long adviserId, Long channelId, Integer isOpenRecommend, Integer recommendFromType);
OpenRecommendVO getOpenRecommend(Long bookId, Long adviserId, Long channelId);
List<Long> getSelfBookIds(Long adviserId, List<Long> selectBookIds);
}
......@@ -386,4 +386,6 @@ public interface BookDao extends BaseDao<Book> {
boolean checkIsBookId(Long isbnNumber);
List<BookDto> listPage4Agent(Map<String, Object> paramMap);
List<Object> getAppointBooks(Long channelId, List<Long> bookIds);
}
package com.pcloud.book.book.dao;
import com.pcloud.book.book.entity.NoviceGuideDelete;
import com.pcloud.common.core.dao.BaseDao;
import java.util.List;
/**
* 新手引导案例书刊删除表(NoviceGuideDelete)表数据库访问层
*
* @author makejava
* @since 2021-11-22 11:50:51
*/
public interface NoviceGuideDeleteDao extends BaseDao<NoviceGuideDelete> {
List<Long> getDeleteBookIds(Long adviserId);
}
\ No newline at end of file
......@@ -524,4 +524,12 @@ public class BookAdviserDaoImpl extends BaseDaoImpl<BookAdviser> implements Book
paramMap.put("adviserId", adviserId);
return getSessionTemplate().selectOne(getStatement("getOpenRecommend"), paramMap);
}
@Override
public List<Long> getSelfBookIds(Long adviserId, List<Long> selectBookIds) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("adviserId",adviserId);
paramMap.put("selectBookIds", selectBookIds);
return getSessionTemplate().selectList(getStatement("getSelfBookIds"), paramMap);
}
}
......@@ -470,4 +470,12 @@ public class BookDaoImpl extends BaseDaoImpl<Book> implements BookDao {
public List<BookDto> listPage4Agent(Map<String, Object> paramMap) {
return getSessionTemplate().selectList(getStatement("listPage4Agent"), paramMap);
}
@Override
public List<Object> getAppointBooks(Long channelId, List<Long> bookIds) {
Map<String, Object> paramMap = Maps.newHashMap();
paramMap.put("channelId", channelId);
paramMap.put("bookIds", bookIds);
return getSessionTemplate().selectList(getStatement("getAppointBooks"), paramMap);
}
}
package com.pcloud.book.book.dao.impl;
import com.google.common.collect.Maps;
import com.pcloud.book.book.entity.NoviceGuideDelete;
import com.pcloud.book.book.dao.NoviceGuideDeleteDao;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Repository;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* 新手引导案例书刊删除表(NoviceGuideDelete)表数据库访问层
*
* @author makejava
* @since 2021-11-22 11:50:51
*/
@Repository("noviceGuideDeleteDaoImpl")
public class NoviceGuideDeleteDaoImpl extends BaseDaoImpl<NoviceGuideDelete> implements NoviceGuideDeleteDao {
@Override
public List<Long> getDeleteBookIds(Long adviserId) {
Map<String, Object> map = Maps.newHashMap();
map.put("adviserId", adviserId);
return getSessionTemplate().selectList(getStatement("getDeleteBookIds"), map);
}
}
\ No newline at end of file
package com.pcloud.book.book.entity;
import java.util.Date;
import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 新手引导案例书刊删除表(NoviceGuideDelete)实体类
*
* @author makejava
* @since 2021-11-22 11:50:51
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
public class NoviceGuideDelete extends BaseEntity {
private static final long serialVersionUID = 928702112675084581L;
@ApiModelProperty("主键id")
private Long id;
@ApiModelProperty("编辑id")
private Long adviserId;
@ApiModelProperty("书刊id")
private Long bookId;
@ApiModelProperty("创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
@ApiModelProperty("修改时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updateTime;
}
\ No newline at end of file
......@@ -179,7 +179,8 @@ public interface BookFacade {
@RequestParam(value = "areaLabelId", required = false) Integer areaLabelId,
@RequestParam(value = "graLabelId", required = false) Integer graLabelId,
@RequestParam(value = "subLabelId", required = false) Integer subLabelId,
@RequestParam(value = "verLabelId", required = false) Integer verLabelId)
@RequestParam(value = "verLabelId", required = false) Integer verLabelId,
@RequestParam(value = "appointBook", required = false) Integer appointBook)
throws BizException, PermissionException;
@ApiOperation(value = "首页获取正在做的图书", httpMethod = "GET")
......
......@@ -287,7 +287,8 @@ public class BookFacadeImpl implements BookFacade {
@RequestParam(value = "areaLabelId", required = false) Integer areaLabelId,
@RequestParam(value = "graLabelId", required = false) Integer graLabelId,
@RequestParam(value = "subLabelId", required = false) Integer subLabelId,
@RequestParam(value = "verLabelId", required = false) Integer verLabelId)
@RequestParam(value = "verLabelId", required = false) Integer verLabelId,
@RequestParam(value = "appointBook", required = false) Integer appointBook)
throws BizException, PermissionException {
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
if (currentPage == null || numPerPage == null || currentPage < 0 || numPerPage < 0) {
......@@ -331,7 +332,7 @@ public class BookFacadeImpl implements BookFacade {
paramMap.put("graLabelId", graLabelId);
paramMap.put("subLabelId", subLabelId);
paramMap.put("verLabelId", verLabelId);
PageBean pageBean = bookBiz.getListPage4Adviser(paramMap, new PageParam(currentPage, numPerPage), adviserId, hasQrcode);
PageBean pageBean = bookBiz.getListPage4Adviser(paramMap, new PageParam(currentPage, numPerPage), adviserId, hasQrcode,appointBook);
return new ResponseDto<>(pageBean);
}
......@@ -1452,4 +1453,38 @@ public class BookFacadeImpl implements BookFacade {
bookBiz.updateCoverImg(vo);
return new ResponseDto<>();
}
/**
* 获取指定展示书刊(新手引导)
*/
@RequestMapping(value = "getAppointBooks", method = RequestMethod.GET)
public ResponseDto<List<Object>> getAppointBooks( @RequestHeader("token") String token,
@RequestParam(value = "channelId", required = false) Long channelId)
throws BizException, PermissionException {
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
return new ResponseDto<>(bookBiz.getAppointBooks(adviserId, channelId));
}
/**
* 移除展示书刊(新手引导)
*/
@RequestMapping(value = "removeGuideBook", method = RequestMethod.GET)
public ResponseDto<?> removeGuideBook( @RequestHeader("token") String token,
@RequestParam(value = "bookId") Long bookId)
throws BizException, PermissionException {
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
bookBiz.removeGuideBook(adviserId, bookId);
return new ResponseDto<>();
}
/**
* 超过10人扫码书刊(新手引导)
*/
@RequestMapping(value = "getOver10ScanBook", method = RequestMethod.GET)
public ResponseDto<?> getOver10ScanBook( @RequestHeader("token") String token)
throws BizException, PermissionException {
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
return new ResponseDto<>(bookBiz.getOver10ScanBook(adviserId));
}
}
......@@ -1649,6 +1649,41 @@ public class BookSet {
}
}
/**
* 设置图书是否关联二维码和个数
*
* @param recordList (List<BookDto>)
*/
/* public void setIsRelationQrcodeAndCount(List<Object> recordList) {
LOGGER.info("设置图书关联二维码个数【START】");
if (ListUtils.isEmpty(recordList)) {
return;
}
List<Long> channelIds = BookTools.listChannelIds(recordList);
List<Long> bookIds = BookTools.listBookIds(recordList);
List<Long> adviserIds = BookTools.listAdviserIds(recordList);
Map<String, Long> bookQrCountMap = qrcodeSceneConsr.listBookQrCounts(bookIds, channelIds, adviserIds);
for (Object obj : recordList) {
BookDto bookDto = (BookDto) obj;
if (null != bookDto) {
String key = bookDto.getBookId() + "-" + bookDto.getChannelId() + "-" + bookDto.getAdviserId();
bookDto.setBookQrCount(0L);
bookDto.setRelationQrcode(false);
// 设置书籍二维码数
if (null != bookQrCountMap) {
Long count = bookQrCountMap.get(key);
if (count != null && count > 0) {
bookDto.setBookQrCount(count);
bookDto.setRelationQrcode(true);
}
}
LOGGER.info("设置图书关联二维码个数【END】");
}
}
}*/
@ParamLog(value = "设置父模板标识", isBefore = false)
public void setTempleParentId(BookDto bookDto) {
if (null != bookDto && null != bookDto.getTempletId()) {
......
......@@ -7,6 +7,8 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.channelcenter.catalog.dto.NoviceGuideCreateDTO;
import com.pcloud.channelcenter.catalog.service.BookQrCatalogService;
import com.pcloud.channelcenter.qrcode.dto.BookDto;
import com.pcloud.channelcenter.qrcode.dto.BookSceneIdListDTO;
import com.pcloud.channelcenter.qrcode.dto.GroupQrcodeVO;
......@@ -77,6 +79,8 @@ public class QrcodeSceneConsr {
private QrcodeLocationAssocService qrcodeLocationAssocService;
@Autowired
private QrcodeTempService qrcodeTempService;
@Autowired
private BookQrCatalogService bookQrCatalogService;
/**
......@@ -649,6 +653,41 @@ public class QrcodeSceneConsr {
}
/**
* 获取书籍二维码个数
*/
public Map<String, Long> listBookQrCounts(List<Long> bookIds, List<Long> channelIds, List<Long> adviserIds)
throws BizException {
Map<String, Long> bookQrCount = new HashMap<>();
if (CollUtil.isEmpty(bookIds) || CollUtil.isEmpty(channelIds) || CollUtil.isEmpty(adviserIds)) {
return bookQrCount;
}
try {
Map<String, Object> idsMap = new HashMap<>();
idsMap.put("bookIds", bookIds);
idsMap.put("channelIds", channelIds);
idsMap.put("adviserIds", adviserIds);
ResponseEntity<ResponseDto<Map<String, Long>>> listBookQrCounts = qrcodeSceneService.listBookQrCounts(idsMap);
bookQrCount = ResponseHandleUtil.parseMap(listBookQrCounts, String.class, Long.class);
} catch (BizException e) {
LOGGER.warn("【二维码-渠道(消)】获取书籍二维码个数,<ERROR>.[qrcodeSceneService.deleteBook]:" + e.getMessage(), e);
throw new BizException(e.getCode(), e.getMessage());
} catch (Exception e) {
LOGGER.error("【二维码-渠道(消)】获取书籍二维码个数,<ERROR>.:" + e.getMessage(), e);
throw new BookBizException(BookBizException.INVOKE_CHANNEL_ERROR, "获取书籍二维码个数失败~!");
}
return bookQrCount;
}
public void noviceGuideCreateQr(NoviceGuideCreateDTO noviceGuideCreateDTO) {
LOGGER.info("新手引导创建书刊,noviceGuideCreateDTO={}",noviceGuideCreateDTO.toString());
try {
bookQrCatalogService.noviceGuideCreateQr(noviceGuideCreateDTO);
} catch (Exception e) {
LOGGER.error("新手引导创建书刊失败"+e.getMessage(), e);
}
}
/**
* 获取最近关联图书相关信息
* @param messageAssocBookAskInfoVOS
* @return
......
......@@ -667,6 +667,281 @@
</if>
</select>
<select id="getListPage4AdviserAndAppoint" resultMap="bookMap" parameterType="map">
(SELECT
A.BOOK_ID, A.CHANNEL_ID, A.ADVISER_ID, A.IS_MAIN_EDITOR, T.TYPE_CODE, T.TYPE_NAME, B.ISBN, B.BOOK_NAME, B.REMARK,
B.AUTHOR, B.PUBLISH, B.PUBLISH_DATE, B.COVER_IMG, B.ORIGIN_NAME, B.BOOK_PRICE, B.ISSN, B.BOOK_NUM, B.SERIAL_NUMBER,
IF(ISNULL(BF.BOOK_FUND_ID),0,1) IS_FUND_SUPPORT,A.TEMPLET_ID, A.LAST_MODIFIED_DATE,
A.BOOK_ADVISER_ID,I.BOOK_STATUS, CONCAT('BK',A.BOOK_ID) uniqueNumber, if(G.ID IS NULL, 0, 1) isBookGroup, A.IS_PRINT isPrint,
G.id BOOK_GROUP_ID, G.group_qrcode_url groupQrcodeUrl,G.group_qrcode_name groupQrcodeName,A.is_approval, A.is_relate,
G.join_group_type,G.single_group singleGroup, G.related_book_group_id relatedBookGroupId,
IF(ISNULL(s.id),0,1) minimumSupport, A.is_open_catalog,a.CREATED_DATE, 0 appointBook
FROM
BOOK_ADVISER A
INNER JOIN BOOK B ON A.BOOK_ID = B.BOOK_ID AND A.ADVISER_ID = #{adviserId} AND A.IS_DELETE = 0 AND B.IS_DELETE = 0
LEFT JOIN BOOK_TYPE T ON B.TYPE_CODE = T.TYPE_CODE
LEFT JOIN BOOK_FUND BF ON BF.BOOK_ID = A.BOOK_ID AND BF.END_TIME <![CDATA[ > ]]> NOW() AND BF.START_TIME <![CDATA[ < ]]> NOW()
LEFT JOIN book_auth_info I ON I.BOOK_ID = A.BOOK_ID AND I.ADVISER_ID = #{adviserId}
LEFT JOIN book_group G on G.BOOK_ID = A.BOOK_ID AND G.CHANNEL_ID = A.CHANNEL_ID AND G.CREATE_USER = A.ADVISER_ID AND G.IS_DELETE = 0
LEFT JOIN book_freeze f ON B.BOOK_ID = f.BOOK_ID
LEFT JOIN book_minimum_support s ON B.BOOK_ID=s.book_id AND s.end_time <![CDATA[ > ]]> NOW() AND s.start_time <![CDATA[ < ]]> NOW()
WHERE
1=1
<if test="bookId!=null">
AND
A.BOOK_ID = #{bookId}
</if>
<if test="typeCode!=null">
AND
B.TYPE_CODE = #{typeCode}
</if>
<if test="channelId!=null">
AND
A.CHANNEL_ID = #{channelId}
</if>
<if test="bookName!=null">
AND
B.BOOK_NAME LIKE CONCAT('%', #{bookName}, '%')
</if>
<if test="isbn!=null">
AND
B.ISBN LIKE CONCAT(#{isbn},'%')
</if>
<if test="name != null">
AND
(
(B.BOOK_NAME LIKE CONCAT('%', #{name}, '%') OR B.ISBN LIKE CONCAT(#{name},'%') OR A.BOOK_ID = #{name})
<if test="nameList != null and nameList.size > 0">
or
(
<foreach collection="nameList" close=" " separator=" and " open=" " item="item">
(B.BOOK_NAME LIKE CONCAT('%', #{item}, '%'))
</foreach>
)
</if>
)
</if>
<if test="isMainEditor != null">
AND
A.IS_MAIN_EDITOR = 1
</if>
<if test="isFundSupport != null">
AND (
BF.BOOK_FUND_ID IS NOT NULL
OR f.IS_FREEZE = 1
)
</if>
<if test="minimumSupport != null">
AND s.id is NOT NULL
</if>
<if test="templetId != null">
AND
A.TEMPLET_ID = #{templetId}
</if>
<if test="secondTempletIds!=null and secondTempletIds.size()>0">
AND
A.SECOND_TEMPLET_ID in
<foreach collection="secondTempletIds" item="item" open="(" separator="," close=")">
${item}
</foreach>
</if>
<if test="thirdTempletIds!=null and thirdTempletIds.size()>0">
AND
A.third_TEMPLET_ID in
<foreach collection="thirdTempletIds" item="item" open="(" separator="," close=")">
${item}
</foreach>
</if>
<if test="isbns != null">
AND
B.ISBN <![CDATA[ <> ]]> ${isbns}
</if>
<if test="bookStatus != null">
AND
I.book_status = #{bookStatus}
</if>
<if test="isPrint != null">
AND
A.IS_PRINT = #{isPrint}
</if>
<if test="isApproval != null">
AND A.is_approval = #{isApproval}
</if>
<if test="isRelate != null">
AND A.is_relate = #{isRelate}
</if>
<if test="bookIds != null">
<foreach collection="bookIds" index="index" item="item" open="and (" separator="or" close=")">
<if test="item.bookId != null and item.channelId != null">
A.BOOK_ID = ${item.bookId} AND A.CHANNEL_ID = ${item.channelId}
</if>
</foreach>
</if>
<if test="proLabelId != null">
AND A.pro_label_id = #{proLabelId}
</if>
<if test="depLabelId != null">
AND A.dep_label_id = #{depLabelId}
</if>
<if test="purLabelId != null">
AND A.pur_label_id = #{purLabelId}
</if>
<if test="areaLabelId != null">
AND A.AREA_LABEL_ID = #{areaLabelId}
</if>
<if test="graLabelId != null">
AND A.gra_label_id = #{graLabelId}
</if>
<if test="subLabelId != null">
AND A.sub_label_id = #{subLabelId}
</if>
<if test="verLabelId != null">
AND A.ver_label_id = #{verLabelId}
</if>
GROUP BY A.BOOK_ID, A.CHANNEL_ID)
union all(
SELECT
A.BOOK_ID, A.CHANNEL_ID, A.ADVISER_ID, A.IS_MAIN_EDITOR, T.TYPE_CODE, T.TYPE_NAME, B.ISBN, B.BOOK_NAME, B.REMARK,
B.AUTHOR, B.PUBLISH, B.PUBLISH_DATE, B.COVER_IMG, B.ORIGIN_NAME, B.BOOK_PRICE, B.ISSN, B.BOOK_NUM, B.SERIAL_NUMBER,
IF(ISNULL(BF.BOOK_FUND_ID),0,1) IS_FUND_SUPPORT,A.TEMPLET_ID, A.LAST_MODIFIED_DATE,
A.BOOK_ADVISER_ID,I.BOOK_STATUS, CONCAT('BK',A.BOOK_ID) uniqueNumber, if(G.ID IS NULL, 0, 1) isBookGroup, A.IS_PRINT isPrint,
G.id BOOK_GROUP_ID, G.group_qrcode_url groupQrcodeUrl,G.group_qrcode_name groupQrcodeName,A.is_approval, A.is_relate,
G.join_group_type,G.single_group singleGroup, G.related_book_group_id relatedBookGroupId,
IF(ISNULL(s.id),0,1) minimumSupport, A.is_open_catalog,a.CREATED_DATE,1 appointBook
FROM
BOOK_ADVISER A
INNER JOIN BOOK B ON A.BOOK_ID = B.BOOK_ID AND A.IS_DELETE = 0 AND B.IS_DELETE = 0
LEFT JOIN BOOK_TYPE T ON B.TYPE_CODE = T.TYPE_CODE
LEFT JOIN BOOK_FUND BF ON BF.BOOK_ID = A.BOOK_ID AND BF.END_TIME <![CDATA[ > ]]> NOW() AND BF.START_TIME <![CDATA[ < ]]> NOW()
LEFT JOIN book_auth_info I ON I.BOOK_ID = A.BOOK_ID
LEFT JOIN book_group G on G.BOOK_ID = A.BOOK_ID AND G.CHANNEL_ID = A.CHANNEL_ID AND G.CREATE_USER = A.ADVISER_ID AND G.IS_DELETE = 0
LEFT JOIN book_freeze f ON B.BOOK_ID = f.BOOK_ID
LEFT JOIN book_minimum_support s ON B.BOOK_ID=s.book_id AND s.end_time <![CDATA[ > ]]> NOW() AND s.start_time <![CDATA[ < ]]> NOW()
WHERE
A.BOOK_ID in
<foreach collection="selectBookIds" item="item" open="(" separator="," close=")">
${item}
</foreach>
<if test="bookId!=null">
AND
A.BOOK_ID = #{bookId}
</if>
<if test="typeCode!=null">
AND
B.TYPE_CODE = #{typeCode}
</if>
<if test="channelId!=null">
AND
A.CHANNEL_ID = #{channelId}
</if>
<if test="bookName!=null">
AND
B.BOOK_NAME LIKE CONCAT('%', #{bookName}, '%')
</if>
<if test="isbn!=null">
AND
B.ISBN LIKE CONCAT(#{isbn},'%')
</if>
<if test="name != null">
AND
(
(B.BOOK_NAME LIKE CONCAT('%', #{name}, '%') OR B.ISBN LIKE CONCAT(#{name},'%') OR A.BOOK_ID = #{name})
<if test="nameList != null and nameList.size > 0">
or
(
<foreach collection="nameList" close=" " separator=" and " open=" " item="item">
(B.BOOK_NAME LIKE CONCAT('%', #{item}, '%'))
</foreach>
)
</if>
)
</if>
<if test="isMainEditor != null">
AND
A.IS_MAIN_EDITOR = 1
</if>
<if test="isFundSupport != null">
AND (
BF.BOOK_FUND_ID IS NOT NULL
OR f.IS_FREEZE = 1
)
</if>
<if test="minimumSupport != null">
AND s.id is NOT NULL
</if>
<if test="templetId != null">
AND
A.TEMPLET_ID = #{templetId}
</if>
<if test="secondTempletIds!=null and secondTempletIds.size()>0">
AND
A.SECOND_TEMPLET_ID in
<foreach collection="secondTempletIds" item="item" open="(" separator="," close=")">
${item}
</foreach>
</if>
<if test="thirdTempletIds!=null and thirdTempletIds.size()>0">
AND
A.third_TEMPLET_ID in
<foreach collection="thirdTempletIds" item="item" open="(" separator="," close=")">
${item}
</foreach>
</if>
<if test="isbns != null">
AND
B.ISBN <![CDATA[ <> ]]> ${isbns}
</if>
<if test="bookStatus != null">
AND
I.book_status = #{bookStatus}
</if>
<if test="isPrint != null">
AND
A.IS_PRINT = #{isPrint}
</if>
<if test="isApproval != null">
AND A.is_approval = #{isApproval}
</if>
<if test="isRelate != null">
AND A.is_relate = #{isRelate}
</if>
<if test="bookIds != null">
<foreach collection="bookIds" index="index" item="item" open="and (" separator="or" close=")">
<if test="item.bookId != null and item.channelId != null">
A.BOOK_ID = ${item.bookId} AND A.CHANNEL_ID = ${item.channelId}
</if>
</foreach>
</if>
<if test="proLabelId != null">
AND A.pro_label_id = #{proLabelId}
</if>
<if test="depLabelId != null">
AND A.dep_label_id = #{depLabelId}
</if>
<if test="purLabelId != null">
AND A.pur_label_id = #{purLabelId}
</if>
<if test="areaLabelId != null">
AND A.AREA_LABEL_ID = #{areaLabelId}
</if>
<if test="graLabelId != null">
AND A.gra_label_id = #{graLabelId}
</if>
<if test="subLabelId != null">
AND A.sub_label_id = #{subLabelId}
</if>
<if test="verLabelId != null">
AND A.ver_label_id = #{verLabelId}
</if>
GROUP BY A.BOOK_ID, A.CHANNEL_ID
)
ORDER BY
LAST_MODIFIED_DATE DESC
<if test="num != null">
LIMIT ${num}
</if>
</select>
<select id="getBookCountByAdviserId" resultType="integer">
SELECT COUNT(1)
FROM
......@@ -3082,4 +3357,35 @@
book_id = #{isbnNumber}
and is_delete = 0
</select>
<select id="getAppointBooks" resultMap="bookMap" parameterType="map">
SELECT
A.BOOK_ID, A.CHANNEL_ID, A.ADVISER_ID, A.IS_MAIN_EDITOR, T.TYPE_CODE, T.TYPE_NAME, B.ISBN, B.BOOK_NAME, B.REMARK,
B.AUTHOR, B.PUBLISH, B.PUBLISH_DATE, B.COVER_IMG, B.ORIGIN_NAME, B.BOOK_PRICE, B.ISSN, B.BOOK_NUM, B.SERIAL_NUMBER,
IF(ISNULL(BF.BOOK_FUND_ID),0,1) IS_FUND_SUPPORT,A.TEMPLET_ID, A.LAST_MODIFIED_DATE,
A.BOOK_ADVISER_ID, CONCAT('BK',A.BOOK_ID) uniqueNumber, if(G.ID IS NULL, 0, 1) isBookGroup, A.IS_PRINT isPrint,
G.id BOOK_GROUP_ID, G.group_qrcode_url groupQrcodeUrl,G.group_qrcode_name groupQrcodeName,A.is_approval, A.is_relate,
G.join_group_type,G.single_group singleGroup, G.related_book_group_id relatedBookGroupId,
IF(ISNULL(s.id),0,1) minimumSupport, A.is_open_catalog,a.CREATED_DATE
FROM
BOOK_ADVISER A
INNER JOIN BOOK B ON A.BOOK_ID = B.BOOK_ID AND A.IS_DELETE = 0 AND B.IS_DELETE = 0
LEFT JOIN BOOK_TYPE T ON B.TYPE_CODE = T.TYPE_CODE
LEFT JOIN BOOK_FUND BF ON BF.BOOK_ID = A.BOOK_ID AND BF.END_TIME <![CDATA[ > ]]> NOW() AND BF.START_TIME <![CDATA[ < ]]> NOW()
LEFT JOIN book_group G on G.BOOK_ID = A.BOOK_ID AND G.CHANNEL_ID = A.CHANNEL_ID AND G.CREATE_USER = A.ADVISER_ID AND G.IS_DELETE = 0
LEFT JOIN book_freeze f ON B.BOOK_ID = f.BOOK_ID
LEFT JOIN book_minimum_support s ON B.BOOK_ID=s.book_id AND s.end_time <![CDATA[ > ]]> NOW() AND s.start_time <![CDATA[ < ]]> NOW()
WHERE
1=1
<if test="bookIds!=null and bookIds.size()>0">
AND
A.BOOK_ID in
<foreach collection="bookIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
GROUP BY A.BOOK_ID
ORDER BY
LAST_MODIFIED_DATE DESC
</select>
</mapper>
......@@ -1365,4 +1365,16 @@
limit 1
</select>
<select id="getSelfBookIds" parameterType="map" resultType="Long">
select distinct BOOK_ID
from book_adviser
where
adviser_id=#{adviserId}
and BOOK_ID in
<foreach collection="selectBookIds" separator="," open="(" close=")" index="index" item="item">
#{item}
</foreach>
and is_delete = 0
</select>
</mapper>
<?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.book.dao.impl.NoviceGuideDeleteDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.book.entity.NoviceGuideDelete">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="adviser_id" property="adviserId" jdbcType="BIGINT"/>
<result column="book_id" property="bookId" jdbcType="BIGINT"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id, adviser_id, book_id, create_time, update_time
</sql>
<select id="getById" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM novice_guide_delete
WHERE id = #{id}
</select>
<select id="getList" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM novice_guide_delete
</select>
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
INSERT INTO novice_guide_delete(
adviser_id,
book_id,
create_time,
update_time
) VALUES (
#{adviserId, jdbcType=BIGINT},
#{bookId, jdbcType=BIGINT},
now(),
now()
)
</insert>
<insert id="batchInsert" keyProperty="id" useGeneratedKeys="true">
INSERT INTO novice_guide_delete (
adviser_id,
book_id,
create_time,
update_time
) VALUES
<foreach collection="list" item="item" separator=",">
(
#{item.adviserId, jdbcType=BIGINT},
#{item.bookId, jdbcType=BIGINT},
now(),
now()
)
</foreach>
</insert>
<!--通过主键修改数据-->
<update id="update">
UPDATE novice_guide_delete
<set>
<if test="adviserId != null">
adviser_id = #{adviserId},
</if>
<if test="bookId != null">
book_id = #{bookId},
</if>
<if test="createTime != null">
create_time = #{createTime},
</if>
<if test="updateTime != null">
update_time = #{updateTime},
</if>
</set>
WHERE id = #{id}
</update>
<!--通过主键删除-->
<delete id="deleteById">
DELETE FROM novice_guide_delete WHERE id = #{id}
</delete>
<select id="getDeleteBookIds" parameterType="map" resultType="Long">
select distinct book_id
from novice_guide_delete
where adviser_id=#{adviserId}
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment