+ * 文章信息表,存储已发布的文章 + *
+ * + * @author itheima + */ + +@Data +@TableName("ap_article") +public class ApArticle implements Serializable { + + @TableId(value = "id",type = IdType.ASSIGN_ID) + 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; +} diff --git a/heima-leadnews-model/src/main/java/com/heima/model/article/pojos/ApArticleConfig.java b/heima-leadnews-model/src/main/java/com/heima/model/article/pojos/ApArticleConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..22759ae833a5189cc11aad5207c5cd070e670572 --- /dev/null +++ b/heima-leadnews-model/src/main/java/com/heima/model/article/pojos/ApArticleConfig.java @@ -0,0 +1,73 @@ +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; + +/** + *+ * APP已发布文章配置表 + *
+ * + * @author itheima + */ + +@Data +@TableName("ap_article_config") +public class ApArticleConfig implements Serializable { + + public ApArticleConfig(){} + + public ApArticleConfig(Long articleId) { + this.articleId = articleId; + this.isComment = true; + this.isForward = true; + this.isDown = false; + this.isDelete = false; + } + + @TableId(value = "id",type = IdType.ASSIGN_ID) + 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; +} diff --git a/heima-leadnews-model/src/main/java/com/heima/model/article/pojos/ApArticleContent.java b/heima-leadnews-model/src/main/java/com/heima/model/article/pojos/ApArticleContent.java new file mode 100644 index 0000000000000000000000000000000000000000..c71583f523cc24ce8ebbea2d52530368998892aa --- /dev/null +++ b/heima-leadnews-model/src/main/java/com/heima/model/article/pojos/ApArticleContent.java @@ -0,0 +1,28 @@ +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.ASSIGN_ID) + private Long id; + + /** + * 文章id + */ + @TableField("article_id") + private Long articleId; + + /** + * 文章内容 + */ + private String content; +} diff --git a/heima-leadnews-model/src/main/java/com/heima/model/article/vos/ApArticleVo.java b/heima-leadnews-model/src/main/java/com/heima/model/article/vos/ApArticleVo.java new file mode 100644 index 0000000000000000000000000000000000000000..b083a5f7b135b9080129a61b203a821916f41b83 --- /dev/null +++ b/heima-leadnews-model/src/main/java/com/heima/model/article/vos/ApArticleVo.java @@ -0,0 +1,125 @@ +package com.heima.model.article.vos; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + *+ * 文章信息表,存储已发布的文章 + *
+ * + * @author itheima + */ + +@Data +public class ApArticleVo implements Serializable { + + private String id; + + /** + * 标题 + */ + private String title; + + /** + * 作者id + */ + private Long authorId; + + /** + * 作者名称 + */ + private String authorName; + + /** + * 频道id + */ + private Integer channelId; + + /** + * 频道名称 + */ + 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; + + /** + * 省市 + */ + private Integer provinceId; + + /** + * 市区 + */ + private Integer cityId; + + /** + * 区县 + */ + private Integer countyId; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 发布时间 + */ + private Date publishTime; + + /** + * 同步状态 + */ + private Boolean syncStatus; + + /** + * 来源 + */ + private Boolean origin; + + /** + * 静态页面地址 + */ + private String staticUrl; +} diff --git a/heima-leadnews-model/src/main/java/com/heima/model/article/vos/HotArticleVo.java b/heima-leadnews-model/src/main/java/com/heima/model/article/vos/HotArticleVo.java new file mode 100644 index 0000000000000000000000000000000000000000..fd93e1bacf6e5c2dc2c896c3b3647567a5b7c9c5 --- /dev/null +++ b/heima-leadnews-model/src/main/java/com/heima/model/article/vos/HotArticleVo.java @@ -0,0 +1,22 @@ +package com.heima.model.article.vos; + +import com.heima.model.article.pojos.ApArticle; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @author ghy + * @version 1.0.1 + * @date 2024-07-17 11:42:42 + */ +@Data +@NoArgsConstructor //无参构造器 +@AllArgsConstructor //全参构造器 +@Builder //构建者设计模式 +public class HotArticleVo extends ApArticle { + + private Integer score; + +} diff --git a/heima-leadnews-model/src/main/java/com/heima/model/common/enums/AppHttpCodeEnum.java b/heima-leadnews-model/src/main/java/com/heima/model/common/enums/AppHttpCodeEnum.java index 6e7374f351402292196cbc294b111112e1a6cac4..7f850c4d379071c1fe538ae380c06018d2b64100 100644 --- a/heima-leadnews-model/src/main/java/com/heima/model/common/enums/AppHttpCodeEnum.java +++ b/heima-leadnews-model/src/main/java/com/heima/model/common/enums/AppHttpCodeEnum.java @@ -10,6 +10,7 @@ public enum AppHttpCodeEnum { // 登录段1~50 NEED_LOGIN(1,"需要登录后操作"), LOGIN_PASSWORD_ERROR(2,"密码错误"), + PHONE_OR_PASSWORD_ERROR(3,"手机号或密码错误"), // TOKEN50~100 TOKEN_INVALID(50,"无效的TOKEN"), TOKEN_EXPIRE(51,"TOKEN已过期"), @@ -17,6 +18,11 @@ public enum AppHttpCodeEnum { // SIGN验签 100~120 SIGN_INVALID(100,"无效的SIGN"), SIG_TIMEOUT(101,"SIGN已过期"), + // 增删改失败 + INSERT_FAIL(110,"增加失败"), + UPDATE_FAIL(111,"更新失败"), + DELETE_FAIL(112,"删除失败"), + // 参数错误 500~1000 PARAM_REQUIRE(500,"缺少参数"), PARAM_INVALID(501,"无效参数"), @@ -26,6 +32,22 @@ public enum AppHttpCodeEnum { DATA_EXIST(1000,"数据已经存在"), AP_USER_DATA_NOT_EXIST(1001,"ApUser数据不存在"), DATA_NOT_EXIST(1002,"数据不存在"), + FILE_UPLOAD_ERROR(1003,"文件上传错误"), + WM_MATERIAL_DATA_NOT_EXIST(1004,"素材不存在"), + NEWS_PUBLISHED_FAILED(1005,"文章发布失败"), + AP_ARTICLE_INSERT_FAIL(1006,"APP端文章增加失败"), + AP_ARTICLE_CONFIG_INSERT_FAIL(1007,"APP端文章配置增加失败"), + AP_ARTICLE_CONTENT_INSERT_FAIL(1008,"APP端文章内容增加失败"), + AP_ARTICLE_UPDATE_FAIL(1009,"APP端文章更新失败"), + AP_ARTICLE_CONTENT_UPDATE_FAIL(1010,"APP端文章内容更新失败"), + WM_NEWS_DATA_NOT_EXIST(1011,"自媒体端文章不存在"), + WM_NEWS_STATUS_NOT_SUBMIT(1012,"自媒体端文章状态不是待审核"), + TEXT_AUDIT_EX(1013,"文本审核异常"), + IMAGE_AUDIT_EX(1014,"图片审核异常"), + WM_NEWS_STATUS_NOT_PUBLISH(1015,"自媒体端文章状态不是发布状态"), + + + // 数据错误 3000~3500 NO_OPERATOR_AUTH(3000,"无权限操作"), NEED_ADMIN(3001,"需要管理员权限"); diff --git a/heima-leadnews-model/src/main/java/com/heima/model/search/dtos/UserSearchDto.java b/heima-leadnews-model/src/main/java/com/heima/model/search/dtos/UserSearchDto.java new file mode 100644 index 0000000000000000000000000000000000000000..a1e9b263c44d1d9404e18927e9662c31681862c8 --- /dev/null +++ b/heima-leadnews-model/src/main/java/com/heima/model/search/dtos/UserSearchDto.java @@ -0,0 +1,37 @@ +package com.heima.model.search.dtos; + +import lombok.Data; + +import java.util.Date; + + +@Data +public class UserSearchDto { + + /** + * 搜索关键字 + */ + String searchWords; + /** + * 当前页 + */ + int pageNum; + /** + * 分页条数 + */ + int pageSize; + /** + * 最小时间 + */ + Date minBehotTime; + + /** + * 获取当前页搜索的起始下标 + * @return + */ + public int getFromIndex(){ + if(this.pageNum<1) return 0; + if(this.pageSize<1) this.pageSize = 10; + return this.pageSize * (pageNum-1); + } +} \ No newline at end of file diff --git a/heima-leadnews-model/src/main/java/com/heima/model/search/vos/SearchArticleVo.java b/heima-leadnews-model/src/main/java/com/heima/model/search/vos/SearchArticleVo.java new file mode 100644 index 0000000000000000000000000000000000000000..bdf2bf06dca1719d2a5abb763fde03c70860a2ea --- /dev/null +++ b/heima-leadnews-model/src/main/java/com/heima/model/search/vos/SearchArticleVo.java @@ -0,0 +1,36 @@ +package com.heima.model.search.vos; + +import lombok.Data; + +import java.util.Date; + +/** + * 返回给前端的搜索实体 + */ +@Data +public class SearchArticleVo { + + // 文章id + private Long id; + // 文章标题 + private String title; + + // 高亮字段 + private String h_title; + + // 文章发布时间 + private Date publishTime; + // 文章布局 + private Integer layout; + // 封面 + private String images; + // 作者id + private Long authorId; + // 作者名词 + private String authorName; + //静态url + private String staticUrl; + //文章内容 + private String content; + +} \ No newline at end of file diff --git a/heima-leadnews-model/src/main/java/com/heima/model/user/dtos/LoginDto.java b/heima-leadnews-model/src/main/java/com/heima/model/user/dtos/LoginDto.java new file mode 100644 index 0000000000000000000000000000000000000000..3d36c8e239edda8ddc8c3ab4ca4c777dd00c7014 --- /dev/null +++ b/heima-leadnews-model/src/main/java/com/heima/model/user/dtos/LoginDto.java @@ -0,0 +1,34 @@ +package com.heima.model.user.dtos; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 登录DTO + * + * @author admin + * @name LoginDto + * @date 2022-08-11 21:51 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@ApiModel(description = "用户登录实体") +public class LoginDto { + + /** + * 手机号 + */ + @ApiModelProperty("手机号") + private String phone; + + /** + * 密码,是未加密的 + */ + @ApiModelProperty("密码") + private String password; + +} \ No newline at end of file diff --git a/heima-leadnews-model/src/main/java/com/heima/model/user/pojos/ApUser.java b/heima-leadnews-model/src/main/java/com/heima/model/user/pojos/ApUser.java new file mode 100644 index 0000000000000000000000000000000000000000..1a546209a156852a802b5a0e1aca51712a095938 --- /dev/null +++ b/heima-leadnews-model/src/main/java/com/heima/model/user/pojos/ApUser.java @@ -0,0 +1,103 @@ +package com.heima.model.user.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; + +/** + *+ * APP用户信息表 + *
+ * + * @author itheima + */ +@Data +@TableName("ap_user") +public class ApUser implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + /** + * 密码、通信等加密盐 + */ + @TableField("salt") + private String salt; + + /** + * 用户名 + */ + @TableField("name") + private String name; + + /** + * 密码,md5加密 + */ + @TableField("password") + private String password; + + /** + * 手机号 + */ + @TableField("phone") + private String phone; + + /** + * 头像 + */ + @TableField("image") + private String image; + + /** + * 0 男 + 1 女 + 2 未知 + */ + @TableField("sex") + private Boolean sex; + + /** + * 0 未 + 1 是 + */ + @TableField("is_certification") + private Boolean certification; + + /** + * 是否身份认证 + */ + @TableField("is_identity_authentication") + private Boolean identityAuthentication; + + /** + * 0正常 + 1锁定 + */ + @TableField("status") + private Boolean status; + + /** + * 0 普通用户 + 1 自媒体人 + 2 大V + */ + @TableField("flag") + private Short flag; + + /** + * 注册时间 + */ + @TableField("created_time") + private Date createdTime; + +} \ No newline at end of file diff --git a/heima-leadnews-model/src/main/java/com/heima/model/wemedia/dtos/ContentDto.java b/heima-leadnews-model/src/main/java/com/heima/model/wemedia/dtos/ContentDto.java new file mode 100644 index 0000000000000000000000000000000000000000..e3c6f2702628e3a4712e4f1bad8ca52f76efdcd2 --- /dev/null +++ b/heima-leadnews-model/src/main/java/com/heima/model/wemedia/dtos/ContentDto.java @@ -0,0 +1,23 @@ +package com.heima.model.wemedia.dtos; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 文章内容对应实体 + * @author ghy + * @version 1.0.1 + * @date 2024-07-08 10:44:18 + */ +@Data +@NoArgsConstructor //无参构造器 +@AllArgsConstructor //全参构造器 +@Builder //构建者设计模式 +public class ContentDto { + + private String type; + private String value; + +} diff --git a/heima-leadnews-model/src/main/java/com/heima/model/wemedia/dtos/ContentImagesDto.java b/heima-leadnews-model/src/main/java/com/heima/model/wemedia/dtos/ContentImagesDto.java new file mode 100644 index 0000000000000000000000000000000000000000..0908138669acf0a456c4f9c5ff5d8838127297f5 --- /dev/null +++ b/heima-leadnews-model/src/main/java/com/heima/model/wemedia/dtos/ContentImagesDto.java @@ -0,0 +1,23 @@ +package com.heima.model.wemedia.dtos; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +/** + * @author ghy + * @version 1.0.1 + * @date 2024-07-09 08:56:40 + */ +@Data +@NoArgsConstructor //无参构造器 +@AllArgsConstructor //全参构造器 +@Builder //构建者设计模式 +public class ContentImagesDto { + + private String content; + private List+ * 频道信息表 + *
+ * + * @author itheima + */ +@Data +@TableName("wm_channel") +public class WmChannel implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + /** + * 频道名称 + */ + @TableField("name") + private String name; + + /** + * 频道描述 + */ + @TableField("description") + private String description; + + /** + * 是否默认频道 + * 1:默认 true + * 0:非默认 false + */ + @TableField("is_default") + private Boolean isDefault; + + /** + * 是否启用 + * 1:启用 true + * 0:禁用 false + */ + @TableField("status") + private Boolean status; + + /** + * 默认排序 + */ + @TableField("ord") + private Integer ord; + + /** + * 创建时间 + */ + @TableField("created_time") + private Date createdTime; + +} \ No newline at end of file diff --git a/heima-leadnews-model/src/main/java/com/heima/model/wemedia/pojos/WmMaterial.java b/heima-leadnews-model/src/main/java/com/heima/model/wemedia/pojos/WmMaterial.java new file mode 100644 index 0000000000000000000000000000000000000000..0ec894307f9c4b18e76d124c7941817f9c2ef811 --- /dev/null +++ b/heima-leadnews-model/src/main/java/com/heima/model/wemedia/pojos/WmMaterial.java @@ -0,0 +1,61 @@ +package com.heima.model.wemedia.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; + +/** + *+ * 自媒体图文素材信息表 + *
+ * + * @author itheima + */ +@Data +@TableName("wm_material") +public class WmMaterial implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + /** + * 自媒体用户ID + */ + @TableField("user_id") + private Integer userId; + + /** + * 图片地址 + */ + @TableField("url") + private String url; + + /** + * 素材类型 0图片 1视频 + */ + @TableField("type") + private Short type; + + /** + * 是否收藏 + */ + @TableField("is_collection") + private Short isCollection; + + /** + * 创建时间 + */ + @TableField("created_time") + private Date createdTime; + +} \ No newline at end of file diff --git a/heima-leadnews-model/src/main/java/com/heima/model/wemedia/pojos/WmNews.java b/heima-leadnews-model/src/main/java/com/heima/model/wemedia/pojos/WmNews.java new file mode 100644 index 0000000000000000000000000000000000000000..b8dcc06bf5d5d3f6284b73c90b7e6356e055a008 --- /dev/null +++ b/heima-leadnews-model/src/main/java/com/heima/model/wemedia/pojos/WmNews.java @@ -0,0 +1,133 @@ +package com.heima.model.wemedia.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 org.apache.ibatis.type.Alias; + +import java.io.Serializable; +import java.util.Date; + +/** + *+ * 自媒体图文内容信息表 + *
+ * + * @author itheima + */ +@Data +@TableName("wm_news") +public class WmNews implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + /** + * 自媒体用户ID + */ + @TableField("user_id") + private Integer userId; + + /** + * 标题 + */ + @TableField("title") + private String title; + + /** + * 图文内容 + */ + @TableField("content") + private String content; + + /** + * 文章布局 + 0 无图文章 + 1 单图文章 + 3 多图文章 + */ + @TableField("type") + private Short type; + + /** + * 图文频道ID + */ + @TableField("channel_id") + private Integer channelId; + + @TableField("labels") + private String labels; + + /** + * 创建时间 + */ + @TableField("created_time") + private Date createdTime; + + /** + * 提交时间 + */ + @TableField("submited_time") + private Date submitedTime; + + /** + * 当前状态 + 0 草稿 + 1 提交(待审核) + 2 审核失败 + 3 人工审核 + 4 人工审核通过 + 8 审核通过(待发布) + 9 已发布 + */ + @TableField("status") + private Short status; + + /** + * 定时发布时间,不定时则为空 + */ + @TableField("publish_time") + private Date publishTime; + + /** + * 拒绝理由 + */ + @TableField("reason") + private String reason; + + /** + * 发布库文章ID + */ + @TableField("article_id") + private Long articleId; + + /** + * //图片用逗号分隔 + */ + @TableField("images") + private String images; + + @TableField("enable") + private Short enable; + + //状态枚举类 + @Alias("WmNewsStatus") + public enum Status{ + NORMAL((short)0),SUBMIT((short)1),FAIL((short)2),ADMIN_AUTH((short)3),ADMIN_SUCCESS((short)4),SUCCESS((short)8),PUBLISHED((short)9); + short code; + Status(short code){ + this.code = code; + } + public short getCode(){ + return this.code; + } + } + +} \ No newline at end of file diff --git a/heima-leadnews-model/src/main/java/com/heima/model/wemedia/pojos/WmNewsMaterial.java b/heima-leadnews-model/src/main/java/com/heima/model/wemedia/pojos/WmNewsMaterial.java new file mode 100644 index 0000000000000000000000000000000000000000..1db4e6a743d608a2be5219ee5fc7673f57b0a0a3 --- /dev/null +++ b/heima-leadnews-model/src/main/java/com/heima/model/wemedia/pojos/WmNewsMaterial.java @@ -0,0 +1,56 @@ +package com.heima.model.wemedia.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; + +/** + *+ * 自媒体图文引用素材信息表 + *
+ * + * @author itheima + */ +@Data +@TableName("wm_news_material") +public class WmNewsMaterial implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + /** + * 素材ID + */ + @TableField("material_id") + private Integer materialId; + + /** + * 图文ID + */ + @TableField("news_id") + private Integer newsId; + + /** + * 引用类型 + 0 内容引用 + 1 主图引用 + */ + @TableField("type") + private Short type; + + /** + * 引用排序 + */ + @TableField("ord") + private Short ord; + +} \ No newline at end of file diff --git a/heima-leadnews-model/src/main/java/com/heima/model/wemedia/pojos/WmSensitive.java b/heima-leadnews-model/src/main/java/com/heima/model/wemedia/pojos/WmSensitive.java new file mode 100644 index 0000000000000000000000000000000000000000..77a23be40bd180db4e2b5bdb64991c38fa1362d8 --- /dev/null +++ b/heima-leadnews-model/src/main/java/com/heima/model/wemedia/pojos/WmSensitive.java @@ -0,0 +1,43 @@ +package com.heima.model.wemedia.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; + +/** + *+ * 敏感词信息表 + *
+ * + * @author itheima + */ +@Data +@TableName("wm_sensitive") +public class WmSensitive implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + /** + * 敏感词 + */ + @TableField("sensitives") + private String sensitives; + + /** + * 创建时间 + */ + @TableField("created_time") + private Date createdTime; + +} \ No newline at end of file diff --git a/heima-leadnews-model/src/main/java/com/heima/model/wemedia/pojos/WmUser.java b/heima-leadnews-model/src/main/java/com/heima/model/wemedia/pojos/WmUser.java new file mode 100644 index 0000000000000000000000000000000000000000..a9e028fa5bcf36cb93b7d78733cbb0dfb65158f4 --- /dev/null +++ b/heima-leadnews-model/src/main/java/com/heima/model/wemedia/pojos/WmUser.java @@ -0,0 +1,121 @@ +package com.heima.model.wemedia.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; + +/** + *+ * 自媒体用户信息表 + *
+ * + * @author itheima + */ +@Data +@TableName("wm_user") +public class WmUser implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @TableField("ap_user_id") + private Integer apUserId; + + @TableField("ap_author_id") + private Integer apAuthorId; + + /** + * 登录用户名 + */ + @TableField("name") + private String name; + + /** + * 登录密码 + */ + @TableField("password") + private String password; + + /** + * 盐 + */ + @TableField("salt") + private String salt; + + /** + * 昵称 + */ + @TableField("nickname") + private String nickname; + + /** + * 头像 + */ + @TableField("image") + private String image; + + /** + * 归属地 + */ + @TableField("location") + private String location; + + /** + * 手机号 + */ + @TableField("phone") + private String phone; + + /** + * 状态 + 0 暂时不可用 + 1 永久不可用 + 9 正常可用 + */ + @TableField("status") + private Integer status; + + /** + * 邮箱 + */ + @TableField("email") + private String email; + + /** + * 账号类型 + 0 个人 + 1 企业 + 2 子账号 + */ + @TableField("type") + private Integer type; + + /** + * 运营评分 + */ + @TableField("score") + private Integer score; + + /** + * 最后一次登录时间 + */ + @TableField("login_time") + private Date loginTime; + + /** + * 创建时间 + */ + @TableField("created_time") + private Date createdTime; + +} \ No newline at end of file diff --git a/heima-leadnews-service/heima-leadnews-article/pom.xml b/heima-leadnews-service/heima-leadnews-article/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..4ed7336a48ff3a69db557b7ba0fc62ab038dc2db --- /dev/null +++ b/heima-leadnews-service/heima-leadnews-article/pom.xml @@ -0,0 +1,51 @@ + ++ * APP已发布文章配置表 Mapper 接口 + *
+ * + * @author ghy + * @since 2023-09-21 + */ +@Mapper +public interface ApArticleConfigMapper extends BaseMapper+ * APP已发布文章内容表 Mapper 接口 + *
+ * + * @author ghy + * @since 2023-09-21 + */ +@Mapper +public interface ApArticleContentMapper extends BaseMapper+ * 文章信息表,存储已发布的文章 Mapper 接口 + *
+ * + * @author ghy + * @since 2023-09-21 + */ +@Mapper +public interface ApArticleMapper extends BaseMapper+ * APP已发布文章配置表 服务类 + *
+ * + * @author ghy + * @since 2023-09-21 + */ +public interface ApArticleConfigService extends IService+ * APP已发布文章内容表 服务类 + *
+ * + * @author ghy + * @since 2023-09-21 + */ +public interface ApArticleContentService extends IService+ * 文章信息表,存储已发布的文章 服务类 + *
+ * + * @author ghy + * @since 2023-09-21 + */ +public interface ApArticleService extends IService+ * APP已发布文章配置表 服务实现类 + *
+ * + * @author ghy + * @since 2023-09-21 + */ +@Service +public class ApArticleConfigServiceImpl extends ServiceImpl+ * APP已发布文章内容表 服务实现类 + *
+ * + * @author ghy + * @since 2023-09-21 + */ +@Service +public class ApArticleContentServiceImpl extends ServiceImpl+ * 文章信息表,存储已发布的文章 服务实现类 + *
+ * + * @author ghy + * @since 2023-09-21 + */ +@Service +public class ApArticleServiceImpl extends ServiceImpl+ * 联想词表 + *
+ * + * @author itheima + */ +@Data +@Document("ap_associate_words") //用来映射实体与文档的对应关系 +public class ApAssociateWords implements Serializable { + + private static final long serialVersionUID = 1L; + + private String id; + + /** + * 联想词 + */ + private String associateWords; + + /** + * 创建时间 + */ + private Date createdTime; + +} \ No newline at end of file diff --git a/heima-leadnews-service/heima-leadnews-search/src/main/java/com/heima/search/pojos/ApUserSearch.java b/heima-leadnews-service/heima-leadnews-search/src/main/java/com/heima/search/pojos/ApUserSearch.java new file mode 100644 index 0000000000000000000000000000000000000000..33771fcda530cbf18c5c829395c250e494802005 --- /dev/null +++ b/heima-leadnews-service/heima-leadnews-search/src/main/java/com/heima/search/pojos/ApUserSearch.java @@ -0,0 +1,42 @@ +package com.heima.search.pojos; + +import lombok.Data; +import org.springframework.data.mongodb.core.mapping.Document; + +import java.io.Serializable; +import java.util.Date; + +/** + *+ * APP用户搜索信息表 + *
+ * @author itheima + */ +@Data +@Document("ap_user_search") +public class ApUserSearch implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 用户ID + */ + private Integer userId; + + /** + * 搜索词 + */ + private String keyword; + + /** + * 创建时间 + */ + //private String createdTime; + private Date createdTime; + +} \ No newline at end of file diff --git a/heima-leadnews-service/heima-leadnews-search/src/main/java/com/heima/search/service/ApAssociateWordsService.java b/heima-leadnews-service/heima-leadnews-search/src/main/java/com/heima/search/service/ApAssociateWordsService.java new file mode 100644 index 0000000000000000000000000000000000000000..d46b4116dc742d96cbfa6c50b736a0735991736a --- /dev/null +++ b/heima-leadnews-service/heima-leadnews-search/src/main/java/com/heima/search/service/ApAssociateWordsService.java @@ -0,0 +1,16 @@ +package com.heima.search.service; + +import com.heima.model.common.dtos.ResponseResult; +import com.heima.model.search.dtos.UserSearchDto; +import org.springframework.web.bind.annotation.RequestBody; + +/** + * @author ghy + * @version 1.0.1 + * @date 2024-07-15 17:18:58 + */ +public interface ApAssociateWordsService { + + ResponseResult search(@RequestBody UserSearchDto userSearchDto); + +} diff --git a/heima-leadnews-service/heima-leadnews-search/src/main/java/com/heima/search/service/ApUserSearchService.java b/heima-leadnews-service/heima-leadnews-search/src/main/java/com/heima/search/service/ApUserSearchService.java new file mode 100644 index 0000000000000000000000000000000000000000..fb91072f9afa0d06097d1e483e2c7179d0efa9cd --- /dev/null +++ b/heima-leadnews-service/heima-leadnews-search/src/main/java/com/heima/search/service/ApUserSearchService.java @@ -0,0 +1,17 @@ +package com.heima.search.service; + +/** + * @author ghy + * @version 1.0.1 + * @date 2024-07-15 14:57:10 + */ +public interface ApUserSearchService { + + /** + * 保存用户搜索记录 + * @param keyword + * @param userId + */ + void save(String keyword, Integer userId); + +} diff --git a/heima-leadnews-service/heima-leadnews-search/src/main/java/com/heima/search/service/ArticleSearchService.java b/heima-leadnews-service/heima-leadnews-search/src/main/java/com/heima/search/service/ArticleSearchService.java new file mode 100644 index 0000000000000000000000000000000000000000..1b25090c5593a2d92315edc8466b4d8981b59123 --- /dev/null +++ b/heima-leadnews-service/heima-leadnews-search/src/main/java/com/heima/search/service/ArticleSearchService.java @@ -0,0 +1,21 @@ +package com.heima.search.service; + +import com.heima.model.common.dtos.ResponseResult; +import com.heima.model.search.dtos.UserSearchDto; +import org.springframework.web.bind.annotation.RequestBody; + +/** + * @author ghy + * @version 1.0.1 + * @date 2024-07-14 17:43:58 + */ +public interface ArticleSearchService { + + /** + * 搜索框搜索 + * @param dto + * @return + */ + ResponseResult search(@RequestBody UserSearchDto dto) throws Exception; + +} diff --git a/heima-leadnews-service/heima-leadnews-search/src/main/java/com/heima/search/service/impl/ApAssociateWordsServiceImpl.java b/heima-leadnews-service/heima-leadnews-search/src/main/java/com/heima/search/service/impl/ApAssociateWordsServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..5b504f22a8b0e9058dd6574d9816db44de4bb2ea --- /dev/null +++ b/heima-leadnews-service/heima-leadnews-search/src/main/java/com/heima/search/service/impl/ApAssociateWordsServiceImpl.java @@ -0,0 +1,50 @@ +package com.heima.search.service.impl; + +import com.heima.common.exception.CustomException; +import com.heima.model.common.dtos.ResponseResult; +import com.heima.model.common.enums.AppHttpCodeEnum; +import com.heima.model.search.dtos.UserSearchDto; +import com.heima.search.pojos.ApAssociateWords; +import com.heima.search.service.ApAssociateWordsService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Sort; +import org.springframework.data.mongodb.core.MongoTemplate; +import org.springframework.data.mongodb.core.query.Criteria; +import org.springframework.data.mongodb.core.query.Query; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.regex.Pattern; + + +/** + * @author ghy + * @version 1.0.1 + * @date 2024-07-15 17:19:31 + */ +@Service +@Slf4j +public class ApAssociateWordsServiceImpl implements ApAssociateWordsService { + + @Autowired + private MongoTemplate mongoTemplate; + + @Override + public ResponseResult search(UserSearchDto userSearchDto) { + if(userSearchDto == null || StringUtils.isBlank(userSearchDto.getSearchWords())) { + throw new CustomException(AppHttpCodeEnum.PARAM_INVALID); + } + if(userSearchDto.getPageSize() <= 0 || userSearchDto.getPageSize() > 10){ + userSearchDto.setPageSize(10); + } + Query query = Query.query( + Criteria.where("associateWords") + .regex(Pattern.compile("^.*" + userSearchDto.getSearchWords() + ".*$", Pattern.CASE_INSENSITIVE))) + .with(Sort.by(Sort.Direction.DESC, "createdTime")) + .limit(userSearchDto.getPageSize()); + List| 序号 | +姓名 | +年龄 | +钱包 | +
| ${stu_index+1} | +${stu.name} | +${stu.age} | +${stu.money} | +
| ${stu_index+1} | +${stu.name} | +${stu.age} | +${stu.money} | +
| 序号 | +姓名 | +年龄 | +钱包 | +
| ${key_index} | +${stuMap[key].name} | +${stuMap[key].age} | +${stuMap[key].money} | +
+ * 联想词表 + *
+ * + * @author itheima + */ +@Data +@Document("ap_associate_words") //用来映射实体与文档的对应关系 +public class ApAssociateWords implements Serializable { + + private static final long serialVersionUID = 1L; + + private String id; + + /** + * 联想词 + */ + private String associateWords; + + /** + * 创建时间 + */ + private Date createdTime; + +} \ No newline at end of file diff --git a/heima-leadnews-test/mongo-demo/src/main/java/com/itheima/mongo/pojo/ApUserSearch.java b/heima-leadnews-test/mongo-demo/src/main/java/com/itheima/mongo/pojo/ApUserSearch.java new file mode 100644 index 0000000000000000000000000000000000000000..7e26d42fdb4f7903e5488a03f276c7ceb0b78054 --- /dev/null +++ b/heima-leadnews-test/mongo-demo/src/main/java/com/itheima/mongo/pojo/ApUserSearch.java @@ -0,0 +1,42 @@ +package com.itheima.mongo.pojo; + +import lombok.Data; +import org.springframework.data.mongodb.core.mapping.Document; + +import java.io.Serializable; +import java.util.Date; + +/** + *+ * APP用户搜索信息表 + *
+ * @author itheima + */ +@Data +@Document("ap_user_search") +public class ApUserSearch implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 用户ID + */ + private Integer userId; + + /** + * 搜索词 + */ + private String keyword; + + /** + * 创建时间 + */ + //private String createdTime; + private Date createdTime; + +} \ No newline at end of file diff --git a/heima-leadnews-test/mongo-demo/src/main/resources/application.yml b/heima-leadnews-test/mongo-demo/src/main/resources/application.yml new file mode 100644 index 0000000000000000000000000000000000000000..9d76bb1bd9948590f9f4c5707b7693292455bdaf --- /dev/null +++ b/heima-leadnews-test/mongo-demo/src/main/resources/application.yml @@ -0,0 +1,8 @@ +server: + port: 9998 +spring: + data: + mongodb: + host: 192.168.200.130 + port: 27017 + database: leadnews-history \ No newline at end of file diff --git a/heima-leadnews-test/mongo-demo/src/test/java/com/itheima/mongo/test/MongoTest.java b/heima-leadnews-test/mongo-demo/src/test/java/com/itheima/mongo/test/MongoTest.java new file mode 100644 index 0000000000000000000000000000000000000000..f74e0d09585cc3d099935c39ecc0869126495a1b --- /dev/null +++ b/heima-leadnews-test/mongo-demo/src/test/java/com/itheima/mongo/test/MongoTest.java @@ -0,0 +1,80 @@ +package com.itheima.mongo.test; + + +import com.itheima.mongo.MongoApplication; +import com.itheima.mongo.pojo.ApAssociateWords; +import com.itheima.mongo.pojo.ApUserSearch; +import com.mongodb.client.result.DeleteResult; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.data.mongodb.core.MongoTemplate; +import org.springframework.data.mongodb.core.query.Criteria; +import org.springframework.data.mongodb.core.query.Query; + +import java.util.Date; +import java.util.List; + +@SpringBootTest(classes = MongoApplication.class) +public class MongoTest { + + @Autowired + private MongoTemplate mongoTemplate; + + /** + * + * @throws Exception + */ + @Test + public void Test() throws Exception { + Query query = Query.query(Criteria.where("keyword").is("测试搜索4").and("userId").is(1)); + ApUserSearch apUserSearch = mongoTemplate.findOne(query, ApUserSearch.class); + System.out.println(apUserSearch); + } + + //保存 + @Test + public void saveTest(){ + ApAssociateWords apAssociateWords = new ApAssociateWords(); + apAssociateWords.setAssociateWords("测试"); + apAssociateWords.setCreatedTime(new Date()); + ApAssociateWords words = mongoTemplate.save(apAssociateWords); + System.out.println(words); + } + + //根据ID查询一个 + @Test + public void saveFindById(){ + ApAssociateWords associateWords = mongoTemplate.findById("669499a234d38e625fafb701", ApAssociateWords.class); + System.out.println(associateWords); + } + + //根据条件查询一个 + @Test + public void saveFindOne(){ + Query query = Query.query( + Criteria.where("associateWords").is("测试")); + ApAssociateWords associateWords = mongoTemplate.findOne(query, ApAssociateWords.class); + System.out.println(associateWords); + } + + //条件查询 + @Test + public void testQuery(){ + Query query = Query.query( + Criteria.where("createdTime") + .gt(java.sql.Date.valueOf("2020-01-01")) + .and("associateWords").in("测试") + ); + List