Commit 46a76d5c by 朱亚洁

feat: [1003013] 资讯按周的批处理自定义标识

parent da6ff57f
...@@ -2,12 +2,14 @@ package com.pcloud.book.applet.biz; ...@@ -2,12 +2,14 @@ package com.pcloud.book.applet.biz;
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.AppletNewsDTO; import com.pcloud.book.applet.dto.AppletNewsDTO;
import com.pcloud.book.applet.dto.AppletNewsVO; import com.pcloud.book.applet.dto.AppletNewsVO;
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.AppletNewsClassify; import com.pcloud.book.applet.entity.AppletNewsClassify;
import com.pcloud.book.applet.entity.AppletNewsComment; import com.pcloud.book.applet.entity.AppletNewsComment;
import com.pcloud.book.applet.entity.AppletNewsCustomTag;
import com.pcloud.book.applet.vo.AppletNewsClassifyVO; import com.pcloud.book.applet.vo.AppletNewsClassifyVO;
import com.pcloud.book.applet.vo.AppletNewsShowStateVO; import com.pcloud.book.applet.vo.AppletNewsShowStateVO;
import com.pcloud.common.page.PageBeanNew; import com.pcloud.common.page.PageBeanNew;
...@@ -75,7 +77,8 @@ public interface AppletNewsBiz { ...@@ -75,7 +77,8 @@ public interface AppletNewsBiz {
*/ */
PageBeanNew<AppletNewsDTO> listAppletNews(Integer currentPage, Integer numPerPage, String name, PageBeanNew<AppletNewsDTO> listAppletNews(Integer currentPage, Integer numPerPage, String name,
Long firstClassify,Long secondClassify,Long gradeLabelId, Long firstClassify,Long secondClassify,Long gradeLabelId,
Long subjectLabelId,Long rightsClassifyId,String source,Integer showState, Long newsClassifyId); Long subjectLabelId,Long rightsClassifyId,String source,Integer showState, Long newsClassifyId,
Long customTagId);
/** /**
* 获取所有资讯栏目 * 获取所有资讯栏目
...@@ -218,4 +221,40 @@ public interface AppletNewsBiz { ...@@ -218,4 +221,40 @@ public interface AppletNewsBiz {
* * @param null * * @param null
*/ */
void batchUpdateNewsClassify(AppletNewsClassifyVO appletNewsClassifyVO); void batchUpdateNewsClassify(AppletNewsClassifyVO appletNewsClassifyVO);
/**
* 批量更新自定义标识
* @author:zhuyajie
* @date:2020/6/9 17:52
* * @param null
*/
void batchUpdateCustomTagId(List<Long> ids, Long customTagId, String customTag);
/**
* 新增自定义标识
* @author:zhuyajie
* @date:2020/6/9 17:52
* * @param null
*/
Long insertCustomTag(AppletNewsCustomTag appletNewsCustomTag);
/**
* 修改自定义标识
* @author:zhuyajie
* @date:2020/6/9 17:52
* * @param null
*/
void updateCustomTag(AppletNewsCustomTag appletNewsCustomTag);
/**
* 自定义标识列表
* @author:zhuyajie
* @date:2020/6/9 17:52
* * @param null
*/
List<AppletNewsCustomTagDTO> getCustomTagList();
/**
* 根据标识id查资讯id列表
* @author:zhuyajie
* @date:2020/6/10 17:39
* * @param null
*/
List<Long> getNewsIdListByCustomTagId(Long customTagId);
} }
...@@ -9,6 +9,7 @@ import com.pcloud.book.applet.dao.AppletNewsCommentDao; ...@@ -9,6 +9,7 @@ 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.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.AppletNewsDTO; import com.pcloud.book.applet.dto.AppletNewsDTO;
import com.pcloud.book.applet.dto.AppletNewsVO; import com.pcloud.book.applet.dto.AppletNewsVO;
import com.pcloud.book.applet.dto.PvuvDTO; import com.pcloud.book.applet.dto.PvuvDTO;
...@@ -17,9 +18,9 @@ import com.pcloud.book.applet.entity.AppletNews; ...@@ -17,9 +18,9 @@ import com.pcloud.book.applet.entity.AppletNews;
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;
import com.pcloud.book.applet.entity.AppletNewsCustomTag;
import com.pcloud.book.applet.enums.DataRecordTypeEnum; import com.pcloud.book.applet.enums.DataRecordTypeEnum;
import com.pcloud.book.applet.enums.DataTypeEnum; import com.pcloud.book.applet.enums.DataTypeEnum;
import com.pcloud.book.applet.enums.IntroduceTypeEnum;
import com.pcloud.book.applet.vo.AppletNewsClassifyVO; import com.pcloud.book.applet.vo.AppletNewsClassifyVO;
import com.pcloud.book.applet.vo.AppletNewsShowStateVO; import com.pcloud.book.applet.vo.AppletNewsShowStateVO;
import com.pcloud.book.base.exception.BookBizException; import com.pcloud.book.base.exception.BookBizException;
...@@ -154,13 +155,15 @@ public class AppletNewsBizImpl implements AppletNewsBiz { ...@@ -154,13 +155,15 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
@Override @Override
public PageBeanNew<AppletNewsDTO> listAppletNews(Integer currentPage, Integer numPerPage, String name, public PageBeanNew<AppletNewsDTO> listAppletNews(Integer currentPage, Integer numPerPage, String name,
Long firstClassify,Long secondClassify,Long gradeLabelId, Long firstClassify,Long secondClassify,Long gradeLabelId,
Long subjectLabelId,Long rightsClassifyId,String source,Integer showState, Long newsClassifyId) { Long subjectLabelId,Long rightsClassifyId,String source,Integer showState, Long newsClassifyId,
Long customTagId) {
Map<String, Object> paramMap = new HashMap<>(); Map<String, Object> paramMap = new HashMap<>();
paramMap.put("name", name); paramMap.put("name", name);
paramMap.put("rightsClassifyId", rightsClassifyId); paramMap.put("rightsClassifyId", rightsClassifyId);
paramMap.put("source", source); paramMap.put("source", source);
paramMap.put("showState", showState); paramMap.put("showState", showState);
paramMap.put("newsClassifyId", newsClassifyId); paramMap.put("newsClassifyId", newsClassifyId);
paramMap.put("customTagId", customTagId);
//处理分类 //处理分类
if (null!=firstClassify){ if (null!=firstClassify){
BaseTempletClassify classify = new BaseTempletClassify(); BaseTempletClassify classify = new BaseTempletClassify();
...@@ -615,4 +618,50 @@ public class AppletNewsBizImpl implements AppletNewsBiz { ...@@ -615,4 +618,50 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
appletNewsDao.batchUpdateNewsClassify(appletNewsClassifyVO); appletNewsDao.batchUpdateNewsClassify(appletNewsClassifyVO);
} }
@Override
public void batchUpdateCustomTagId(List<Long> ids, Long customTagId, String customTag) {
if (ListUtils.isEmpty(ids)) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "参数为空");
}
if (null == customTagId && !StringUtil.isEmpty(customTag)) {
AppletNewsCustomTag appletNewsCustomTag = new AppletNewsCustomTag();
appletNewsCustomTag.setCustomTag(customTag);
customTagId = insertCustomTag(appletNewsCustomTag);
}
appletNewsDao.batchUpdateCustomTagId(ids, customTagId);
}
@Override
public Long insertCustomTag(AppletNewsCustomTag appletNewsCustomTag) {
if (null == appletNewsCustomTag || StringUtil.isEmpty(appletNewsCustomTag.getCustomTag())) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "参数为空");
}
if (appletNewsDao.customTagExist(appletNewsCustomTag.getCustomTag())) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "标识重复");
}
appletNewsDao.insertCustomTag(appletNewsCustomTag);
return appletNewsCustomTag.getId();
}
@Override
public void updateCustomTag(AppletNewsCustomTag appletNewsCustomTag) {
if (null == appletNewsCustomTag || StringUtil.isEmpty(appletNewsCustomTag.getCustomTag()) || null == appletNewsCustomTag.getId()){
throw new BookBizException(BookBizException.PARAM_IS_NULL,"参数为空");
}
if (appletNewsDao.customTagExist(appletNewsCustomTag.getCustomTag())){
throw new BookBizException(BookBizException.PARAM_IS_NULL,"标识重复");
}
appletNewsDao.updateCustomTag(appletNewsCustomTag);
}
@Override
public List<AppletNewsCustomTagDTO> getCustomTagList() {
return appletNewsDao.getCustomTagList();
}
@Override
public List<Long> getNewsIdListByCustomTagId(Long customTagId) {
return appletNewsDao.getNewsIdListByCustomTagId(customTagId);
}
} }
package com.pcloud.book.applet.dao; package com.pcloud.book.applet.dao;
import com.pcloud.book.applet.dto.AppletNewsCustomTagDTO;
import com.pcloud.book.applet.dto.AppletNewsDTO; import com.pcloud.book.applet.dto.AppletNewsDTO;
import com.pcloud.book.applet.entity.AppletNews; import com.pcloud.book.applet.entity.AppletNews;
import com.pcloud.book.applet.entity.AppletNewsCustomTag;
import com.pcloud.book.applet.vo.AppletNewsClassifyVO; import com.pcloud.book.applet.vo.AppletNewsClassifyVO;
import com.pcloud.book.applet.vo.AppletNewsShowStateVO; import com.pcloud.book.applet.vo.AppletNewsShowStateVO;
import com.pcloud.common.core.dao.BaseDao; import com.pcloud.common.core.dao.BaseDao;
...@@ -92,4 +94,47 @@ public interface AppletNewsDao extends BaseDao<AppletNews> { ...@@ -92,4 +94,47 @@ public interface AppletNewsDao extends BaseDao<AppletNews> {
* * @param null * * @param null
*/ */
void batchUpdateNewsClassify(AppletNewsClassifyVO appletNewsClassifyVO); void batchUpdateNewsClassify(AppletNewsClassifyVO appletNewsClassifyVO);
/**
* 批量更新自定义标识
* @author:zhuyajie
* @date:2020/6/9 17:52
* * @param null
*/
void batchUpdateCustomTagId(List<Long> ids,Long customTagId);
/**
* 新增自定义标识
* @author:zhuyajie
* @date:2020/6/9 17:52
* * @param null
*/
void insertCustomTag(AppletNewsCustomTag appletNewsCustomTag);
/**
* 修改自定义标识
* @author:zhuyajie
* @date:2020/6/9 17:52
* * @param null
*/
void updateCustomTag(AppletNewsCustomTag appletNewsCustomTag);
/**
* 自定义标识列表
* @author:zhuyajie
* @date:2020/6/9 17:52
* * @param null
*/
List<AppletNewsCustomTagDTO> getCustomTagList();
/**
* 标识是否存在
* @author:zhuyajie
* @date:2020/6/9 18:12
* * @param null
*/
Boolean customTagExist(String customTag);
/**
* 根据标识id查资讯id列表
* @author:zhuyajie
* @date:2020/6/10 17:39
* * @param null
*/
List<Long> getNewsIdListByCustomTagId(Long customTagId);
} }
package com.pcloud.book.applet.dao.impl; package com.pcloud.book.applet.dao.impl;
import com.pcloud.book.applet.dao.AppletNewsDao; import com.pcloud.book.applet.dao.AppletNewsDao;
import com.pcloud.book.applet.dto.AppletNewsCustomTagDTO;
import com.pcloud.book.applet.dto.AppletNewsDTO; import com.pcloud.book.applet.dto.AppletNewsDTO;
import com.pcloud.book.applet.entity.AppletNews; import com.pcloud.book.applet.entity.AppletNews;
import com.pcloud.book.applet.entity.AppletNewsCustomTag;
import com.pcloud.book.applet.vo.AppletNewsClassifyVO; import com.pcloud.book.applet.vo.AppletNewsClassifyVO;
import com.pcloud.book.applet.vo.AppletNewsShowStateVO; import com.pcloud.book.applet.vo.AppletNewsShowStateVO;
import com.pcloud.common.core.dao.BaseDaoImpl; import com.pcloud.common.core.dao.BaseDaoImpl;
...@@ -130,4 +132,37 @@ public class AppletNewsDaoImpl extends BaseDaoImpl<AppletNews> implements Applet ...@@ -130,4 +132,37 @@ public class AppletNewsDaoImpl extends BaseDaoImpl<AppletNews> implements Applet
getSessionTemplate().update(getStatement("batchUpdateNewsClassify"), map); getSessionTemplate().update(getStatement("batchUpdateNewsClassify"), map);
} }
@Override
public void batchUpdateCustomTagId(List<Long> ids, Long customTagId) {
Map<String, Object> map = new HashMap<>();
map.put("ids", ids);
map.put("customTagId", customTagId);
getSessionTemplate().update(getStatement("batchUpdateCustomTagId"), map);
}
@Override
public void insertCustomTag(AppletNewsCustomTag appletNewsCustomTag) {
getSessionTemplate().insert(getStatement("insertCustomTag"), appletNewsCustomTag);
}
@Override
public void updateCustomTag(AppletNewsCustomTag appletNewsCustomTag) {
getSessionTemplate().update(getStatement("updateCustomTag"), appletNewsCustomTag);
}
@Override
public List<AppletNewsCustomTagDTO> getCustomTagList() {
return getSessionTemplate().selectList(getStatement("getCustomTagList"));
}
@Override
public Boolean customTagExist(String customTag) {
return getSessionTemplate().selectOne(getStatement("customTagExist"), customTag);
}
@Override
public List<Long> getNewsIdListByCustomTagId(Long customTagId) {
return getSessionTemplate().selectList(getStatement("getNewsIdListByCustomTagId"), customTagId);
}
} }
package com.pcloud.book.applet.dto;
import com.pcloud.common.dto.BaseDto;
import java.util.List;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel("小程序资讯自定义标识")
public class AppletNewsCustomTagDTO extends BaseDto {
@ApiModelProperty("自定义标识")
private String customTag;
@ApiModelProperty("标识id")
private Long customTagId;
@ApiModelProperty("资讯ids")
private List<Long> newsIds;
}
...@@ -85,4 +85,8 @@ public class AppletNewsDTO extends BaseDto { ...@@ -85,4 +85,8 @@ public class AppletNewsDTO extends BaseDto {
private String clickPVUV; private String clickPVUV;
@ApiModelProperty("浏览量pv/uv") @ApiModelProperty("浏览量pv/uv")
private String browsePVUV; private String browsePVUV;
@ApiModelProperty("自定义标识")
private String customTag;
@ApiModelProperty("自定义标识id")
private Long customTagId;
} }
...@@ -52,4 +52,6 @@ public class AppletNews extends BaseTempletClassify { ...@@ -52,4 +52,6 @@ public class AppletNews extends BaseTempletClassify {
private String jumpUrl; private String jumpUrl;
@ApiModelProperty("跳转外链编号") @ApiModelProperty("跳转外链编号")
private String urlNumber; private String urlNumber;
@ApiModelProperty("自定义标识id")
private Long customTagId;
} }
package com.pcloud.book.applet.entity;
import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel("小程序资讯自定义标识")
public class AppletNewsCustomTag extends BaseEntity {
@ApiModelProperty("自定义标识")
private String customTag;
}
...@@ -10,6 +10,7 @@ import com.pcloud.book.applet.dto.AppletBooklistClassifyDTO; ...@@ -10,6 +10,7 @@ import com.pcloud.book.applet.dto.AppletBooklistClassifyDTO;
import com.pcloud.book.applet.dto.AppletBooklistDTO; import com.pcloud.book.applet.dto.AppletBooklistDTO;
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.AppletNewsDTO; import com.pcloud.book.applet.dto.AppletNewsDTO;
import com.pcloud.book.applet.dto.AppletUserBookcaseDTO; import com.pcloud.book.applet.dto.AppletUserBookcaseDTO;
import com.pcloud.book.applet.dto.BookDTO4Booklist; import com.pcloud.book.applet.dto.BookDTO4Booklist;
...@@ -20,6 +21,7 @@ import com.pcloud.book.applet.entity.AppletLinkClick; ...@@ -20,6 +21,7 @@ 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.AppletNewsClassify; import com.pcloud.book.applet.entity.AppletNewsClassify;
import com.pcloud.book.applet.entity.AppletNewsComment; import com.pcloud.book.applet.entity.AppletNewsComment;
import com.pcloud.book.applet.entity.AppletNewsCustomTag;
import com.pcloud.book.applet.entity.AppletUserBookcase; import com.pcloud.book.applet.entity.AppletUserBookcase;
import com.pcloud.book.applet.entity.AppletUserClickRecord; import com.pcloud.book.applet.entity.AppletUserClickRecord;
import com.pcloud.book.applet.vo.AppletNewsClassifyVO; import com.pcloud.book.applet.vo.AppletNewsClassifyVO;
...@@ -454,14 +456,15 @@ public class AppletHomeFacade { ...@@ -454,14 +456,15 @@ public class AppletHomeFacade {
@RequestParam(value = "rightsClassifyId", required = false) @ApiParam("权益分类") Long rightsClassifyId, @RequestParam(value = "rightsClassifyId", required = false) @ApiParam("权益分类") Long rightsClassifyId,
@RequestParam(value = "source", required = false) @ApiParam("来源") String source, @RequestParam(value = "source", required = false) @ApiParam("来源") String source,
@RequestParam(value = "showState", required = false) @ApiParam("上架") Integer showState, @RequestParam(value = "showState", required = false) @ApiParam("上架") Integer showState,
@RequestParam(value = "newsClassifyId", required = false) @ApiParam("资讯栏目id") Long newsClassifyId @RequestParam(value = "newsClassifyId", required = false) @ApiParam("资讯栏目id") Long newsClassifyId,
@RequestParam(value = "customTagId", required = false) @ApiParam("自定义标识id") Long customTagId
) throws PermissionException { ) throws PermissionException {
SessionUtil.getInfoToken4Redis(token); SessionUtil.getInfoToken4Redis(token);
if (null==currentPage || null == numPerPage){ if (null==currentPage || null == numPerPage){
throw new BookBizException(BookBizException.PARAM_IS_NULL,"缺少分页参数"); throw new BookBizException(BookBizException.PARAM_IS_NULL,"缺少分页参数");
} }
return new ResponseDto<>(appletNewsBiz.listAppletNews(currentPage, numPerPage, name, firstClassify,secondClassify,gradeLabelId, return new ResponseDto<>(appletNewsBiz.listAppletNews(currentPage, numPerPage, name, firstClassify,secondClassify,gradeLabelId,
subjectLabelId,rightsClassifyId,source,showState,newsClassifyId)); subjectLabelId,rightsClassifyId,source,showState,newsClassifyId,customTagId));
} }
@ApiOperation("客户端资讯列表") @ApiOperation("客户端资讯列表")
...@@ -820,6 +823,45 @@ public class AppletHomeFacade { ...@@ -820,6 +823,45 @@ public class AppletHomeFacade {
} }
return new ResponseDto<>(appletUserBookcaseBiz.getBookcaseIdListByUser(wechatUserId)); return new ResponseDto<>(appletUserBookcaseBiz.getBookcaseIdListByUser(wechatUserId));
} }
@ApiOperation("批量更新资讯自定义标识")
@PostMapping("batchUpdateCustomTagId")
public ResponseDto<?> batchUpdateCustomTagId(@RequestHeader("token") String token, @RequestBody AppletNewsCustomTagDTO appletNewsCustomTagDTO) {
SessionUtil.getToken4Redis(token);
if (null == appletNewsCustomTagDTO) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "参数为空");
}
appletNewsBiz.batchUpdateCustomTagId(appletNewsCustomTagDTO.getNewsIds(), appletNewsCustomTagDTO.getCustomTagId(), appletNewsCustomTagDTO.getCustomTag());
return new ResponseDto<>();
}
@ApiOperation("新增资讯自定义标识")
@PostMapping("insertCustomTag")
public ResponseDto<?> insertCustomTag(@RequestHeader("token") String token, @RequestBody AppletNewsCustomTag appletNewsCustomTag) {
SessionUtil.getToken4Redis(token);
return new ResponseDto<>(appletNewsBiz.insertCustomTag(appletNewsCustomTag));
}
@ApiOperation("修改资讯自定义标识")
@PostMapping("updateCustomTag")
public ResponseDto<?> updateCustomTag(@RequestHeader("token") String token, @RequestBody AppletNewsCustomTag appletNewsCustomTag) {
SessionUtil.getToken4Redis(token);
appletNewsBiz.updateCustomTag(appletNewsCustomTag);
return new ResponseDto<>();
}
@ApiOperation("资讯自定义标识列表")
@GetMapping("getNewsCustomTagList")
public ResponseDto<?> getNewsCustomTagList(@RequestHeader("token") String token) {
SessionUtil.getToken4Redis(token);
return new ResponseDto<>(appletNewsBiz.getCustomTagList());
}
@ApiOperation("根据标识id查资讯id列表")
@GetMapping("getNewsIdListByCustomTagId")
public ResponseDto<?> getNewsIdListByCustomTagId(@RequestParam("customTagId") Long customTagId) {
return new ResponseDto<>(appletNewsBiz.getNewsIdListByCustomTagId(customTagId));
}
} }
......
...@@ -26,25 +26,26 @@ ...@@ -26,25 +26,26 @@
<result column="jump_type" property="jumpType" jdbcType="INTEGER" /> <result column="jump_type" property="jumpType" jdbcType="INTEGER" />
<result column="jump_url" property="jumpUrl" jdbcType="VARCHAR" /> <result column="jump_url" property="jumpUrl" jdbcType="VARCHAR" />
<result column="url_number" property="urlNumber" jdbcType="VARCHAR" /> <result column="url_number" property="urlNumber" jdbcType="VARCHAR" />
<result column="custom_tag_id" property="customTagId" jdbcType="BIGINT" />
</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, id, news_name, source, news_classify_id, pro_label_id, dep_label_id, pur_label_id, type, 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, content, show_state, create_time, update_time, first_classify, second_classify, grade_label_id, subject_label_id, rights_classify_id,
jump_type, jump_url, url_number jump_type, jump_url, url_number, custom_tag_id
</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">
insert into applet_news( insert into applet_news(
news_name, source, news_classify_id, pro_label_id, dep_label_id, pur_label_id, type, digest, news_name, source, news_classify_id, pro_label_id, dep_label_id, pur_label_id, type, 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, content, show_state, create_time, update_time , first_classify, second_classify, grade_label_id, subject_label_id, rights_classify_id,
jump_type, jump_url,url_number jump_type, jump_url,url_number, custom_tag_id
) )
values ( values (
#{newsName}, #{source}, #{newsClassifyId}, #{proLabelId}, #{depLabelId}, #{purLabelId}, #{type}, #{digest}, #{newsName}, #{source}, #{newsClassifyId}, #{proLabelId}, #{depLabelId}, #{purLabelId}, #{type}, #{digest},
#{pic1}, #{pic2}, #{pic3}, #{content}, #{showState}, NOW(), NOW(), #{firstClassify,jdbcType=BIGINT}, #{secondClassify,jdbcType=BIGINT}, #{pic1}, #{pic2}, #{pic3}, #{content}, #{showState}, NOW(), NOW(), #{firstClassify,jdbcType=BIGINT}, #{secondClassify,jdbcType=BIGINT},
#{gradeLabelId,jdbcType=BIGINT}, #{subjectLabelId,jdbcType=BIGINT}, #{rightsClassifyId,jdbcType=BIGINT}, #{gradeLabelId,jdbcType=BIGINT}, #{subjectLabelId,jdbcType=BIGINT}, #{rightsClassifyId,jdbcType=BIGINT},
#{jumpType}, #{jumpUrl}, #{urlNumber} #{jumpType}, #{jumpUrl}, #{urlNumber}, #{customTagId}
) )
</insert> </insert>
...@@ -132,10 +133,13 @@ ...@@ -132,10 +133,13 @@
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.custom_tag_id customTagId,
t.custom_tag customTag
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
LEFT JOIN applet_news_custom_tag t ON n.custom_tag_id = t.id
WHERE 1=1 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},"%"))
...@@ -164,6 +168,9 @@ ...@@ -164,6 +168,9 @@
<if test="source != null"> <if test="source != null">
AND n.source = #{source} AND n.source = #{source}
</if> </if>
<if test="customTagId != null">
AND n.custom_tag_id = #{customTagId}
</if>
ORDER BY n.create_time DESC ORDER BY n.create_time DESC
</select> </select>
...@@ -478,4 +485,49 @@ ...@@ -478,4 +485,49 @@
</foreach> </foreach>
</update> </update>
<update id="batchUpdateCustomTagId" parameterType="map">
UPDATE applet_news
SET
custom_tag_id = #{customTagId},
update_time=NOW()
WHERE id IN
<foreach collection="ids" item="item" separator="," open="(" close=")" >
${item}
</foreach>
</update>
<insert id="insertCustomTag" parameterType="com.pcloud.book.applet.entity.AppletNewsCustomTag" useGeneratedKeys="true" keyProperty="id">
INSERT INTO applet_news_custom_tag(custom_tag, create_time) VALUES (#{customTag}, now())
</insert>
<update id="updateCustomTag" parameterType="com.pcloud.book.applet.entity.AppletNewsCustomTag">
UPDATE applet_news_custom_tag SET custom_tag = #{customTag}, create_time = now()
where id = #{id}
</update>
<select id="getCustomTagList" resultType="com.pcloud.book.applet.dto.AppletNewsCustomTagDTO">
SELECT
id customTagId,
custom_tag customTag
FROM
applet_news_custom_tag
ORDER BY
create_time DESC, id DESC
</select>
<select id="customTagExist" parameterType="map" resultType="boolean">
SELECT EXISTS (
SELECT id
FROM applet_news_custom_tag
WHERE
custom_tag = #{customTag}
)
</select>
<select id="getNewsIdListByCustomTagId" parameterType="long" resultType="long">
SELECT id from applet_news
WHERE custom_tag_id = #{customTagId}
ORDER BY create_time DESC
</select>
</mapper> </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