Commit 8829304c by 田超

Merge branch 'feature/1002913' into 'master'

feat: [1002913] 资讯管理优化平行分类标签问题

See merge request rays/pcloud-book!886
parents 9033e9dd 5794ca48
...@@ -23,6 +23,13 @@ import java.util.Map; ...@@ -23,6 +23,13 @@ import java.util.Map;
public interface AppletNewsBiz { public interface AppletNewsBiz {
/** /**
* 删除咨询标签
* @param id 咨询标签唯一标识
* @return
*/
void deleteCategoryById(Long id);
/**
* 新增资讯分类 * 新增资讯分类
* @param appletNewsClassify * @param appletNewsClassify
* @return * @return
......
...@@ -8,11 +8,13 @@ import com.pcloud.book.applet.biz.AppletUserBookcaseBiz; ...@@ -8,11 +8,13 @@ import com.pcloud.book.applet.biz.AppletUserBookcaseBiz;
import com.pcloud.book.applet.contants.AppletConstants; import com.pcloud.book.applet.contants.AppletConstants;
import com.pcloud.book.applet.dao.AppletBusinessCardDao; import com.pcloud.book.applet.dao.AppletBusinessCardDao;
import com.pcloud.book.applet.dao.AppletLinkClickDao; import com.pcloud.book.applet.dao.AppletLinkClickDao;
import com.pcloud.book.applet.dao.AppletNewsCategoryDao;
import com.pcloud.book.applet.dao.AppletNewsClassifyDao; import com.pcloud.book.applet.dao.AppletNewsClassifyDao;
import com.pcloud.book.applet.dao.AppletNewsCommentDao; import com.pcloud.book.applet.dao.AppletNewsCommentDao;
import com.pcloud.book.applet.dao.AppletNewsDao; import com.pcloud.book.applet.dao.AppletNewsDao;
import com.pcloud.book.applet.dao.AppletNewsServeDao; import com.pcloud.book.applet.dao.AppletNewsServeDao;
import com.pcloud.book.applet.dao.AppletUserBookcaseDao; import com.pcloud.book.applet.dao.AppletUserBookcaseDao;
import com.pcloud.book.applet.dto.AppletNewsCategoryDTO;
import com.pcloud.book.applet.dto.AppletNewsClassifyDTO; import com.pcloud.book.applet.dto.AppletNewsClassifyDTO;
import com.pcloud.book.applet.dto.AppletNewsCommentDTO; import com.pcloud.book.applet.dto.AppletNewsCommentDTO;
import com.pcloud.book.applet.dto.AppletNewsCustomTagDTO; import com.pcloud.book.applet.dto.AppletNewsCustomTagDTO;
...@@ -23,6 +25,7 @@ import com.pcloud.book.applet.dto.PvuvDTO; ...@@ -23,6 +25,7 @@ import com.pcloud.book.applet.dto.PvuvDTO;
import com.pcloud.book.applet.entity.AppletBusinessCard; import com.pcloud.book.applet.entity.AppletBusinessCard;
import com.pcloud.book.applet.entity.AppletLinkClick; import com.pcloud.book.applet.entity.AppletLinkClick;
import com.pcloud.book.applet.entity.AppletNews; import com.pcloud.book.applet.entity.AppletNews;
import com.pcloud.book.applet.entity.AppletNewsCategory;
import com.pcloud.book.applet.entity.AppletNewsClassify; import com.pcloud.book.applet.entity.AppletNewsClassify;
import com.pcloud.book.applet.entity.AppletNewsClassifyUser; import com.pcloud.book.applet.entity.AppletNewsClassifyUser;
import com.pcloud.book.applet.entity.AppletNewsComment; import com.pcloud.book.applet.entity.AppletNewsComment;
...@@ -61,6 +64,7 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -61,6 +64,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
...@@ -103,6 +107,13 @@ public class AppletNewsBizImpl implements AppletNewsBiz { ...@@ -103,6 +107,13 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
private AppletUserBookcaseDao appletUserBookcaseDao; private AppletUserBookcaseDao appletUserBookcaseDao;
@Autowired @Autowired
private AppletBusinessCardDao appletBusinessCardDao; private AppletBusinessCardDao appletBusinessCardDao;
@Autowired
private AppletNewsCategoryDao appletNewsCategoryDao;
@Override
public void deleteCategoryById(Long id) {
appletNewsCategoryDao.deleteById(id);
}
@Override @Override
public Long addAppletNewsClassify(AppletNewsClassify appletNewsClassify) { public Long addAppletNewsClassify(AppletNewsClassify appletNewsClassify) {
...@@ -157,14 +168,31 @@ public class AppletNewsBizImpl implements AppletNewsBiz { ...@@ -157,14 +168,31 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
throw new BookBizException(BookBizException.PARAM_IS_NULL,"新增时栏目不能为空"); throw new BookBizException(BookBizException.PARAM_IS_NULL,"新增时栏目不能为空");
} }
appletNews.setShowState(false); appletNews.setShowState(false);
rightsSettingBiz.setClassifyAndLabel(appletNews); // rightsSettingBiz.setClassifyAndLabel(appletNews);
appletNewsDao.insert(appletNews); appletNewsDao.insert(appletNews);
//保存咨询类别
this.saveAppletNewsCategory(appletNews.getAppletNewsCategoryList(), appletNews.getId());
// 保存选取的服务 // 保存选取的服务
this.saveAppletNewsServe(appletNews.getAppletNewsServeList(), appletNews.getId()); this.saveAppletNewsServe(appletNews.getAppletNewsServeList(), appletNews.getId());
this.updateSource(null,appletNews.getSource()); this.updateSource(null,appletNews.getSource());
return appletNews.getId(); return appletNews.getId();
} }
private void saveAppletNewsCategory(List<AppletNewsCategory> categoryList, Long newsId) {
if (ListUtils.isEmpty(categoryList)) {
return;
}
appletNewsCategoryDao.deletebyNewsId(newsId);
for (AppletNewsCategory category : categoryList) {
rightsSettingBiz.setClassifyAndLabel(category);
category.setAppletNewId(newsId);
}
appletNewsCategoryDao.batchCreate(categoryList);
}
/** /**
* 保存选取的服务 * 保存选取的服务
* @param appletNewsServeList * @param appletNewsServeList
...@@ -231,7 +259,10 @@ public class AppletNewsBizImpl implements AppletNewsBiz { ...@@ -231,7 +259,10 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
rightsSettingBiz.setClassifyAndLabel(appletNews); rightsSettingBiz.setClassifyAndLabel(appletNews);
appletNewsDao.update(appletNews); appletNewsDao.update(appletNews);
this.saveAppletNewsServe(appletNews.getAppletNewsServeList(), appletNews.getId()); this.saveAppletNewsServe(appletNews.getAppletNewsServeList(), appletNews.getId());
this.updateSource(beforeNews.getSource(),appletNews.getSource()); this.updateSource(beforeNews.getSource(), appletNews.getSource());
//保存咨询分类
this.saveAppletNewsCategory(appletNews.getAppletNewsCategoryList(), appletNews.getId());
JedisClusterUtils.del(AppletConstants.HOME_NEWS_LIST); JedisClusterUtils.del(AppletConstants.HOME_NEWS_LIST);
} }
...@@ -281,11 +312,14 @@ public class AppletNewsBizImpl implements AppletNewsBiz { ...@@ -281,11 +312,14 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
} }
fillLabel(pageBeanNew.getRecordList()); fillLabel(pageBeanNew.getRecordList());
setLabelContent(pageBeanNew.getRecordList()); setLabelContent(pageBeanNew.getRecordList());
//填充咨询分类
fillCategory(pageBeanNew.getRecordList());
return pageBeanNew; return pageBeanNew;
} }
private void fillLabel(List<AppletNewsDTO> recordList) { private void fillLabel(List<AppletNewsDTO> recordList) {
if (ListUtils.isEmpty(recordList)){ if (ListUtils.isEmpty(recordList)) {
return; return;
} }
List<Long> labelIds = new ArrayList<>(); List<Long> labelIds = new ArrayList<>();
...@@ -505,13 +539,54 @@ public class AppletNewsBizImpl implements AppletNewsBiz { ...@@ -505,13 +539,54 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
this.fillBrowseCount(Lists.newArrayList(appletNewsDTO)); this.fillBrowseCount(Lists.newArrayList(appletNewsDTO));
fillLabel(Arrays.asList(appletNewsDTO)); fillLabel(Arrays.asList(appletNewsDTO));
//填充类别集合
fillCategory(Arrays.asList(appletNewsDTO));
fillBusinessCard(appletNewsDTO); fillBusinessCard(appletNewsDTO);
return appletNewsDTO; return appletNewsDTO;
} }
private void fillBusinessCard(AppletNewsDTO appletNewsDTO){ private void fillCategory(List<AppletNewsDTO> appletNewsDTOList) {
if(null != appletNewsDTO.getBusinessCardId()){ if(ListUtils.isEmpty(appletNewsDTOList)){
return;
}
for (AppletNewsDTO newsDTO : appletNewsDTOList) {
Long newsId = newsDTO.getId();
List<AppletNewsCategoryDTO> newsCategoryDTOList = appletNewsCategoryDao.getByNewsId(newsId);
if (ListUtils.isEmpty(newsCategoryDTOList)) {
return;
}
List<Long> firstClassifyIds = newsCategoryDTOList.stream().map(AppletNewsCategoryDTO::getFirstClassify)
.collect(
Collectors.toList());
List<Long> secondClassifyIds = newsCategoryDTOList.stream().map(AppletNewsCategoryDTO::getSecondClassify)
.collect(
Collectors.toList());
List<Long> classifyIds = firstClassifyIds;
classifyIds.addAll(secondClassifyIds);
classifyIds.removeAll(Collections.singleton(null));
Map<Long, AssistTempletDTO> classifyMap = assistTempletConsr.mapByIds4Classify(classifyIds);
for (AppletNewsCategoryDTO categoryDTO : newsCategoryDTOList) {
AssistTempletDTO templetDTO = classifyMap.get(categoryDTO.getFirstClassify());
if (templetDTO != null) {
categoryDTO.setFirstClassifyName(templetDTO.getTempletName());
}
templetDTO = classifyMap.get(categoryDTO.getSecondClassify());
if (templetDTO != null) {
categoryDTO.setSecondClassifyName(templetDTO.getTempletName());
}
}
newsDTO.setCategoryList(newsCategoryDTOList);
}
}
private void fillBusinessCard(AppletNewsDTO appletNewsDTO) {
if (null != appletNewsDTO.getBusinessCardId()) {
AppletBusinessCard appletBusinessCard = appletBusinessCardDao.getById(appletNewsDTO.getBusinessCardId()); AppletBusinessCard appletBusinessCard = appletBusinessCardDao.getById(appletNewsDTO.getBusinessCardId());
if (appletBusinessCard == null){ if (appletBusinessCard == null){
appletNewsDTO.setBusinessCardId(null); appletNewsDTO.setBusinessCardId(null);
...@@ -611,10 +686,15 @@ public class AppletNewsBizImpl implements AppletNewsBiz { ...@@ -611,10 +686,15 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
if(appletNewsClassifyVO == null || ListUtils.isEmpty(appletNewsClassifyVO.getAppletNewsIds())){ if(appletNewsClassifyVO == null || ListUtils.isEmpty(appletNewsClassifyVO.getAppletNewsIds())){
throw new BizException(BizException.PARAM_IS_NULL.getCode(), "参数为空"); throw new BizException(BizException.PARAM_IS_NULL.getCode(), "参数为空");
} }
if(!NumberUtil.isNumber(appletNewsClassifyVO.getFirstClassify()) ){ if (ListUtils.isEmpty(appletNewsClassifyVO.getCategoryDTOList())) {
throw new BizException(BizException.PARAM_IS_NULL.getCode(), "请选择一级分类"); throw new BizException(BizException.PARAM_IS_NULL.getCode(), "请选择分类");
} }
rightsSettingBiz.setClassifyAndLabel(appletNewsClassifyVO); rightsSettingBiz.setClassifyAndLabel(appletNewsClassifyVO);
for (Long id : appletNewsClassifyVO.getAppletNewsIds()){
this.saveAppletNewsCategory(appletNewsClassifyVO.getCategoryDTOList(), id);
}
appletNewsDao.batchUpdateClassify(appletNewsClassifyVO); appletNewsDao.batchUpdateClassify(appletNewsClassifyVO);
} }
...@@ -734,10 +814,13 @@ public class AppletNewsBizImpl implements AppletNewsBiz { ...@@ -734,10 +814,13 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
paramMap.put("source", source); paramMap.put("source", source);
PageBeanNew<AppletNewsDTO> pageBeanNew = appletNewsDao.listPageNew( PageBeanNew<AppletNewsDTO> pageBeanNew = appletNewsDao.listPageNew(
new PageParam(currentPage,numPerPage) ,paramMap,"listAppletNews4Analysis"); new PageParam(currentPage, numPerPage), paramMap, "listAppletNews4Analysis");
if (null == pageBeanNew || ListUtils.isEmpty(pageBeanNew.getRecordList())){
return new PageBeanNew<>(currentPage,numPerPage,0,new ArrayList<>()); if (null == pageBeanNew || ListUtils.isEmpty(pageBeanNew.getRecordList())) {
return new PageBeanNew<>(currentPage, numPerPage, 0, new ArrayList<>());
} }
fillCategory(pageBeanNew.getRecordList()); //填充咨询适用类别
setLabelContent(pageBeanNew.getRecordList()); setLabelContent(pageBeanNew.getRecordList());
fillStatistic(pageBeanNew.getRecordList(),browseQty,clickQty); fillStatistic(pageBeanNew.getRecordList(),browseQty,clickQty);
return pageBeanNew; return pageBeanNew;
......
package com.pcloud.book.applet.dao;
import java.util.List;
import com.pcloud.book.applet.dto.AppletNewsCategoryDTO;
import com.pcloud.book.applet.dto.AppletNewsClassifyDTO;
import com.pcloud.book.applet.entity.AppletNewsCategory;
import com.pcloud.book.applet.entity.AppletNewsClassify;
import com.pcloud.book.applet.entity.AppletNewsClassifyUser;
import com.pcloud.common.core.dao.BaseDao;
public interface AppletNewsCategoryDao extends BaseDao<AppletNewsCategory> {
void batchCreate(List<AppletNewsCategory> categoryList);
void deletebyNewsId(Long appletNewsId);
List<AppletNewsCategoryDTO> getByNewsId(Long appletNewsId);
}
package com.pcloud.book.applet.dao.impl;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.stereotype.Component;
import com.pcloud.book.applet.dao.AppletNewsCategoryDao;
import com.pcloud.book.applet.dao.AppletNewsClassifyDao;
import com.pcloud.book.applet.dto.AppletNewsCategoryDTO;
import com.pcloud.book.applet.dto.AppletNewsClassifyDTO;
import com.pcloud.book.applet.entity.AppletNewsCategory;
import com.pcloud.book.applet.entity.AppletNewsClassify;
import com.pcloud.book.applet.entity.AppletNewsClassifyUser;
import com.pcloud.common.core.dao.BaseDaoImpl;
@Component
public class AppletNewsCategoryDaoImpl extends BaseDaoImpl<AppletNewsCategory> implements AppletNewsCategoryDao {
@Override
public void batchCreate(List<AppletNewsCategory> categoryList) {
getSessionTemplate().insert(getStatement("batchCreate"), categoryList);
}
@Override
public void deletebyNewsId(Long appletNewsId) {
getSessionTemplate().delete(getStatement("deletebyNewsId"), appletNewsId);
}
@Override
public List<AppletNewsCategoryDTO> getByNewsId(Long appletNewsId) {
return getSessionTemplate().selectList(getStatement("getByNewsId"),appletNewsId);
}
}
package com.pcloud.book.applet.dto;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.pcloud.common.dto.BaseDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = true)
@Data
@ApiModel("小程序资讯类别")
public class AppletNewsCategoryDTO extends BaseDto {
@ApiModelProperty("主键")
private Long id;
@ApiModelProperty("第一级类型标识")
private Long firstClassify;
private String firstClassifyName;
@ApiModelProperty("第二级类型标识")
private Long secondClassify;
private String secondClassifyName;
@ApiModelProperty("年级标签id")
private Long gradeLabelId;
private String gradeLabelName;
@ApiModelProperty("科目标签id")
private Long subjectLabelId;
private String subjectLabelName;
}
...@@ -57,6 +57,12 @@ public class AppletNewsDTO extends BaseDto { ...@@ -57,6 +57,12 @@ public class AppletNewsDTO extends BaseDto {
) )
protected Date createTime; protected Date createTime;
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss",
timezone = "GMT+8"
)
protected Date updateTime;
@ApiModelProperty("第一级类型标识") @ApiModelProperty("第一级类型标识")
private Long firstClassify; private Long firstClassify;
@ApiModelProperty("第二级类型标识") @ApiModelProperty("第二级类型标识")
...@@ -123,4 +129,7 @@ public class AppletNewsDTO extends BaseDto { ...@@ -123,4 +129,7 @@ public class AppletNewsDTO extends BaseDto {
@ApiModelProperty("点击量pv") @ApiModelProperty("点击量pv")
private Integer clickCount; private Integer clickCount;
@ApiModelProperty("类别")
private List<AppletNewsCategoryDTO> categoryList;
} }
...@@ -101,4 +101,7 @@ public class AppletNews extends BaseTempletClassify { ...@@ -101,4 +101,7 @@ public class AppletNews extends BaseTempletClassify {
@ApiModelProperty("选取的服务") @ApiModelProperty("选取的服务")
List<AppletNewsServe> appletNewsServeList; List<AppletNewsServe> appletNewsServeList;
@ApiModelProperty("咨询类别")
List<AppletNewsCategory> appletNewsCategoryList;
} }
package com.pcloud.book.applet.entity;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;
import org.hibernate.validator.constraints.Length;
import com.pcloud.book.rightsSetting.entity.BaseTempletClassify;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel("小程序资讯类别")
public class AppletNewsCategory extends BaseTempletClassify {
@ApiModelProperty("主键")
private Long id;
@ApiModelProperty("咨询标签")
private Long appletNewId;
@ApiModelProperty("创建人")
private Long creator;
@ApiModelProperty("创建时间")
private Date createTime;
}
...@@ -99,6 +99,15 @@ public class AppletHomeFacade { ...@@ -99,6 +99,15 @@ public class AppletHomeFacade {
} }
@ApiOperation("删除咨询标签")
@PostMapping("deleteCategoryById")
public ResponseDto<?> deleteCategoryById(@RequestHeader("token") String token, @RequestParam("id") @ApiParam("咨询id") Long id) {
SessionUtil.getInfoToken4Redis(token);
appletNewsBiz.deleteCategoryById(id);
return new ResponseDto<>();
}
@ApiOperation("新增书单栏目") @ApiOperation("新增书单栏目")
@PostMapping("addBooklistClassify") @PostMapping("addBooklistClassify")
public ResponseDto<Long> addBooklistClassify( public ResponseDto<Long> addBooklistClassify(
......
package com.pcloud.book.applet.vo; package com.pcloud.book.applet.vo;
import com.pcloud.book.applet.dto.AppletNewsCategoryDTO;
import com.pcloud.book.applet.entity.AppletNewsCategory;
import com.pcloud.book.rightsSetting.entity.BaseTempletClassify; import com.pcloud.book.rightsSetting.entity.BaseTempletClassify;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable; import java.io.Serializable;
...@@ -25,4 +27,7 @@ public class AppletNewsClassifyVO extends BaseTempletClassify { ...@@ -25,4 +27,7 @@ public class AppletNewsClassifyVO extends BaseTempletClassify {
@ApiModelProperty("资讯栏目id") @ApiModelProperty("资讯栏目id")
private Long newsClassifyId; private Long newsClassifyId;
@ApiModelProperty("分类集合")
private List<AppletNewsCategory> categoryDTOList;
} }
...@@ -1710,7 +1710,8 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -1710,7 +1710,8 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
} }
// 填充群 // 填充群
List<RightsNowItem> items = new ArrayList<>(); List<RightsNowItem> items = new ArrayList<>();
List<GroupActivity4AppletDTO> collageList = supplementGroup(rightsSettingId, wechatUserId, rightsSettingItem.getRightsClassifyId(), top,items, bookId,rightsType); List<GroupActivity4AppletDTO> collageList = supplementGroup(rightsSettingId, wechatUserId, rightsSettingItem.getRightsClassifyId(), top,items, bookId,rightsType,
readType);
if (!ListUtils.isEmpty(collageList)){ if (!ListUtils.isEmpty(collageList)){
for (GroupActivity4AppletDTO item :collageList){ for (GroupActivity4AppletDTO item :collageList){
rightsSettingItem.getGroupActivity4AppletList().add(item); rightsSettingItem.getGroupActivity4AppletList().add(item);
...@@ -1978,7 +1979,7 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -1978,7 +1979,7 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
rightsSetting.setGroupServiceTitle(rightsSettingTitle); rightsSetting.setGroupServiceTitle(rightsSettingTitle);
} else { } else {
processNowItems4Group(rightsSettingTitle, nowItems, RightsNowItemTypeNew.GROUP_SERVICE, rightsSetting.getId(), wechatUserId, processNowItems4Group(rightsSettingTitle, nowItems, RightsNowItemTypeNew.GROUP_SERVICE, rightsSetting.getId(), wechatUserId,
Long.valueOf(RightsNowItemTypeNew.GROUP_SERVICE.value), BookConstant.MAX_NEWS_COUNT_GROUP, bookId); Long.valueOf(RightsNowItemTypeNew.GROUP_SERVICE.value), BookConstant.MAX_NEWS_COUNT_GROUP, bookId,readType);
rightsSetting.setGroupServiceTitle(rightsSettingTitle); rightsSetting.setGroupServiceTitle(rightsSettingTitle);
} }
...@@ -1988,7 +1989,7 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -1988,7 +1989,7 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
private void processNowItems4Group(RightsSettingTitle rightsSettingTitle, List<RightsNowItem> nowItems, RightsNowItemTypeNew itemType, private void processNowItems4Group(RightsSettingTitle rightsSettingTitle, List<RightsNowItem> nowItems, RightsNowItemTypeNew itemType,
Long rightsSettingId, Long wechatUserId, Long rightsClassifyId, Long rightsSettingId, Long wechatUserId, Long rightsClassifyId,
Integer top, Long bookId) { Integer top, Long bookId, Integer readType) {
if (null == rightsSettingTitle || null == rightsSettingTitle.getRightsSettingId()) { if (null == rightsSettingTitle || null == rightsSettingTitle.getRightsSettingId()) {
return; return;
} }
...@@ -1998,7 +1999,7 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -1998,7 +1999,7 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
if (CollectionUtils.isEmpty(nowItems) && rightsSettingTitle.getCollageState()!= null && rightsSettingTitle.getCollageState().intValue() == collage.intValue()) { if (CollectionUtils.isEmpty(nowItems) && rightsSettingTitle.getCollageState()!= null && rightsSettingTitle.getCollageState().intValue() == collage.intValue()) {
// 填充群 // 填充群
supplementGroup(rightsSettingId, wechatUserId, rightsClassifyId, top, items,bookId,null); supplementGroup(rightsSettingId, wechatUserId, rightsClassifyId, top, items,bookId,null,readType);
// 处理权益中的应用/作品 // 处理权益中的应用/作品
fillProductAndApp(items); fillProductAndApp(items);
rightsSettingTitle.setRightsSettingItemList(items); rightsSettingTitle.setRightsSettingItemList(items);
...@@ -2017,14 +2018,16 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -2017,14 +2018,16 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
if (items.size() < top && rightsSettingTitle.getCollageState()!= null && rightsSettingTitle.getCollageState().intValue() == collage.intValue()) { if (items.size() < top && rightsSettingTitle.getCollageState()!= null && rightsSettingTitle.getCollageState().intValue() == collage.intValue()) {
// 填充咨询 // 填充咨询
supplementGroup(rightsSettingId, wechatUserId, rightsClassifyId, top, items, bookId,null); supplementGroup(rightsSettingId, wechatUserId, rightsClassifyId, top, items, bookId,null, readType);
} }
// 处理权益中的应用/作品 // 处理权益中的应用/作品
fillProductAndApp(items); fillProductAndApp(items);
rightsSettingTitle.setRightsSettingItemList(items); rightsSettingTitle.setRightsSettingItemList(items);
} }
private List<GroupActivity4AppletDTO> supplementGroup(Long rightsSettingId, Long wechatUserId, Long rightsClassifyId, Integer top, List<RightsNowItem> items, Long bookId,String rightsType) { private List<GroupActivity4AppletDTO> supplementGroup(Long rightsSettingId, Long wechatUserId,
Long rightsClassifyId, Integer top, List<RightsNowItem> items, Long bookId, String rightsType,
Integer readType) {
// 书刊分类 // 书刊分类
List<GroupActivity4AppletDTO> groupActivity4AppletDTOList = null; List<GroupActivity4AppletDTO> groupActivity4AppletDTOList = null;
BookAdviserDto bookAdviserDto = bookAdviserBiz.getOneMainBook(bookId); BookAdviserDto bookAdviserDto = bookAdviserBiz.getOneMainBook(bookId);
...@@ -2062,7 +2065,7 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -2062,7 +2065,7 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
} }
} }
}else { //立享权益 }else { //立享权益
RightsSettingTitle rightsSettingTitle = rightsSettingTitleMapper.getByRightSettingIdAndType(rightsSettingId, 6,null); RightsSettingTitle rightsSettingTitle = rightsSettingTitleMapper.getByRightSettingIdAndType(rightsSettingId, RightsNowItemTypeNew.GROUP_SERVICE.value,readType);
// List<RightsSettingTitle> rightsSettingTitles = rightsSettingTitleMapper.getByRightSettingId(rightsSettingId, null); // List<RightsSettingTitle> rightsSettingTitles = rightsSettingTitleMapper.getByRightSettingId(rightsSettingId, null);
// Iterator<RightsSettingTitle> it = rightsSettingTitles.iterator(); // Iterator<RightsSettingTitle> it = rightsSettingTitles.iterator();
// while(it.hasNext()){ // while(it.hasNext()){
...@@ -2604,6 +2607,7 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -2604,6 +2607,7 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
map.put("rightsType", null); map.put("rightsType", null);
page = appletNewsDao.listPageNew(new PageParam(currentPage, numPerPage), map, "getPageByNewsByTempletLabel"); page = appletNewsDao.listPageNew(new PageParam(currentPage, numPerPage), map, "getPageByNewsByTempletLabel");
if (Objects.nonNull(page) && CollUtil.isNotEmpty(page.getRecordList())) { if (Objects.nonNull(page) && CollUtil.isNotEmpty(page.getRecordList())) {
appletNewsDTOS = page; appletNewsDTOS = page;
} }
} }
......
...@@ -34,10 +34,10 @@ ...@@ -34,10 +34,10 @@
<result column="business_card_isOpen" property="businessCardIsOpen" jdbcType="TINYINT" /> <result column="business_card_isOpen" property="businessCardIsOpen" jdbcType="TINYINT" />
</resultMap> </resultMap>
<sql id="Base_Column_List" > <sql id="Base_Column_List">
id, news_name, source, news_classify_id, pro_label_id, dep_label_id, pur_label_id, type, digest, news.id, news.news_name, news.source, news.news_classify_id, news.pro_label_id, news.dep_label_id, news.pur_label_id, news.type, news.digest,
pic1, pic2, pic3, content, show_state, create_time, update_time, first_classify, second_classify, grade_label_id, subject_label_id, rights_classify_id, pic1, pic2, pic3, news.content, show_state, news.create_time, news.update_time, news.first_classify, news.second_classify, news.grade_label_id, news.subject_label_id, news.rights_classify_id,
jump_type, jump_url, url_number, custom_tag_id, show_source, show_link,business_card_id,business_card_type,business_card_isOpen news.jump_type, news.jump_url, news.url_number, news.custom_tag_id, news.show_source, news.show_link,news.business_card_id,news.business_card_type,news.business_card_isOpen
</sql> </sql>
<insert id="insert" parameterType="com.pcloud.book.applet.entity.AppletNews" useGeneratedKeys="true" keyProperty="id"> <insert id="insert" parameterType="com.pcloud.book.applet.entity.AppletNews" useGeneratedKeys="true" keyProperty="id">
...@@ -106,20 +106,22 @@ ...@@ -106,20 +106,22 @@
<update id="updateNewsShowState" parameterType="com.pcloud.book.applet.entity.AppletNews"> <update id="updateNewsShowState" parameterType="com.pcloud.book.applet.entity.AppletNews">
update applet_news update applet_news
set show_state = #{showState,jdbcType=BOOLEAN} set show_state = #{showState,jdbcType=BOOLEAN},
update_time=NOW()
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
<update id="updateCardShowState" parameterType="com.pcloud.book.applet.entity.AppletNews"> <update id="updateCardShowState" parameterType="com.pcloud.book.applet.entity.AppletNews">
update applet_news update applet_news
set business_card_isOpen = #{businessCardIsOpen,jdbcType=TINYINT} set business_card_isOpen = #{businessCardIsOpen,jdbcType=TINYINT},
update_time=NOW()
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
<select id="getById" parameterType="long" resultMap="BaseResultMap"> <select id="getById" parameterType="long" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/> select <include refid="Base_Column_List"/>
from applet_news from applet_news news
where id=#{id} where news.id=#{id}
</select> </select>
<delete id="deleteById" parameterType="long"> <delete id="deleteById" parameterType="long">
...@@ -128,7 +130,7 @@ ...@@ -128,7 +130,7 @@
</delete> </delete>
<select id="listAppletNews" parameterType="map" resultType="com.pcloud.book.applet.dto.AppletNewsDTO"> <select id="listAppletNews" parameterType="map" resultType="com.pcloud.book.applet.dto.AppletNewsDTO">
SELECT SELECT DISTINCT
n.id, n.id,
n.news_name newsName, n.news_name newsName,
n.source, n.source,
...@@ -145,6 +147,7 @@ ...@@ -145,6 +147,7 @@
n.show_state showState, n.show_state showState,
c.news_classify newsClassify, c.news_classify newsClassify,
n.create_time createTime, n.create_time createTime,
n.update_time updateTime,
n.first_classify firstClassify, n.first_classify firstClassify,
n.second_classify secondClassify, n.second_classify secondClassify,
n.grade_label_id gradeLabelId, n.grade_label_id gradeLabelId,
...@@ -163,7 +166,8 @@ ...@@ -163,7 +166,8 @@
LEFT JOIN applet_news_classify c ON n.news_classify_id=c.id LEFT JOIN applet_news_classify c ON n.news_classify_id=c.id
LEFT JOIN rights_setting_classify d ON n.rights_classify_id = d.id LEFT JOIN rights_setting_classify d ON n.rights_classify_id = d.id
LEFT JOIN applet_news_custom_tag t ON n.custom_tag_id = t.id LEFT JOIN applet_news_custom_tag t ON n.custom_tag_id = t.id
WHERE 1=1 LEFT JOIN applet_news_category category on n.id = category.applet_news_id
WHERE 1=1
<if test="name != null"> <if test="name != null">
AND (n.news_name LIKE CONCAT("%",#{name},"%") OR n.url_number LIKE CONCAT("%",#{name},"%")) AND (n.news_name LIKE CONCAT("%",#{name},"%") OR n.url_number LIKE CONCAT("%",#{name},"%"))
</if> </if>
...@@ -174,16 +178,16 @@ ...@@ -174,16 +178,16 @@
AND n.show_state = #{showState} AND n.show_state = #{showState}
</if> </if>
<if test="firstClassify!=null"> <if test="firstClassify!=null">
AND n.first_classify =#{firstClassify} AND category.first_classify =#{firstClassify}
</if> </if>
<if test="secondClassify!=null"> <if test="secondClassify!=null">
AND n.second_classify =#{secondClassify} AND category.second_classify =#{secondClassify}
</if> </if>
<if test="gradeLabelId != null"> <if test="gradeLabelId != null">
AND n.grade_label_id = #{gradeLabelId} AND category.grade_label_id = #{gradeLabelId}
</if> </if>
<if test="subjectLabelId != null"> <if test="subjectLabelId != null">
AND n.subject_label_id = #{subjectLabelId} AND category.subject_label_id = #{subjectLabelId}
</if> </if>
<if test="rightsClassifyId!=null"> <if test="rightsClassifyId!=null">
AND n.rights_classify_id =#{rightsClassifyId} AND n.rights_classify_id =#{rightsClassifyId}
...@@ -194,7 +198,7 @@ ...@@ -194,7 +198,7 @@
<if test="customTagId != null"> <if test="customTagId != null">
AND n.custom_tag_id = #{customTagId} AND n.custom_tag_id = #{customTagId}
</if> </if>
ORDER BY n.create_time DESC ORDER BY n.update_time DESC
</select> </select>
<select id="getCountByBusinessCardId" parameterType="long" resultType="long"> <select id="getCountByBusinessCardId" parameterType="long" resultType="long">
...@@ -204,107 +208,106 @@ ...@@ -204,107 +208,106 @@
</select> </select>
<select id="getByNewsClassifyId" parameterType="long" resultMap="BaseResultMap"> <select id="getByNewsClassifyId" parameterType="long" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/> select
from applet_news <include refid="Base_Column_List"/>
where news_classify_id=#{newsClassifyId} from applet_news news
</select> where news.news_classify_id=#{newsClassifyId}
</select>
<select id="getByNewsByTempletLabel" parameterType="map" resultType="com.pcloud.book.applet.dto.AppletNewsDTO">
SELECT <select id="getByNewsByTempletLabel" parameterType="map" resultType="com.pcloud.book.applet.dto.AppletNewsDTO">
n.id, SELECT
n.news_name newsName, n.id,
n.source, n.news_name newsName,
n.news_classify_id newsClassifyId, n.source,
n.pro_label_id proLabelId, n.news_classify_id newsClassifyId,
n.dep_label_id depLabelId, n.pro_label_id proLabelId,
n.pur_label_id purLabelId, n.dep_label_id depLabelId,
n.type, n.pur_label_id purLabelId,
n.digest, n.type,
n.pic1, n.digest,
n.pic2, n.pic1,
n.pic3, n.pic2,
n.content, n.pic3,
n.show_state showState, n.content,
n.create_time createTime, n.show_state showState,
n.first_classify firstClassify, n.create_time createTime,
n.second_classify secondClassify, n.first_classify firstClassify,
n.grade_label_id gradeLabelId, n.second_classify secondClassify,
n.subject_label_id subjectLabelId, n.grade_label_id gradeLabelId,
n.rights_classify_id rightsClassifyId, n.subject_label_id subjectLabelId,
n.jump_type jumpType, n.rights_classify_id rightsClassifyId,
n.jump_url jumpUrl, n.jump_type jumpType,
n.url_number urlNumber, n.jump_url jumpUrl,
n.show_source showSource, n.url_number urlNumber,
n.show_link showLink n.show_source showSource,
FROM applet_news n n.show_link showLink
WHERE 1=1 FROM applet_news n
and n.show_state = 1 LEFT JOIN applet_news_category category on n.id = category.applet_news_id
<if test="firstClassify != null"> WHERE 1=1
and n.first_classify = #{firstClassify} and n.show_state = 1
</if> <if test="firstClassify != null">
<if test="secondClassify != null"> and category.first_classify = #{firstClassify}
and n.second_classify = #{secondClassify} </if>
</if> <if test="secondClassify != null">
<if test="gradeLabelId != null"> and category.second_classify = #{secondClassify}
and n.grade_label_id = #{gradeLabelId} </if>
</if> <if test="gradeLabelId != null">
<if test="subjectLabelId != null"> and category.grade_label_id = #{gradeLabelId}
and n.subject_label_id = #{subjectLabelId} </if>
</if> <if test="subjectLabelId != null">
AND n.rights_classify_id IN( and category.subject_label_id = #{subjectLabelId}
SELECT id FROM rights_setting_classify WHERE 1=1 </if>
<if test="rightsType != null" > AND n.rights_classify_id IN(
AND rights_type = #{rightsType} SELECT id FROM rights_setting_classify WHERE 1=1
</if> <if test="rightsType != null">
) AND rights_type = #{rightsType}
ORDER BY n.create_time DESC </if>
</select> )
ORDER BY n.update_time DESC
</select>
<select id="getByTempletAndClassify" parameterType="map" resultMap="BaseResultMap"> <select id="getByTempletAndClassify" parameterType="map" resultMap="BaseResultMap">
SELECT SELECT
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
FROM FROM
applet_news t applet_news news
WHERE LEFT JOIN applet_news_category category on news.id = category.applet_news_id
t.show_state = 1 WHERE
<if test="firstClassify!=null"> news.show_state = 1
AND t.first_classify =#{firstClassify} <if test="firstClassify!=null">
</if> AND category.first_classify =#{firstClassify}
<if test="secondClassify!=null"> </if>
AND t.second_classify =#{secondClassify} <if test="secondClassify!=null">
</if> AND category.second_classify =#{secondClassify}
<if test="gradeLabelId != null"> </if>
AND t.grade_label_id = #{gradeLabelId} <if test="gradeLabelId != null">
</if> AND category.grade_label_id = #{gradeLabelId}
<if test="subjectLabelId != null"> </if>
AND t.subject_label_id = #{subjectLabelId} <if test="subjectLabelId != null">
</if> AND category.subject_label_id = #{subjectLabelId}
<if test="rightsClassifyId!=null"> </if>
AND t.rights_classify_id =#{rightsClassifyId} <if test="rightsClassifyId!=null">
</if> AND news.rights_classify_id =#{rightsClassifyId}
ORDER BY </if>
t.create_time DESC ORDER BY
LIMIT #{top} news.update_time DESC
</select> LIMIT #{top}
</select>
<update id="batchUpdateClassify" parameterType="map">
UPDATE applet_news <update id="batchUpdateClassify" parameterType="map">
SET UPDATE applet_news
first_classify = #{firstClassify,jdbcType=BIGINT}, SET
second_classify = #{secondClassify,jdbcType=BIGINT}, rights_classify_id = #{rightsClassifyId,jdbcType=BIGINT},
grade_label_id = #{gradeLabelId,jdbcType=BIGINT}, <if test="newsClassifyId != null">
subject_label_id = #{subjectLabelId,jdbcType=BIGINT}, news_classify_id = #{newsClassifyId},
rights_classify_id = #{rightsClassifyId,jdbcType=BIGINT}, </if>
<if test="newsClassifyId != null"> update_time=NOW()
news_classify_id = #{newsClassifyId}, WHERE id IN
</if> <foreach collection="ids" item="item" separator="," open="(" close=")">
update_time=NOW() ${item}
WHERE id IN </foreach>
<foreach collection="ids" item="item" separator="," open="(" close=")" > </update>
${item}
</foreach>
</update>
<update id="batchUpdateShowState" parameterType="map"> <update id="batchUpdateShowState" parameterType="map">
UPDATE applet_news UPDATE applet_news
...@@ -379,65 +382,66 @@ ...@@ -379,65 +382,66 @@
) )
</select> </select>
<select id="listAppletNews4Analysis" parameterType="map" resultType="com.pcloud.book.applet.dto.AppletNewsDTO"> <select id="listAppletNews4Analysis" parameterType="map" resultType="com.pcloud.book.applet.dto.AppletNewsDTO">
SELECT SELECT DISTINCT
n.id, n.id,
n.news_name newsName, n.news_name newsName,
n.source, n.source,
n.news_classify_id newsClassifyId, n.news_classify_id newsClassifyId,
n.pro_label_id proLabelId, n.pro_label_id proLabelId,
n.dep_label_id depLabelId, n.dep_label_id depLabelId,
n.pur_label_id purLabelId, n.pur_label_id purLabelId,
n.type, n.type,
n.digest, n.digest,
n.pic1, n.pic1,
n.pic2, n.pic2,
n.pic3, n.pic3,
n.content, n.content,
n.show_state showState, n.show_state showState,
c.news_classify newsClassify, c.news_classify newsClassify,
n.create_time createTime, n.create_time createTime,
n.first_classify firstClassify, n.first_classify firstClassify,
n.second_classify secondClassify, n.second_classify secondClassify,
n.grade_label_id gradeLabelId, n.grade_label_id gradeLabelId,
n.subject_label_id subjectLabelId, n.subject_label_id subjectLabelId,
n.rights_classify_id rightsClassifyId, n.rights_classify_id rightsClassifyId,
d.classify rightsClassifyContent, d.classify rightsClassifyContent,
n.jump_type jumpType, n.jump_type jumpType,
n.jump_url jumpUrl, n.jump_url jumpUrl,
n.url_number urlNumber, n.url_number urlNumber,
n.show_source showSource, n.show_source showSource,
n.show_link showLink n.show_link showLink
FROM applet_news n FROM applet_news n
LEFT JOIN applet_news_classify c ON n.news_classify_id=c.id LEFT JOIN applet_news_classify c ON n.news_classify_id=c.id
LEFT JOIN rights_setting_classify d ON n.rights_classify_id = d.id LEFT JOIN rights_setting_classify d ON n.rights_classify_id = d.id
WHERE 1=1 LEFT JOIN applet_news_category category on n.id = category.applet_news_id
<if test="name != null"> WHERE 1=1
AND (n.news_name LIKE CONCAT("%",#{name},"%") or n.url_number LIKE CONCAT("%",#{name},"%")) <if test="name != null">
</if> AND (n.news_name LIKE CONCAT("%",#{name},"%") or n.url_number LIKE CONCAT("%",#{name},"%"))
<if test="firstClassify!=null"> </if>
AND n.first_classify =#{firstClassify} <if test="firstClassify!=null">
</if> AND category.first_classify =#{firstClassify}
<if test="secondClassify!=null"> </if>
AND n.second_classify =#{secondClassify} <if test="secondClassify!=null">
</if> AND category.second_classify =#{secondClassify}
<if test="gradeLabelId != null"> </if>
AND n.grade_label_id = #{gradeLabelId} <if test="gradeLabelId != null">
</if> AND category.grade_label_id = #{gradeLabelId}
<if test="subjectLabelId != null"> </if>
AND n.subject_label_id = #{subjectLabelId} <if test="subjectLabelId != null">
</if> AND category.subject_label_id = #{subjectLabelId}
<if test="linkOnly == 1"> </if>
and n.jump_type = 2 <if test="linkOnly == 1">
</if> and n.jump_type = 2
<if test="rightsClassifyId!=null"> </if>
AND n.rights_classify_id =#{rightsClassifyId} <if test="rightsClassifyId!=null">
</if> AND n.rights_classify_id =#{rightsClassifyId}
<if test="source!=null"> </if>
AND n.source =#{source} <if test="source!=null">
</if> AND n.source =#{source}
ORDER BY n.create_time DESC </if>
</select> ORDER BY n.update_time DESC
</select>
<select id="getByIds" resultType="com.pcloud.book.applet.dto.AppletNewsDTO"> <select id="getByIds" resultType="com.pcloud.book.applet.dto.AppletNewsDTO">
SELECT SELECT
...@@ -471,7 +475,7 @@ ...@@ -471,7 +475,7 @@
<foreach collection="list" item="item" separator="," open="(" close=")" > <foreach collection="list" item="item" separator="," open="(" close=")" >
${item} ${item}
</foreach> </foreach>
ORDER BY n.create_time DESC ORDER BY n.update_time DESC
</select> </select>
...@@ -525,7 +529,7 @@ ...@@ -525,7 +529,7 @@
ORDER BY RAND() ORDER BY RAND()
</when> </when>
<otherwise> <otherwise>
ORDER BY n.create_time DESC ORDER BY n.update_time DESC
</otherwise> </otherwise>
</choose> </choose>
</select> </select>
...@@ -587,56 +591,57 @@ ...@@ -587,56 +591,57 @@
ORDER BY create_time DESC ORDER BY create_time DESC
</select> </select>
<select id="getPageByNewsByTempletLabel" parameterType="map" resultType="com.pcloud.book.applet.dto.AppletNewsDTO"> <select id="getPageByNewsByTempletLabel" parameterType="map" resultType="com.pcloud.book.applet.dto.AppletNewsDTO">
SELECT SELECT DISTINCT
n.id, n.id,
n.news_name newsName, n.news_name newsName,
n.source, n.source,
n.news_classify_id newsClassifyId, n.news_classify_id newsClassifyId,
n.pro_label_id proLabelId, n.pro_label_id proLabelId,
n.dep_label_id depLabelId, n.dep_label_id depLabelId,
n.pur_label_id purLabelId, n.pur_label_id purLabelId,
n.type, n.type,
n.digest, n.digest,
n.pic1, n.pic1,
n.pic2, n.pic2,
n.pic3, n.pic3,
n.content, n.content,
n.show_state showState, n.show_state showState,
n.create_time createTime, n.create_time createTime,
n.first_classify firstClassify, n.first_classify firstClassify,
n.second_classify secondClassify, n.second_classify secondClassify,
n.grade_label_id gradeLabelId, n.grade_label_id gradeLabelId,
n.subject_label_id subjectLabelId, n.subject_label_id subjectLabelId,
n.rights_classify_id rightsClassifyId, n.rights_classify_id rightsClassifyId,
n.jump_type jumpType, n.jump_type jumpType,
n.jump_url jumpUrl, n.jump_url jumpUrl,
n.url_number urlNumber, n.url_number urlNumber,
n.show_source showSource, n.show_source showSource,
n.show_link showLink n.show_link showLink
FROM applet_news n FROM applet_news n
WHERE 1=1 LEFT JOIN applet_news_category category on n.id = category.applet_news_id
and n.show_state = 1 WHERE 1=1
<if test="firstClassify != null"> and n.show_state = 1
and n.first_classify = #{firstClassify} <if test="firstClassify != null">
</if> and category.first_classify = #{firstClassify}
<if test="secondClassify != null"> </if>
and n.second_classify = #{secondClassify} <if test="secondClassify != null">
</if> and category.second_classify = #{secondClassify}
<if test="gradeLabelId != null"> </if>
and n.grade_label_id = #{gradeLabelId} <if test="gradeLabelId != null">
</if> and category.grade_label_id = #{gradeLabelId}
<if test="subjectLabelId != null"> </if>
and n.subject_label_id = #{subjectLabelId} <if test="subjectLabelId != null">
</if> and category.subject_label_id = #{subjectLabelId}
AND n.rights_classify_id IN( </if>
SELECT id FROM rights_setting_classify WHERE 1=1 AND n.rights_classify_id IN(
<if test="rightsType != null" > SELECT id FROM rights_setting_classify WHERE 1=1
AND rights_type = #{rightsType} <if test="rightsType != null">
</if> AND rights_type = #{rightsType}
) </if>
ORDER BY n.create_time DESC )
</select> ORDER BY n.update_time DESC
</select>
<select id="getClassifyNewsByTempletLabel" parameterType="map" resultType="com.pcloud.book.applet.dto.AppletNewsDTO"> <select id="getClassifyNewsByTempletLabel" parameterType="map" resultType="com.pcloud.book.applet.dto.AppletNewsDTO">
SELECT SELECT
...@@ -693,7 +698,7 @@ ...@@ -693,7 +698,7 @@
<if test="efficientRead!=null"> <if test="efficientRead!=null">
AND i.efficient_read = #{efficientRead} AND i.efficient_read = #{efficientRead}
</if> </if>
ORDER BY n.create_time DESC ORDER BY n.update_time DESC
</select> </select>
<insert id="batchInsert" parameterType="com.pcloud.book.applet.entity.AppletNews" useGeneratedKeys="true" <insert id="batchInsert" parameterType="com.pcloud.book.applet.entity.AppletNews" useGeneratedKeys="true"
......
<?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.AppletNewsCategoryDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.applet.entity.AppletNewsCategory">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="applet_news_id" property="appletNewId" jdbcType="BIGINT"/>
<result column="creator" property="creator" jdbcType="BIGINT"/>
<result column="create_time" property="createTime" 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, applet_news_id, creator, create_time, first_classify,second_classify, grade_label_id, subject_label_id
</sql>
<insert id="insert" parameterType="com.pcloud.book.applet.entity.AppletNewsCategory" useGeneratedKeys="true"
keyProperty="id">
insert into applet_news_category (
applet_news_id, creator, create_time, first_classify,second_classify, grade_label_id, subject_label_id
)
values (
#{appletNewId}, #{creator}, NOW(), #{firstClassify}, #{secondClassify}, #{gradeLabelId}, #{subjectLabelId}
)
</insert>
<insert id="batchCreate" parameterType="list" keyProperty="id" useGeneratedKeys="true">
insert into applet_news_category (
applet_news_id, creator, create_time, first_classify,second_classify, grade_label_id, subject_label_id)
values
<foreach collection="list" item="item" index="index" separator=",">
( #{item.appletNewId}, #{item.creator}, NOW(), #{item.firstClassify}, #{item.secondClassify},
#{item.gradeLabelId}, #{item.subjectLabelId} )
</foreach>
</insert>
<update id="update" parameterType="com.pcloud.book.applet.entity.AppletNewsCategory">
update applet_news_category
<set>
<if test="firstClassify != null">
first_classify = #{firstClassify,jdbcType=BIGINT},
</if>
<if test="secondClassify != null">
second_classify = #{secondClassify,jdbcType=BIGINT},
</if>
<if test="gradeLabelId != null">
grade_label_id = #{gradeLabelId,jdbcType=BIGINT},
</if>
<if test="subjectLabelId != null">
subject_label_id = #{subjectLabelId,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<select id="getByNewsId" parameterType="long" resultType="com.pcloud.book.applet.dto.AppletNewsCategoryDTO">
select
category.id,
category.applet_news_id,
category.first_classify firstClassify,
category.second_classify secondClassify,
category.grade_label_id gradeLabelId,
category.subject_label_id subjectLabelId,
label.name gradeLabelName,
label2.name subjectLabelName
from applet_news_category category
LEFT JOIN book_label label ON category.grade_label_id = label.id
LEFT JOIN book_label label2 ON category.subject_label_id = label2.id
where applet_news_id=#{appletNewId}
</select>
<delete id="deleteById" parameterType="long">
delete from applet_news_category
where id=#{id}
</delete>
<delete id="deletebyNewsId" parameterType="long">
DELETE FROM applet_news_category
WHERE applet_news_id = #{appletNewId}
</delete>
</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