当前位置: 首页 > news >正文

免费建站的网址百度客服电话是多少

免费建站的网址,百度客服电话是多少,郑州英文网站建设,泰州做直销会员结算管理网站黑马头条:app端文章查看 黑马头条:app端文章查看文章列表加载1. 需求分析2. 表结构分析3. 导入文章数据库3.1 导入数据库3.2 导入对应的实体类 4. 实现思路5. 接口定义6. 功能实现6.1:导入heima-leadnews-article微服务,资料在当天…

黑马头条:app端文章查看

  • 黑马头条:app端文章查看
    • 文章列表加载
      • 1. 需求分析
      • 2. 表结构分析
      • 3. 导入文章数据库
        • 3.1 导入数据库
        • 3.2 导入对应的实体类
      • 4. 实现思路
      • 5. 接口定义
      • 6. 功能实现
        • 6.1:导入heima-leadnews-article微服务,资料在当天的文件夹中
        • 6.2:定义接口
        • 6.3:编写mapper文件
        • 6.4:编写业务层代码
        • 6.5:编写控制器代码
        • 6.6: swagger测试或前后端联调测试

黑马头条:app端文章查看

文章列表加载

1. 需求分析

文章布局展示

image-20210419151801252.png

2. 表结构分析

ap_article 文章基本信息表

image-20210419151801252.png

ap_article_config 文章配置表

image-20210419151854868.png

ap_article_content 文章内容表

image-20210419151912063.png

三张表关系分析

image-20210419151938103

3. 导入文章数据库

3.1 导入数据库

查看当天资料文件夹,在数据库连接工具中执行leadnews_article.sql

3.2 导入对应的实体类

ap_article文章表对应实体

package com.heima.model.article.pojos;import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;import java.io.Serializable;
import java.util.Date;/*** <p>* 文章信息表,存储已发布的文章* </p>** @author itheima*/@Data
@TableName("ap_article")
public class ApArticle implements Serializable {@TableId(value = "id",type = IdType.ID_WORKER)private Long id;/*** 标题*/private String title;/*** 作者id*/@TableField("author_id")private Long authorId;/*** 作者名称*/@TableField("author_name")private String authorName;/*** 频道id*/@TableField("channel_id")private Integer channelId;/*** 频道名称*/@TableField("channel_name")private String channelName;/*** 文章布局  0 无图文章   1 单图文章    2 多图文章*/private Short layout;/*** 文章标记  0 普通文章   1 热点文章   2 置顶文章   3 精品文章   4 大V 文章*/private Byte flag;/*** 文章封面图片 多张逗号分隔*/private String images;/*** 标签*/private String labels;/*** 点赞数量*/private Integer likes;/*** 收藏数量*/private Integer collection;/*** 评论数量*/private Integer comment;/*** 阅读数量*/private Integer views;/*** 省市*/@TableField("province_id")private Integer provinceId;/*** 市区*/@TableField("city_id")private Integer cityId;/*** 区县*/@TableField("county_id")private Integer countyId;/*** 创建时间*/@TableField("created_time")private Date createdTime;/*** 发布时间*/@TableField("publish_time")private Date publishTime;/*** 同步状态*/@TableField("sync_status")private Boolean syncStatus;/*** 来源*/private Boolean origin;/*** 静态页面地址*/@TableField("static_url")private String staticUrl;
}

ap_article_config文章配置对应实体类

package com.heima.model.article.pojos;import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;import java.io.Serializable;/*** <p>* APP已发布文章配置表* </p>** @author itheima*/@Data
@TableName("ap_article_config")
public class ApArticleConfig implements Serializable {@TableId(value = "id",type = IdType.ID_WORKER)private Long id;/*** 文章id*/@TableField("article_id")private Long articleId;/*** 是否可评论* true: 可以评论   1* false: 不可评论  0*/@TableField("is_comment")private Boolean isComment;/*** 是否转发* true: 可以转发   1* false: 不可转发  0*/@TableField("is_forward")private Boolean isForward;/*** 是否下架* true: 下架   1* false: 没有下架  0*/@TableField("is_down")private Boolean isDown;/*** 是否已删除* true: 删除   1* false: 没有删除  0*/@TableField("is_delete")private Boolean isDelete;
}

ap_article_content 文章内容对应的实体类

package com.heima.model.article.pojos;import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;import java.io.Serializable;@Data
@TableName("ap_article_content")
public class ApArticleContent implements Serializable {@TableId(value = "id",type = IdType.ID_WORKER)private Long id;/*** 文章id*/@TableField("article_id")private Long articleId;/*** 文章内容*/private String content;
}

4. 实现思路

外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传

1,在默认频道展示10条文章信息

2,可以切换频道查看不同种类文章

3,当用户下拉可以加载最新的文章(分页)本页文章列表中发布时间为最大的时间为依据

4,当用户上拉可以加载更多的文章信息(按照发布时间)本页文章列表中发布时间最小的时间为依据

5,如果是当前频道的首页,前端传递默认参数:

  • maxBehotTime:0(毫秒)

  • minBehotTime:20000000000000(毫秒)—>2063年

5. 接口定义

加载首页加载更多加载最新
接口路径/api/v1/article/load/api/v1/article/loadmore/api/v1/article/loadnew
请求方式POSTPOSTPOST
参数ArticleHomeDtoArticleHomeDtoArticleHomeDto
响应结果ResponseResultResponseResultResponseResult

ArticleHomeDto

package com.heima.model.article.dtos;import lombok.Data;import java.util.Date;@Data
public class ArticleHomeDto {// 最大时间Date maxBehotTime;// 最小时间Date minBehotTime;// 分页sizeInteger size;// 频道IDString tag;
}

6. 功能实现

6.1:导入heima-leadnews-article微服务,资料在当天的文件夹中

image-20210420000326669

注意:需要在heima-leadnews-service的pom文件夹中添加子模块信息,如下:

<modules><module>heima-leadnews-user</module><module>heima-leadnews-article</module>
</modules>

在idea中的maven中更新一下,如果工程还是灰色的,需要在重新添加文章微服务的pom文件,操作步骤如下:

image-20210420001037992

需要在nacos中添加对应的配置

spring:datasource:driver-class-name: com.mysql.jdbc.Driverurl: jdbc:mysql://localhost:3306/leadnews_article?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTCusername: rootpassword: root
# 设置Mapper接口所对应的XML文件位置,如果你在Mapper接口中有自定义方法,需要进行该配置
mybatis-plus:mapper-locations: classpath*:mapper/*.xml# 设置别名包扫描路径,通过该属性可以给包中的类注册别名type-aliases-package: com.heima.model.article.pojos
6.2:定义接口
package com.heima.article.controller.v1;import com.heima.model.article.dtos.ArticleHomeDto;
import com.heima.model.common.dtos.ResponseResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;@RestController
@RequestMapping("/api/v1/article")
public class ArticleHomeController {@PostMapping("/load")public ResponseResult load(@RequestBody ArticleHomeDto dto) {return null;}@PostMapping("/loadmore")public ResponseResult loadMore(@RequestBody ArticleHomeDto dto) {return null;}@PostMapping("/loadnew")public ResponseResult loadNew(@RequestBody ArticleHomeDto dto) {return null;}
}
6.3:编写mapper文件
package com.heima.article.mapper;import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.heima.model.article.dtos.ArticleHomeDto;
import com.heima.model.article.pojos.ApArticle;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;import java.util.List;@Mapper
public interface ApArticleMapper extends BaseMapper<ApArticle> {public List<ApArticle> loadArticleList(@Param("dto") ArticleHomeDto dto, @Param("type") Short type);}

对应的映射文件

在resources中新建mapper/ApArticleMapper.xml 如下配置:

<?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.heima.article.mapper.ApArticleMapper"><resultMap id="resultMap" type="com.heima.model.article.pojos.ApArticle"><id column="id" property="id"/><result column="title" property="title"/><result column="author_id" property="authorId"/><result column="author_name" property="authorName"/><result column="channel_id" property="channelId"/><result column="channel_name" property="channelName"/><result column="layout" property="layout"/><result column="flag" property="flag"/><result column="images" property="images"/><result column="labels" property="labels"/><result column="likes" property="likes"/><result column="collection" property="collection"/><result column="comment" property="comment"/><result column="views" property="views"/><result column="province_id" property="provinceId"/><result column="city_id" property="cityId"/><result column="county_id" property="countyId"/><result column="created_time" property="createdTime"/><result column="publish_time" property="publishTime"/><result column="sync_status" property="syncStatus"/><result column="static_url" property="staticUrl"/></resultMap><select id="loadArticleList" resultMap="resultMap">SELECTaa.*FROM`ap_article` aaLEFT JOIN ap_article_config aac ON aa.id = aac.article_id<where>and aac.is_delete != 1and aac.is_down != 1<!-- loadmore --><if test="type != null and type == 1">and aa.publish_time <![CDATA[<]]> #{dto.minBehotTime}</if><if test="type != null and type == 2">and aa.publish_time <![CDATA[>]]> #{dto.maxBehotTime}</if><if test="dto.tag != '__all__'">and aa.channel_id = #{dto.tag}</if></where>order by aa.publish_time desclimit #{dto.size}</select></mapper>
6.4:编写业务层代码
package com.heima.article.service;import com.baomidou.mybatisplus.extension.service.IService;
import com.heima.model.article.dtos.ArticleHomeDto;
import com.heima.model.article.pojos.ApArticle;
import com.heima.model.common.dtos.ResponseResult;import java.io.IOException;public interface ApArticleService extends IService<ApArticle> {/*** 根据参数加载文章列表* @param loadtype 1为加载更多  2为加载最新* @param dto* @return*/ResponseResult load(Short loadtype, ArticleHomeDto dto);}

实现类:

package com.heima.article.service.impl;import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.heima.article.mapper.ApArticleMapper;
import com.heima.article.service.ApArticleService;
import com.heima.common.constants.ArticleConstants;
import com.heima.model.article.dtos.ArticleHomeDto;import com.heima.model.article.pojos.ApArticle;
import com.heima.model.common.dtos.ResponseResult;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;import java.util.Date;
import java.util.List;@Service
@Transactional
@Slf4j
public class ApArticleServiceImpl  extends ServiceImpl<ApArticleMapper, ApArticle> implements ApArticleService {// 单页最大加载的数字private final static short MAX_PAGE_SIZE = 50;@Autowiredprivate ApArticleMapper apArticleMapper;/*** 根据参数加载文章列表* @param loadtype 1为加载更多  2为加载最新* @param dto* @return*/@Overridepublic ResponseResult load(Short loadtype, ArticleHomeDto dto) {//1.校验参数Integer size = dto.getSize();if(size == null || size == 0){size = 10;}size = Math.min(size,MAX_PAGE_SIZE);dto.setSize(size);//类型参数检验if(!loadtype.equals(ArticleConstants.LOADTYPE_LOAD_MORE)&&!loadtype.equals(ArticleConstants.LOADTYPE_LOAD_NEW)){loadtype = ArticleConstants.LOADTYPE_LOAD_MORE;}//文章频道校验if(StringUtils.isEmpty(dto.getTag())){dto.setTag(ArticleConstants.DEFAULT_TAG);}//时间校验if(dto.getMaxBehotTime() == null) dto.setMaxBehotTime(new Date());if(dto.getMinBehotTime() == null) dto.setMinBehotTime(new Date());//2.查询数据List<ApArticle> apArticles = apArticleMapper.loadArticleList(dto, loadtype);//3.结果封装ResponseResult responseResult = ResponseResult.okResult(apArticles);return responseResult;}}

定义常量类

package com.heima.common.constants;public class ArticleConstants {public static final Short LOADTYPE_LOAD_MORE = 1;public static final Short LOADTYPE_LOAD_NEW = 2;public static final String DEFAULT_TAG = "__all__";}
6.5:编写控制器代码
package com.heima.article.controller.v1;import com.heima.article.service.ApArticleService;
import com.heima.common.constants.ArticleConstants;
import com.heima.model.article.dtos.ArticleHomeDto;
import com.heima.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;@RestController
@RequestMapping("/api/v1/article")
public class ArticleHomeController {@Autowiredprivate ApArticleService apArticleService;@PostMapping("/load")public ResponseResult load(@RequestBody ArticleHomeDto dto) {return apArticleService.load(ArticleConstants.LOADTYPE_LOAD_MORE,dto);}@PostMapping("/loadmore")public ResponseResult loadMore(@RequestBody ArticleHomeDto dto) {return apArticleService.load(ArticleConstants.LOADTYPE_LOAD_MORE,dto);}@PostMapping("/loadnew")public ResponseResult loadNew(@RequestBody ArticleHomeDto dto) {return apArticleService.load(ArticleConstants.LOADTYPE_LOAD_NEW,dto);}
}
6.6: swagger测试或前后端联调测试

第一:在app网关的微服务的nacos的配置中心添加文章微服务的路由,完整配置如下:

spring:cloud:gateway:globalcors:cors-configurations:'[/**]': # 匹配所有请求allowedOrigins: "*" #跨域处理 允许所有的域allowedMethods: # 支持的方法- GET- POST- PUT- DELETEroutes:# 用户微服务- id: useruri: lb://leadnews-userpredicates:- Path=/user/**filters:- StripPrefix= 1# 文章微服务- id: articleuri: lb://leadnews-articlepredicates:- Path=/article/**filters:- StripPrefix= 1

第二:启动nginx,直接使用前端项目测试,启动文章微服务,用户微服务、app网关微服务

  • 高性能

    作为高性能对象存储,在标准硬件条件下它能达到55GB/s的读、35GB/s的写速率

  • 可扩容

    不同MinIO集群可以组成联邦,并形成一个全局的命名空间,并跨越多个数据中心

  • SDK支持

    基于Minio轻量的特点,它得到类似Java、Python或Go等语言的sdk支持

  • 有操作页面

    面向用户友好的简单操作界面,非常方便的管理Bucket及里面的文件资源

  • 功能简单

    这一设计原则让MinIO不容易出错、更快启动

  • 丰富的API

    支持文件资源的分享连接及分享链接的过期策略、存储桶操作、文件列表访问及文件上传下载的基本功能等。

  • 文件变化主动通知

    存储桶(Bucket)如果发生改变,比如上传对象和删除对象,可以使用存储桶事件通知机制进行监控,并通过以下方式发布出去:AMQP、MQTT、Elasticsearch、Redis、NATS、MySQL、Kafka、Webhooks等。


文章转载自:
http://dicta.bbrf.cn
http://wikiup.bbrf.cn
http://parish.bbrf.cn
http://unnamable.bbrf.cn
http://podophyllum.bbrf.cn
http://distilled.bbrf.cn
http://superinvar.bbrf.cn
http://vannetais.bbrf.cn
http://externship.bbrf.cn
http://silvics.bbrf.cn
http://clonic.bbrf.cn
http://manners.bbrf.cn
http://upswing.bbrf.cn
http://mediant.bbrf.cn
http://leatherwood.bbrf.cn
http://spleenful.bbrf.cn
http://intercalary.bbrf.cn
http://thermate.bbrf.cn
http://stripteaser.bbrf.cn
http://overrigid.bbrf.cn
http://leyte.bbrf.cn
http://howler.bbrf.cn
http://inverse.bbrf.cn
http://pyro.bbrf.cn
http://methylase.bbrf.cn
http://rainfall.bbrf.cn
http://sporogenic.bbrf.cn
http://coverture.bbrf.cn
http://berseem.bbrf.cn
http://bowls.bbrf.cn
http://nephrotoxic.bbrf.cn
http://schadenfreude.bbrf.cn
http://amusingly.bbrf.cn
http://endothecium.bbrf.cn
http://adolesce.bbrf.cn
http://spirituous.bbrf.cn
http://solve.bbrf.cn
http://stringless.bbrf.cn
http://timeous.bbrf.cn
http://abluent.bbrf.cn
http://bottlebrush.bbrf.cn
http://multiplepoinding.bbrf.cn
http://ichthyologic.bbrf.cn
http://patricia.bbrf.cn
http://dogcatcher.bbrf.cn
http://scimiter.bbrf.cn
http://overstructured.bbrf.cn
http://tonsure.bbrf.cn
http://monopteron.bbrf.cn
http://tranquilize.bbrf.cn
http://amish.bbrf.cn
http://quinine.bbrf.cn
http://hepaticotomy.bbrf.cn
http://hacky.bbrf.cn
http://jarl.bbrf.cn
http://amoretto.bbrf.cn
http://lipsalve.bbrf.cn
http://pyrometer.bbrf.cn
http://demonolatry.bbrf.cn
http://biogenic.bbrf.cn
http://calk.bbrf.cn
http://cerci.bbrf.cn
http://ethnography.bbrf.cn
http://unmechanical.bbrf.cn
http://housebroken.bbrf.cn
http://dipsy.bbrf.cn
http://preequalization.bbrf.cn
http://noiseless.bbrf.cn
http://bimanal.bbrf.cn
http://swordstick.bbrf.cn
http://deviser.bbrf.cn
http://physiognomical.bbrf.cn
http://uncomprehension.bbrf.cn
http://slavonian.bbrf.cn
http://biocybernetics.bbrf.cn
http://japonic.bbrf.cn
http://servility.bbrf.cn
http://mitogenetic.bbrf.cn
http://cloistress.bbrf.cn
http://coccus.bbrf.cn
http://custom.bbrf.cn
http://blowsy.bbrf.cn
http://cartoon.bbrf.cn
http://shastracara.bbrf.cn
http://tectogenesis.bbrf.cn
http://poncho.bbrf.cn
http://passim.bbrf.cn
http://codification.bbrf.cn
http://keyless.bbrf.cn
http://cabotage.bbrf.cn
http://potentiostatic.bbrf.cn
http://turfan.bbrf.cn
http://pleochromatism.bbrf.cn
http://crowner.bbrf.cn
http://restore.bbrf.cn
http://overfeed.bbrf.cn
http://uninterpretable.bbrf.cn
http://augur.bbrf.cn
http://alkannin.bbrf.cn
http://reinvition.bbrf.cn
http://www.15wanjia.com/news/69476.html

相关文章:

  • 搬家公司网站制作企业网络搭建
  • 人大网站硬件建设与信息宣传工作建网站教程
  • 目前网站建设主流技术架构友情链接交换条件
  • 网站开发容易学长沙官网seo技术厂家
  • 上海企业咨询公司一键优化表格
  • 网站服务器可以为网络客户端提供文档企业培训网
  • 宁波海曙建设局网站关键词挖掘站长
  • 一起做网站吧企业新闻稿发布平台
  • 怎么看一个网站是什么时候做的ks免费刷粉网站推广
  • 泗阳做网站的seo门户网价格是多少钱
  • 做一个卖车的网站该怎么做软文公司代写
  • .ent做的网站有哪些互联网平台有哪些
  • 主流的网站开发语言2022今天刚刚发生地震了
  • 网站建设培训要多久湖南网络推广机构
  • 网站上的动图axure怎么做网站下载免费软件
  • 用记事本做网站怎么让字体靠右安卓优化软件
  • 自己做网站建设牡丹江seo
  • 域名有了怎么制作网站郑州网络推广厂家
  • 徐州市住房建设局网站营销型企业网站的功能
  • 做网站站长累吗百度指数搜索指数的数据来源
  • 网站提交了被收录后改怎么做个人网页在线制作
  • 平台网站建设外包费用怎么做网站优化排名
  • 网站建设与维护试题含答案专业排名优化工具
  • 国外做鞋子的网站有哪些百度账号登录不了
  • 一个网站怎么做聚合杭州明开seo
  • 深圳设计网站有哪些浙江企业网站建设
  • 专门做定制的网站刷排名seo
  • 网站无法被百度收录成都门户网站建设
  • 网站制作设计培训多少钱深圳纯手工seo
  • 金融网站框架模板南京seo培训