Commit 00ee8e07 by 阮思源

Merge branch 'feat-zyj-1002818' into 'master'

1002818资讯第三方链接支持

See merge request rays/pcloud-book!688
parents 0e9cae71 1b9963cc
package com.pcloud.book.applet.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.pcloud.common.dto.BaseDto;
import java.util.Date;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel("小程序资讯")
public class AppletNewsVO extends BaseDto {
@ApiModelProperty("id")
private Long id;
@ApiModelProperty("资讯")
private String newsName;
@ApiModelProperty("来源")
private String source;
@ApiModelProperty("栏目id")
private Long newsClassifyId;
@ApiModelProperty("专业标签ID")
private Long proLabelId;
@ApiModelProperty("深度标签ID")
private Long depLabelId;
@ApiModelProperty("目的标签ID")
private Long purLabelId;
@ApiModelProperty("专业标签")
private String proLabelName;
@ApiModelProperty("深度标签")
private String depLabelName;
@ApiModelProperty("目的标签")
private String purLabelName;
@ApiModelProperty("文章版式(1多图文2单图文3纯图片4纯文本)")
private Integer type;
@ApiModelProperty("内容摘要")
private String digest;
@ApiModelProperty("预览图片1")
private String pic1;
@ApiModelProperty("预览图片2")
private String pic2;
@ApiModelProperty("预览图片3")
private String pic3;
@ApiModelProperty("文章内容")
private String content;
@ApiModelProperty("是否展示")
private Boolean showState;
@ApiModelProperty("分类名称")
private String newsClassify;
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss",
timezone = "GMT+8"
)
protected Date createTime;
@ApiModelProperty("第一级类型标识")
private Long firstClassify;
@ApiModelProperty("第二级类型标识")
private Long secondClassify;
@ApiModelProperty("年级标签id")
private Long gradeLabelId;
@ApiModelProperty("科目标签id")
private Long subjectLabelId;
@ApiModelProperty("权益分类id")
private Long rightsClassifyId;
private String firstClassifyContent;
private String secondClassifyContent;
private String gradeLabelIdContent;
private String subjectLabelIdContent;
@ApiModelProperty("权益分类")
private String rightsClassifyContent;
@ApiModelProperty("跳转类型(1原文编辑2直接跳转)")
private Integer jumpType;
@ApiModelProperty("跳转地址")
private String jumpUrl;
}
package com.pcloud.book.applet.service;
import com.pcloud.book.applet.dto.AppletNewsVO;
import com.pcloud.common.dto.ResponseDto;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@FeignClient(value = "pcloud-service-book", qualifier = "appletServiceCloud", path = "book/v1.0/appletService")
@Api(description = "小程序内部接口")
public interface AppletService {
@ApiOperation("根据资讯id查资讯")
@GetMapping("getNewsById")
public ResponseEntity<ResponseDto<AppletNewsVO>> getNewsById(@RequestParam("newsId") Long newsId);
}
...@@ -3,6 +3,7 @@ package com.pcloud.book.applet.biz; ...@@ -3,6 +3,7 @@ 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.AppletNewsDTO; import com.pcloud.book.applet.dto.AppletNewsDTO;
import com.pcloud.book.applet.dto.AppletNewsVO;
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;
...@@ -70,7 +71,7 @@ public interface AppletNewsBiz { ...@@ -70,7 +71,7 @@ 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); Long subjectLabelId,Long rightsClassifyId,String source);
/** /**
* 获取所有资讯栏目 * 获取所有资讯栏目
...@@ -124,4 +125,23 @@ public interface AppletNewsBiz { ...@@ -124,4 +125,23 @@ public interface AppletNewsBiz {
* @return * @return
*/ */
List<AppletNewsDTO> getNewsByTempletLabel(Long firstClassify, Long secondClassify, Long gradeLabelId, Long subjectLabelId, String rightsType); List<AppletNewsDTO> getNewsByTempletLabel(Long firstClassify, Long secondClassify, Long gradeLabelId, Long subjectLabelId, String rightsType);
/**
* 根据id查询
* @author:zhuyajie
* @date:2020/4/26
* * @param null
*/
AppletNewsVO getNewsVOById(Long newsId);
/**
* 资讯来源列表
* @author:zhuyajie
* @date:2020/4/27 14:46
* * @param null
*/
List<String> getNewsSourceList();
} }
...@@ -8,6 +8,7 @@ import com.pcloud.book.applet.dao.AppletNewsDao; ...@@ -8,6 +8,7 @@ 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.AppletNewsDTO; import com.pcloud.book.applet.dto.AppletNewsDTO;
import com.pcloud.book.applet.dto.AppletNewsVO;
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;
...@@ -22,6 +23,7 @@ import com.pcloud.book.rightsSetting.entity.BaseTempletClassify; ...@@ -22,6 +23,7 @@ import com.pcloud.book.rightsSetting.entity.BaseTempletClassify;
import com.pcloud.common.page.PageBeanNew; import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.page.PageParam; import com.pcloud.common.page.PageParam;
import com.pcloud.common.utils.ListUtils; import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.string.StringUtil;
import com.pcloud.readercenter.wechat.entity.WechatUser; import com.pcloud.readercenter.wechat.entity.WechatUser;
import org.apache.commons.collections.MapUtils; import org.apache.commons.collections.MapUtils;
...@@ -99,6 +101,7 @@ public class AppletNewsBizImpl implements AppletNewsBiz { ...@@ -99,6 +101,7 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
appletNews.setShowState(false); appletNews.setShowState(false);
rightsSettingBiz.setClassifyAndLabel(appletNews); rightsSettingBiz.setClassifyAndLabel(appletNews);
appletNewsDao.insert(appletNews); appletNewsDao.insert(appletNews);
this.updateSource(null,appletNews.getSource());
return appletNews.getId(); return appletNews.getId();
} }
...@@ -107,22 +110,30 @@ public class AppletNewsBizImpl implements AppletNewsBiz { ...@@ -107,22 +110,30 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
if (null == appletNews.getId()){ if (null == appletNews.getId()){
throw new BookBizException(BookBizException.ERROR,"id为空"); throw new BookBizException(BookBizException.ERROR,"id为空");
} }
AppletNews beforeNews = appletNewsDao.getById(appletNews.getId());
rightsSettingBiz.setClassifyAndLabel(appletNews); rightsSettingBiz.setClassifyAndLabel(appletNews);
appletNewsDao.update(appletNews); appletNewsDao.update(appletNews);
this.updateSource(beforeNews.getSource(),appletNews.getSource());
} }
@Override @Override
public void deleteAppletNewsById(Long id) { public void deleteAppletNewsById(Long id) {
AppletNews beforeNews = appletNewsDao.getById(id);
if (null == beforeNews) {
return;
}
appletNewsDao.deleteById(id); appletNewsDao.deleteById(id);
this.updateSource(beforeNews.getSource(), null);
} }
@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) { Long subjectLabelId,Long rightsClassifyId,String source) {
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);
//处理分类 //处理分类
if (null!=firstClassify){ if (null!=firstClassify){
BaseTempletClassify classify = new BaseTempletClassify(); BaseTempletClassify classify = new BaseTempletClassify();
...@@ -321,4 +332,57 @@ public class AppletNewsBizImpl implements AppletNewsBiz { ...@@ -321,4 +332,57 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
list=appletNewsDao.getByNewsByTempletLabel(classify.getFirstClassify(),classify.getSecondClassify(),classify.getGradeLabelId(),classify.getSubjectLabelId(),rightsType); list=appletNewsDao.getByNewsByTempletLabel(classify.getFirstClassify(),classify.getSecondClassify(),classify.getGradeLabelId(),classify.getSubjectLabelId(),rightsType);
return list; return list;
} }
@Override
public AppletNewsVO getNewsVOById(Long newsId) {
AppletNews appletNews = appletNewsDao.getById(newsId);
AppletNewsVO appletNewsVO = new AppletNewsVO();
if (null != appletNews) {
BeanUtils.copyProperties(appletNews, appletNewsVO);
}
return appletNewsVO;
}
@Override
public List<String> getNewsSourceList() {
return appletNewsDao.getNewsSourceList();
}
/**
* 资讯来源维护
* @author:zhuyajie
* @date:2020/4/27 15:23
* * @param null
*/
public void updateSource(String before,String source){
//修改
if (!StringUtil.isEmpty(before) && !StringUtil.isEmpty(source) && !before.equals(source)){
Integer beforeCount = appletNewsDao.getAppletNewsSourceCount(before);
if (beforeCount==0){
appletNewsDao.deleteSource(before);
}
Boolean exist = appletNewsDao.newsSourceExist(source);
if (!exist){
appletNewsDao.insertSource(source);
}
return;
}
//新增
if (StringUtil.isEmpty(before) && !StringUtil.isEmpty(source)){
Boolean exist = appletNewsDao.newsSourceExist(source);
if (!exist){
appletNewsDao.insertSource(source);
}
return;
}
//删除
if (!StringUtil.isEmpty(before) && StringUtil.isEmpty(source)){
Integer beforeCount = appletNewsDao.getAppletNewsSourceCount(before);
if (beforeCount==0){
appletNewsDao.deleteSource(before);
}
return;
}
}
} }
...@@ -37,4 +37,25 @@ public interface AppletNewsDao extends BaseDao<AppletNews> { ...@@ -37,4 +37,25 @@ public interface AppletNewsDao extends BaseDao<AppletNews> {
List<AppletNewsDTO> getByNewsByTempletLabel(Long firstClassify, Long secondClassify, Long gradeLabelId, Long subjectLabelId, String rightsType); List<AppletNewsDTO> getByNewsByTempletLabel(Long firstClassify, Long secondClassify, Long gradeLabelId, Long subjectLabelId, String rightsType);
List<AppletNews> getByTempletAndClassify(Long firstClassify, Long secondClassify, Long gradeLabelId, Long subjectLabelId, Long rightsClassifyId, Integer top); List<AppletNews> getByTempletAndClassify(Long firstClassify, Long secondClassify, Long gradeLabelId, Long subjectLabelId, Long rightsClassifyId, Integer top);
/**
*新增资讯来源
*/
void insertSource(String source);
/**
*资讯来源列表
*/
List<String> getNewsSourceList();
/**
*资讯来源数量
*/
Integer getAppletNewsSourceCount(String source);
/**
*删除资讯来源
*/
void deleteSource(String source);
/**
*来源是否存在
*/
Boolean newsSourceExist(String source);
} }
...@@ -49,4 +49,29 @@ public class AppletNewsDaoImpl extends BaseDaoImpl<AppletNews> implements Applet ...@@ -49,4 +49,29 @@ public class AppletNewsDaoImpl extends BaseDaoImpl<AppletNews> implements Applet
map.put("top", top); map.put("top", top);
return getSessionTemplate().selectList(getStatement("getByTempletAndClassify"),map); return getSessionTemplate().selectList(getStatement("getByTempletAndClassify"),map);
} }
@Override
public void insertSource(String source) {
getSessionTemplate().insert(getStatement("insertSource"),source);
}
@Override
public List<String> getNewsSourceList() {
return getSessionTemplate().selectList(getStatement("getNewsSourceList"));
}
@Override
public Integer getAppletNewsSourceCount(String source) {
return getSessionTemplate().selectOne(getStatement("getAppletNewsSourceCount"),source);
}
@Override
public void deleteSource(String source) {
getSessionTemplate().delete(getStatement("deleteSource"),source);
}
@Override
public Boolean newsSourceExist(String source) {
return getSessionTemplate().selectOne(getStatement("newsSourceExist"),source);
}
} }
...@@ -75,4 +75,8 @@ public class AppletNewsDTO extends BaseDto { ...@@ -75,4 +75,8 @@ public class AppletNewsDTO extends BaseDto {
@ApiModelProperty("权益分类") @ApiModelProperty("权益分类")
private String rightsClassifyContent; private String rightsClassifyContent;
@ApiModelProperty("跳转类型(1原文编辑2直接跳转)")
private Integer jumpType;
@ApiModelProperty("跳转地址")
private String jumpUrl;
} }
...@@ -46,4 +46,8 @@ public class AppletNews extends BaseTempletClassify { ...@@ -46,4 +46,8 @@ public class AppletNews extends BaseTempletClassify {
private Long subjectLabelId; private Long subjectLabelId;
@ApiModelProperty("权益分类id") @ApiModelProperty("权益分类id")
private Long rightsClassifyId; private Long rightsClassifyId;
@ApiModelProperty("跳转类型(1原文编辑2直接跳转)")
private Integer jumpType;
@ApiModelProperty("跳转地址")
private String jumpUrl;
} }
...@@ -441,14 +441,15 @@ public class AppletHomeFacade { ...@@ -441,14 +441,15 @@ public class AppletHomeFacade {
@RequestParam(value = "secondClassify", required = false) @ApiParam("二级书刊分类")Long secondClassify, @RequestParam(value = "secondClassify", required = false) @ApiParam("二级书刊分类")Long secondClassify,
@RequestParam(value = "gradeLabelId", required = false) @ApiParam("年级标签")Long gradeLabelId, @RequestParam(value = "gradeLabelId", required = false) @ApiParam("年级标签")Long gradeLabelId,
@RequestParam(value = "subjectLabelId", required = false) @ApiParam("科目标签")Long subjectLabelId, @RequestParam(value = "subjectLabelId", required = false) @ApiParam("科目标签")Long subjectLabelId,
@RequestParam(value = "rightsClassifyId", required = false) @ApiParam("权益分类") Long rightsClassifyId @RequestParam(value = "rightsClassifyId", required = false) @ApiParam("权益分类") Long rightsClassifyId,
@RequestParam(value = "source", required = false) @ApiParam("来源") String source
) 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)); subjectLabelId,rightsClassifyId,source));
} }
@ApiOperation("客户端资讯列表") @ApiOperation("客户端资讯列表")
...@@ -608,6 +609,12 @@ public class AppletHomeFacade { ...@@ -608,6 +609,12 @@ public class AppletHomeFacade {
return new ResponseDto<>(pcloudGroupActivityBiz.getGroupActivity4Applet(rightsSettingId, adviserId ,bookId, channelId)); return new ResponseDto<>(pcloudGroupActivityBiz.getGroupActivity4Applet(rightsSettingId, adviserId ,bookId, channelId));
} }
@ApiOperation("资讯来源列表")
@GetMapping("getNewsSourceList")
public ResponseDto<List<String>> getNewsSourceList(){
return new ResponseDto<>(appletNewsBiz.getNewsSourceList());
}
} }
......
package com.pcloud.book.applet.service.impl;
import com.pcloud.book.applet.biz.AppletNewsBiz;
import com.pcloud.book.applet.dto.AppletNewsVO;
import com.pcloud.book.applet.service.AppletService;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.utils.ResponseHandleUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @ClassName com.pcloud.book.applet.service.impl.AppletServiceImpl
* @Author zhuyajie
* @Description 小程序内部服务
* @Date 2020/4/26 20:04
* @Version 1.0
**/
@RestController("appletService")
@RequestMapping("appletService")
public class AppletServiceImpl implements AppletService {
@Autowired
private AppletNewsBiz appletNewsBiz;
@Override
@GetMapping("getNewsById")
public ResponseEntity<ResponseDto<AppletNewsVO>> getNewsById(Long newsId) {
return ResponseHandleUtil.toResponse(appletNewsBiz.getNewsVOById(newsId));
}
}
...@@ -593,7 +593,8 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -593,7 +593,8 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
FillRightsSettingAppletsDTO applets = getFillRightsSettingApplets(rightsSettingId, wechatUserId, rightsClassifyId, top); FillRightsSettingAppletsDTO applets = getFillRightsSettingApplets(rightsSettingId, wechatUserId, rightsClassifyId, top);
List<AppletNews> news = applets.getDesignatedNews(); List<AppletNews> news = applets.getDesignatedNews();
for (AppletNews appletNews : news) { for (AppletNews appletNews : news) {
items.add(RightsNowItem.builder().serveId(appletNews.getId()).serveName(appletNews.getNewsName()).serveTypeName("资讯").servePic(appletNews.getPic1()).type(0).build()); items.add(RightsNowItem.builder().serveId(appletNews.getId()).serveName(appletNews.getNewsName())
.serveTypeName("资讯").servePic(appletNews.getPic1()).type(0).jumpType(appletNews.getJumpType()).jumpUrl(appletNews.getJumpUrl()).build());
} }
} }
......
...@@ -60,6 +60,10 @@ public class RightsNowItem extends BaseEntity { ...@@ -60,6 +60,10 @@ public class RightsNowItem extends BaseEntity {
private Integer couponType; private Integer couponType;
@ApiModelProperty("使用说明") @ApiModelProperty("使用说明")
private String instructions; private String instructions;
@ApiModelProperty("跳转类型")
private Integer jumpType;
@ApiModelProperty("跳转链接")
private String jumpUrl;
@ApiModelProperty("课程券使用方式(1-链接兑取,2-复制码)") @ApiModelProperty("课程券使用方式(1-链接兑取,2-复制码)")
private Integer useType; private Integer useType;
@ApiModelProperty("兑换地址") @ApiModelProperty("兑换地址")
......
...@@ -23,22 +23,27 @@ ...@@ -23,22 +23,27 @@
<result column="grade_label_id" property="gradeLabelId" jdbcType="BIGINT" /> <result column="grade_label_id" property="gradeLabelId" jdbcType="BIGINT" />
<result column="subject_label_id" property="subjectLabelId" jdbcType="BIGINT" /> <result column="subject_label_id" property="subjectLabelId" jdbcType="BIGINT" />
<result column="rights_classify_id" property="rightsClassifyId" jdbcType="BIGINT" /> <result column="rights_classify_id" property="rightsClassifyId" jdbcType="BIGINT" />
<result column="jump_type" property="jumpType" jdbcType="INTEGER" />
<result column="jump_url" property="jumpUrl" jdbcType="VARCHAR" />
</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
</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
) )
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}
) )
</insert> </insert>
...@@ -73,6 +78,10 @@ ...@@ -73,6 +78,10 @@
grade_label_id = #{gradeLabelId,jdbcType=BIGINT}, grade_label_id = #{gradeLabelId,jdbcType=BIGINT},
subject_label_id = #{subjectLabelId,jdbcType=BIGINT}, subject_label_id = #{subjectLabelId,jdbcType=BIGINT},
rights_classify_id = #{rightsClassifyId,jdbcType=BIGINT}, rights_classify_id = #{rightsClassifyId,jdbcType=BIGINT},
<if test="jumpType != null">
jump_type = #{jumpType},
</if>
jump_url = #{jumpUrl},
update_time=NOW() update_time=NOW()
</set> </set>
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
...@@ -118,7 +127,9 @@ ...@@ -118,7 +127,9 @@
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_url jumpUrl
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
...@@ -147,6 +158,9 @@ ...@@ -147,6 +158,9 @@
<if test="rightsClassifyId!=null"> <if test="rightsClassifyId!=null">
AND n.rights_classify_id =#{rightsClassifyId} AND n.rights_classify_id =#{rightsClassifyId}
</if> </if>
<if test="source != null">
AND n.source = #{source}
</if>
ORDER BY n.create_time DESC ORDER BY n.create_time DESC
</select> </select>
...@@ -178,7 +192,9 @@ ...@@ -178,7 +192,9 @@
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_url jumpUrl
FROM applet_news n FROM applet_news n
WHERE 1=1 WHERE 1=1
and n.show_state = 1 and n.show_state = 1
...@@ -231,4 +247,25 @@ ...@@ -231,4 +247,25 @@
</select> </select>
<select id="insertSource" parameterType="string">
INSERT INTO applet_news_source (source) VALUES (#{source})
</select>
<select id="getNewsSourceList" resultType="string">
SELECT source FROM applet_news_source
</select>
<select id="getAppletNewsSourceCount" resultType="integer" parameterType="string">
SELECT COUNT(1) FROM applet_news WHERE source = #{source}
</select>
<delete id="deleteSource" parameterType="string">
DELETE FROM applet_news_source WHERE source = #{source}
</delete>
<select id="newsSourceExist" parameterType="string" resultType="boolean">
SELECT EXISTS(
SELECT id FROM applet_news_source WHERE source=#{source}
)
</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