Commit b2c07c37 by 朱亚洁

feat:[none]馆配书

parent 5f570906
......@@ -74,7 +74,8 @@ public interface AppletBooklistBiz {
* @param numPerPage
* @return
*/
PageBeanNew<AppletBooklistDTO> listBooklist(Integer currentPage, Integer numPerPage, String name, Long classifyId, Long agentId);
PageBeanNew<AppletBooklistDTO> listBooklist(Integer currentPage, Integer numPerPage, String name, Long classifyId, Long agentId,
Long firstClassify,Long secondClassify,Long gradeLabelId, Long subjectLabelId);
/**
* 书单添加图书
......@@ -263,4 +264,21 @@ public interface AppletBooklistBiz {
* * @param null
*/
PageBeanNew<AppletOuterBookDTO> listPageOuterBookByBooklistId(Integer currentPage, Integer numPerPage, Long booklistId);
/**
* 根据书刊查询推荐书单列表
* @author:zhuyajie
* @date:2020/8/10 10:24
* * @param null
*/
List<AppletBooklistDTO> getRecommendBooklistByBook(Long bookId, Long adviserId, Long channelId);
/**
* 根据书刊分类自动创建书单
* @author:zhuyajie
* @date:2020/8/28 19:22
* * @param null
*/
void autoCreateBooklistByTemplet(Long firstClassify);
}
......@@ -22,13 +22,21 @@ import com.pcloud.book.applet.entity.AppletBooklistClassifyUser;
import com.pcloud.book.applet.entity.AppletOuterBook;
import com.pcloud.book.applet.entity.AppletOuterBooklist;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.book.biz.BookBiz;
import com.pcloud.book.book.dao.BookRaysClassifyDao;
import com.pcloud.book.book.biz.BookAdviserBiz;
import com.pcloud.book.book.dao.BookLabelDao;
import com.pcloud.book.book.dto.BookAdviserDto;
import com.pcloud.book.book.entity.BookLabel;
import com.pcloud.book.consumer.app.AssistTempletConsr;
import com.pcloud.book.consumer.user.AdviserConsr;
import com.pcloud.book.consumer.user.ChannelConsr;
import com.pcloud.book.util.properties.BookProps;
import com.pcloud.channelcenter.wechat.entity.AccountSetting;
import com.pcloud.book.es.biz.ESBookAndAdviserBiz;
import com.pcloud.book.es.entity.ESBookAndAdviser;
import com.pcloud.book.rightsSetting.biz.RightsSettingBiz;
import com.pcloud.book.rightsSetting.constants.RightsSettingConstant;
import com.pcloud.book.rightsSetting.entity.BaseTempletClassify;
import com.pcloud.book.util.properties.BookProps;
import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.page.PageParam;
import com.pcloud.common.utils.ListUtils;
......@@ -38,8 +46,10 @@ import com.pcloud.common.utils.string.StringUtil;
import com.pcloud.usercenter.party.adviser.dto.AdviserBaseInfoDto;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
......@@ -67,15 +77,19 @@ public class AppletBooklistBizImpl implements AppletBooklistBiz {
@Autowired
private AssistTempletConsr assistTempletConsr;
@Autowired
private BookBiz bookBiz;
@Autowired
private BookRaysClassifyDao bookRaysClassifyDao;
private RightsSettingBiz rightsSettingBiz;
@Autowired
private AppletNewsBiz appletNewsBiz;
@Autowired
private AppletOuterBookDao appletOuterBookDao;
@Autowired
private AppletOuterBooklistDao appletOuterBooklistDao;
@Autowired
private BookLabelDao bookLabelDao;
@Autowired
private BookAdviserBiz bookAdviserBiz;
@Autowired
private ESBookAndAdviserBiz esBookAndAdviserBiz;
@Override
......@@ -138,6 +152,7 @@ public class AppletBooklistBizImpl implements AppletBooklistBiz {
if (null==appletBooklist.getId()){
throw new BookBizException(BookBizException.PARAM_IS_NULL,"缺少id");
}
rightsSettingBiz.setClassifyAndLabel(appletBooklist);
appletBooklistDao.update(appletBooklist);
}
......@@ -152,27 +167,81 @@ public class AppletBooklistBizImpl implements AppletBooklistBiz {
}
@Override
public PageBeanNew<AppletBooklistDTO> listBooklist(Integer currentPage, Integer numPerPage, String name, Long classifyId, Long agentId) {
public PageBeanNew<AppletBooklistDTO> listBooklist(Integer currentPage, Integer numPerPage, String name, Long classifyId, Long agentId,
Long firstClassify,Long secondClassify,Long gradeLabelId, Long subjectLabelId) {
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("name", name);
paramMap.put("classifyId", classifyId);
paramMap.put("agentId", agentId);
if (null!=firstClassify){
BaseTempletClassify classify = new BaseTempletClassify();
classify.setFirstClassify(firstClassify);
classify.setSecondClassify(secondClassify);
classify.setGradeLabelId(gradeLabelId);
classify.setSubjectLabelId(subjectLabelId);
rightsSettingBiz.setClassifyAndLabel(classify);
paramMap.put("firstClassify", classify.getFirstClassify());
paramMap.put("secondClassify", classify.getSecondClassify());
paramMap.put("gradeLabelId", classify.getGradeLabelId());
paramMap.put("subjectLabelId", classify.getSubjectLabelId());
}else {
paramMap.put("gradeLabelId", gradeLabelId);
paramMap.put("subjectLabelId", subjectLabelId);
}
PageBeanNew<AppletBooklistDTO> pageBeanNew = appletBooklistDao.listPageNew(
new PageParam(currentPage,numPerPage), paramMap,"listBooklist");
if(null == pageBeanNew || ListUtils.isEmpty(pageBeanNew.getRecordList())){
return new PageBeanNew<>(currentPage,numPerPage,0,new ArrayList<>());
}
List<Long> booklistIds = pageBeanNew.getRecordList().stream().filter(s->s!=null).map(AppletBooklistDTO::getId).collect(Collectors.toList());
//填充书刊,分类,标签
List<Long> booklistIds = new ArrayList<>();
List<Long> classifyIds = new ArrayList<>();
List<Long> labelIds = new ArrayList<>();
for(AppletBooklistDTO appletBooklistDTO : pageBeanNew.getRecordList()){
booklistIds.add(appletBooklistDTO.getId());
if (null != appletBooklistDTO.getFirstClassify()){
classifyIds.add(appletBooklistDTO.getFirstClassify());
}
if (null != appletBooklistDTO.getSecondClassify()){
classifyIds.add(appletBooklistDTO.getSecondClassify());
}
if (null != appletBooklistDTO.getGradeLabelId()) {
labelIds.add(appletBooklistDTO.getGradeLabelId());
}
if (null != appletBooklistDTO.getSubjectLabelId()) {
labelIds.add(appletBooklistDTO.getSubjectLabelId());
}
}
List<BookDTO4Booklist> booklists = appletBooklistDao.getConfigByBooklistIds(booklistIds);
Map<Long,List<BookDTO4Booklist>> map = new HashMap<>();
if (!ListUtils.isEmpty(booklists)){
map = booklists.stream().collect(Collectors.groupingBy(BookDTO4Booklist::getBooklistId));
}
Map<Long, AssistTempletDTO> classifyMap = new HashMap<>();
Map<Long, BookLabel> labelMap= new HashMap<>();
if (!ListUtils.isEmpty(classifyIds)){
classifyMap = assistTempletConsr.mapByIds4Classify(classifyIds);
}
if (!ListUtils.isEmpty(labelIds)){
labelMap = bookLabelDao.getMapByIds(labelIds);
}
for (AppletBooklistDTO booklistDTO: pageBeanNew.getRecordList()){
if (!MapUtils.isEmpty(map) && map.containsKey(booklistDTO.getId())){
List<BookDTO4Booklist> bookDTO4Booklists = map.get(booklistDTO.getId());
booklistDTO.setBookDTO4Booklists(bookDTO4Booklists);
}
if (!MapUtils.isEmpty(classifyMap) && classifyMap.containsKey(booklistDTO.getFirstClassify())){
booklistDTO.setFirstClassifyContent(classifyMap.get(booklistDTO.getFirstClassify()).getTempletName());
}
if (!MapUtils.isEmpty(classifyMap) && classifyMap.containsKey(booklistDTO.getSecondClassify())){
booklistDTO.setSecondClassifyContent(classifyMap.get(booklistDTO.getSecondClassify()).getTempletName());
}
if (!MapUtils.isEmpty(labelMap) && labelMap.containsKey(booklistDTO.getGradeLabelId())){
booklistDTO.setGradeLabelIdContent(labelMap.get(booklistDTO.getGradeLabelId()).getName());
}
if (!MapUtils.isEmpty(labelMap) && labelMap.containsKey(booklistDTO.getSubjectLabelId())){
booklistDTO.setSubjectLabelIdContent(labelMap.get(booklistDTO.getSubjectLabelId()).getName());
}
}
return pageBeanNew;
}
......@@ -584,4 +653,108 @@ public class AppletBooklistBizImpl implements AppletBooklistBiz {
}
@Override
public List<AppletBooklistDTO> getRecommendBooklistByBook(Long bookId, Long adviserId, Long channelId) {
BookAdviserDto bookAdviserDto;
if (channelId != null && channelId>0 && adviserId != null && adviserId>0){
bookAdviserDto = bookAdviserBiz.getBase(bookId,channelId,adviserId);
}else {
bookAdviserDto = bookAdviserBiz.getOneMainBook(bookId);
}
if (null==bookAdviserDto){
return new ArrayList<>();
}
BaseTempletClassify classify = new BaseTempletClassify();
classify.setFirstClassify(bookAdviserDto.getTempletId());
classify.setSecondClassify(bookAdviserDto.getSecondTempletId());
classify.setGradeLabelId(bookAdviserDto.getGraLabelId());
classify.setSubjectLabelId(bookAdviserDto.getSubLabelId());
rightsSettingBiz.setClassifyAndLabel(classify);
List<AppletBooklistDTO> list = appletBooklistDao.getByLabel(classify.getFirstClassify(), classify.getSecondClassify(), classify.getGradeLabelId(), classify.getSubjectLabelId(), 3);
if (!ListUtils.isEmpty(list)){
//带3本书
for (AppletBooklistDTO booklistDTO : list) {
Long booklistId = booklistDTO.getId();
String key = AppletConstants.BOOKLIST_BOOK + booklistId;
List<BookDTO4Booklist> bookList = JedisClusterUtils.getJsonList(key, BookDTO4Booklist.class);
if (ListUtils.isEmpty(bookList)) {
bookList = appletBooklistDao.getBookBaseByBooklistId(booklistId, 0, 3);
JedisClusterUtils.setJson(key, bookList);
JedisClusterUtils.expire(key, 3600);
}
booklistDTO.setBookDTO4Booklists(bookList);
}
}
return list;
}
@Override
public void autoCreateBooklistByTemplet(Long firstClassify) {
Boolean contain4K12 = false;
if ("test".equals(BookProps.getSystemEnv()) && ArrayUtils
.contains(RightsSettingConstant.K12_TEMPLET_ID_TEST, firstClassify)) {
contain4K12 = true;
} else if (!"test".equals(BookProps.getSystemEnv()) && ArrayUtils
.contains(RightsSettingConstant.K12_TEMPLET_ID, firstClassify)) {
contain4K12 = true;
}
//K12
if (contain4K12){
List<BookLabel> gradeLabelList = bookLabelDao.getListByType(1);
List<BookLabel> subjectLabelList = bookLabelDao.getListByType(2);
for (BookLabel grade:gradeLabelList){
for (BookLabel subject:subjectLabelList){
this.autoCreateBooklist(Arrays.asList(firstClassify),new ArrayList<>(),Arrays.asList(grade.getId()),Arrays.asList(subject.getId()));
}
}
return;
}
//医疗保健
if (ArrayUtils.contains(RightsSettingConstant.MEDICAL_INSURANCE_TEMPLET_ID, firstClassify)) {
List<Long> secondList = assistTempletConsr.getChildIdListByParentId(firstClassify);
for (Long secondId:secondList){
this.autoCreateBooklist(Arrays.asList(firstClassify),Arrays.asList(secondId),new ArrayList<>(),new ArrayList<>());
}
return;
}
this.autoCreateBooklist(Arrays.asList(firstClassify),new ArrayList<>(),new ArrayList<>(),new ArrayList<>());
}
private void autoCreateBooklist(List<Long>templetIds, List<Long> secondTempletIds, List<Long> graLabelIds, List<Long> subLabelIds){
for (int i = 0; i < 3; i++) {
Page<ESBookAndAdviser> esPage = esBookAndAdviserBiz.getESAdviserBooks4Applet("1", null, templetIds, graLabelIds, subLabelIds, i, 20,secondTempletIds);
if (ListUtils.isEmpty(esPage.getContent())){
return;
}
AssistTempletDTO assistTempletDTO = assistTempletConsr.getTempletById(templetIds.get(0));
AppletBooklist appletBooklist = new AppletBooklist();
appletBooklist.setBooklistName(assistTempletDTO.getTempletName()+"推荐书单");
appletBooklist.setUserName("小编推荐");
appletBooklist.setFirstClassify(templetIds.get(0));
appletBooklist.setSecondClassify(ListUtils.isEmpty(secondTempletIds)?null:secondTempletIds.get(0));
appletBooklist.setGradeLabelId(ListUtils.isEmpty(graLabelIds)?null:graLabelIds.get(0));
appletBooklist.setSubjectLabelId(ListUtils.isEmpty(subLabelIds)?null:subLabelIds.get(0));
appletBooklist.setDigest((int) esPage.getTotalElements()+"本"+assistTempletDTO.getTempletName()+"书单推荐");
appletBooklist.setDisplayPic("https://oss.5rs.me/oss/uploadfe/png/39e36255426a66454037fcde86e19bf2.png");
appletBooklist.setClassifyId(1L);
appletBooklist.setIntroduceType(1);
appletBooklist.setIntroduceContent("<p>"+(int) esPage.getTotalElements()+"本"+assistTempletDTO.getTempletName()+"书单推荐</p>");
Long booklistId = addBooklist(appletBooklist);
List<BookDTO4Booklist> addList = new ArrayList<>();
for (ESBookAndAdviser esBookAndAdviser :esPage.getContent()){
BookDTO4Booklist booklist = new BookDTO4Booklist();
booklist.setBookId(Long.valueOf(esBookAndAdviser.getBookId()));
booklist.setAdviserId(Long.valueOf(esBookAndAdviser.getAdviserId()));
booklist.setChannelId(Long.valueOf(esBookAndAdviser.getChannelId()));
addList.add(booklist);
}
AddBookParamDTO addBookParamDTO = new AddBookParamDTO();
addBookParamDTO.setBooklistId(booklistId);
addBookParamDTO.setBookDTO4Booklists(addList);
this.addBookToBooklist(addBookParamDTO);
}
}
}
package com.pcloud.book.applet.dao;
import com.pcloud.book.applet.dto.AppletBooklistDTO;
import com.pcloud.book.applet.dto.BookDTO4Booklist;
import com.pcloud.book.applet.entity.AppletBooklist;
import com.pcloud.common.core.dao.BaseDao;
......@@ -65,4 +66,15 @@ public interface AppletBooklistDao extends BaseDao<AppletBooklist> {
* @return
*/
BookDTO4Booklist getByBookIdAdviserChannel(Long adviserId, Long channelId, Long bookId);
/**
* 根据分类查询书单
* @author:zhuyajie
* @date:2020/8/10 10:37
* * @param null
*/
List<AppletBooklistDTO> getByLabel(Long firstClassify, Long secondClassify, Long gradeLabelId, Long subjectLabelId, Integer limit);
}
package com.pcloud.book.applet.dao.impl;
import com.pcloud.book.applet.dao.AppletBooklistDao;
import com.pcloud.book.applet.dto.AppletBooklistDTO;
import com.pcloud.book.applet.dto.BookDTO4Booklist;
import com.pcloud.book.applet.entity.AppletBooklist;
import com.pcloud.common.core.dao.BaseDaoImpl;
......@@ -69,4 +70,16 @@ public class AppletBooklistDaoImpl extends BaseDaoImpl<AppletBooklist> implement
map.put("bookId", bookId);
return getSessionTemplate().selectOne(getStatement("getByBookIdAdviserChannel"),map);
}
@Override
public List<AppletBooklistDTO> getByLabel(Long firstClassify, Long secondClassify, Long gradeLabelId, Long subjectLabelId, Integer limit) {
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("firstClassify", firstClassify);
paramMap.put("secondClassify", secondClassify);
paramMap.put("gradeLabelId", gradeLabelId);
paramMap.put("subjectLabelId", subjectLabelId);
paramMap.put("limit", limit);
return getSessionTemplate().selectList(getStatement("getByLabel"), paramMap);
}
}
......@@ -46,4 +46,22 @@ public class AppletBooklistDTO extends BaseDto {
@ApiModelProperty("图书信息")
private List<BookDTO4Booklist> bookDTO4Booklists;
@ApiModelProperty("第一级类型标识")
private Long firstClassify;
@ApiModelProperty("第二级类型标识")
private Long secondClassify;
@ApiModelProperty("年级标签id")
private Long gradeLabelId;
@ApiModelProperty("科目标签id")
private Long subjectLabelId;
@ApiModelProperty("第一级类型")
private String firstClassifyContent;
@ApiModelProperty("第二级类型")
private String secondClassifyContent;
@ApiModelProperty("年级标签")
private String gradeLabelIdContent;
@ApiModelProperty("科目标签")
private String subjectLabelIdContent;
}
......@@ -56,4 +56,6 @@ public class BookDTO4Booklist extends BaseDto {
private Integer classifyId;
@ApiModelProperty("进群方式")
private Integer joinGroupType;
@ApiModelProperty("摘要")
private String remark;
}
package com.pcloud.book.applet.entity;
import com.pcloud.common.entity.BaseEntity;
import com.pcloud.book.rightsSetting.entity.BaseTempletClassify;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel("小程序书单")
public class AppletBooklist extends BaseEntity {
public class AppletBooklist extends BaseTempletClassify {
@ApiModelProperty("书单主题名称")
private String booklistName;
......@@ -32,4 +32,13 @@ public class AppletBooklist extends BaseEntity {
@ApiModelProperty("栏目id")
private Long classifyId;
@ApiModelProperty("第一级类型标识")
private Long firstClassify;
@ApiModelProperty("第二级类型标识")
private Long secondClassify;
@ApiModelProperty("年级标签id")
private Long gradeLabelId;
@ApiModelProperty("科目标签id")
private Long subjectLabelId;
}
......@@ -228,13 +228,19 @@ public class AppletHomeFacade {
@RequestParam("currentPage") @ApiParam("当前页") Integer currentPage,
@RequestParam("numPerPage") @ApiParam("每页数量") Integer numPerPage,
@RequestParam(value = "name", required = false) @ApiParam("名称查询") String name,
@RequestParam(value = "classifyId", required = false) @ApiParam("书单栏目id") Long classifyId) throws PermissionException {
Map<String, Object> map = SessionUtil.getToken4Redis(token);
Long agentId = (Long) map.get(SessionUtil.RAY_AGENT_ID);
@RequestParam(value = "classifyId", required = false) @ApiParam("书单栏目id") Long classifyId,
@RequestParam(value = "firstClassify", required = false) @ApiParam("一级书刊分类") Long firstClassify,
@RequestParam(value = "secondClassify", required = false) @ApiParam("二级书刊分类")Long secondClassify,
@RequestParam(value = "gradeLabelId", required = false) @ApiParam("年级标签")Long gradeLabelId,
@RequestParam(value = "subjectLabelId", required = false) @ApiParam("科目标签")Long subjectLabelId
) throws PermissionException {
Map<String, Object> map = SessionUtil.getToken4Redis(token);
Long agentId = (Long) map.get(SessionUtil.RAY_AGENT_ID);
if (null==currentPage || null == numPerPage){
throw new BookBizException(BookBizException.PARAM_IS_NULL,"缺少分页参数");
}
return new ResponseDto<>(appletBooklistBiz.listBooklist(currentPage, numPerPage, name, classifyId, agentId));
return new ResponseDto<>(appletBooklistBiz.listBooklist(currentPage, numPerPage, name, classifyId, agentId, firstClassify,secondClassify,
gradeLabelId,subjectLabelId));
}
@ApiOperation("书单添加图书")
......@@ -1103,6 +1109,27 @@ public class AppletHomeFacade {
Long agentId = (Long) SessionUtil.getVlaue(token, SessionUtil.RAY_AGENT_ID);
return new ResponseDto<>(appletStatisticBiz.getStatisticByAgent(agentId));
}
@ApiOperation("获取推荐书单")
@GetMapping("getRecommendBooklist")
public ResponseDto<?> getRecommendBooklist(
@RequestParam("bookId") Long bookId,
@RequestParam("adviserId") Long adviserId,
@RequestParam("channelId") Long channelId){
if (null == bookId || null == adviserId || null == channelId){
throw new BookBizException(BookBizException.PARAM_IS_NULL,"缺少参数");
}
return new ResponseDto<>(appletBooklistBiz.getRecommendBooklistByBook(bookId, adviserId, channelId));
}
@ApiOperation("根据书刊分类自动创建书单")
@GetMapping("autoCreateBooklistByTemplet")
public ResponseDto<?> autoCreateBooklistByTemplet(@RequestParam("firstClassify") Long firstClassify){
if (null != firstClassify){
appletBooklistBiz.autoCreateBooklistByTemplet(firstClassify);
}
return new ResponseDto<>();
}
}
......
......@@ -109,4 +109,16 @@ public class AssistTempletConsr {
}
return list;
}
@ParamLog("根据id查类型")
public AssistTempletDTO getTempletById(Long id){
AssistTempletDTO assistTempletDTO = null;
try {
assistTempletDTO = ResponseHandleUtil.parseResponse(assistTempletService.getById(id),AssistTempletDTO.class);
}catch (Exception e){
LOGGER.error("调用失败"+e.getMessage());
}
return assistTempletDTO;
}
}
......@@ -13,21 +13,27 @@
<result column="classify_id" property="classifyId" jdbcType="BIGINT" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
<result column="first_classify" property="firstClassify" jdbcType="BIGINT" />
<result column="second_classify" property="secondClassify" jdbcType="BIGINT" />
<result column="grade_label_id" property="gradeLabelId" jdbcType="BIGINT" />
<result column="subject_label_id" property="subjectLabelId" jdbcType="BIGINT" />
</resultMap>
<sql id="Base_Column_List" >
id, booklist_name, user_name, digest, display_pic, introduce_type, introduce_content, introduce_url,
classify_id, create_time, update_time
classify_id, create_time, update_time, first_classify, second_classify, grade_label_id, subject_label_id
</sql>
<insert id="insert" parameterType="com.pcloud.book.applet.entity.AppletBooklist" useGeneratedKeys="true" keyProperty="id">
insert into applet_booklist (
booklist_name, user_name, digest, display_pic, introduce_type, introduce_content, introduce_url,
classify_id, create_time, update_time
classify_id, create_time, update_time, first_classify, second_classify, grade_label_id, subject_label_id
)
values (
#{booklistName}, #{userName}, #{digest}, #{displayPic}, #{introduceType}, #{introduceContent}, #{introduceUrl},
#{classifyId}, NOW(), NOW()
#{classifyId}, NOW(), NOW(), #{firstClassify,jdbcType=BIGINT}, #{secondClassify,jdbcType=BIGINT},
#{gradeLabelId,jdbcType=BIGINT}, #{subjectLabelId,jdbcType=BIGINT}
)
</insert>
......@@ -58,6 +64,10 @@
<if test="classifyId != null">
classify_id = #{classifyId},
</if>
first_classify = #{firstClassify,jdbcType=BIGINT},
second_classify = #{secondClassify,jdbcType=BIGINT},
grade_label_id = #{gradeLabelId,jdbcType=BIGINT},
subject_label_id = #{subjectLabelId,jdbcType=BIGINT},
update_time=NOW()
</set>
where id = #{id,jdbcType=BIGINT}
......@@ -95,7 +105,11 @@
b.display_pic displayPic,
COUNT(c.id) bookCounts,
a.id classifyId,
a.classify_name classifyName
a.classify_name classifyName,
b.first_classify firstClassify,
b.second_classify secondClassify,
b.grade_label_id gradeLabelId,
b.subject_label_id subjectLabelId
FROM applet_booklist b
LEFT JOIN applet_booklist_config c ON b.id=c.booklist_id
LEFT JOIN applet_booklist_classify a ON b.classify_id=a.id
......@@ -106,6 +120,18 @@
<if test="classifyId >0">
AND b.classify_id= #{classifyId}
</if>
<if test="firstClassify!=null">
AND b.first_classify =#{firstClassify}
</if>
<if test="secondClassify!=null">
AND b.second_classify =#{secondClassify}
</if>
<if test="gradeLabelId != null">
AND b.grade_label_id = #{gradeLabelId}
</if>
<if test="subjectLabelId != null">
AND b.subject_label_id = #{subjectLabelId}
</if>
<choose>
<when test="agentId != null">
and a.agent_id = #{agentId}
......@@ -144,7 +170,8 @@
A.SECOND_TEMPLET_ID secondTempletId,
c.seq seq,
B.ISBN isbn,
CONCAT('BK',A.BOOK_ID) uniqueNumber
CONCAT('BK',A.BOOK_ID) uniqueNumber,
B.REMARK remark
FROM
applet_booklist_config c
LEFT JOIN applet_booklist ap ON c.booklist_id=ap.id
......@@ -236,4 +263,41 @@
AND A.ADVISER_ID=#{adviserId}
AND A.CHANNEL_ID=#{channelId}
</select>
<select id="getByLabel" parameterType="map" resultType="com.pcloud.book.applet.dto.AppletBooklistDTO">
SELECT
b.id id,
b.booklist_name booklistName,
b.user_name userName,
b.display_pic displayPic,
COUNT(c.id) bookCounts
FROM
applet_booklist b
LEFT JOIN applet_booklist_config c ON b.id = c.booklist_id
WHERE 1 = 1
<if test="firstClassify!=null">
AND b.first_classify =#{firstClassify}
</if>
<if test="secondClassify!=null">
AND b.second_classify =#{secondClassify}
</if>
<if test="gradeLabelId != null">
AND b.grade_label_id = #{gradeLabelId}
</if>
<if test="subjectLabelId != null">
AND b.subject_label_id = #{subjectLabelId}
</if>
GROUP BY
b.id
HAVING
COUNT(c.id) > 0
ORDER BY b.create_time DESC
<if test="limit != null">
LIMIT #{limit}
</if>
</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