feat: 新增文章、标签服务及接口.
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
package com.serliunx.blog.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 文章实体表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author <a href="mailto:root@serliunx.com">SerLiunx</a>
|
||||
* @since 2025-08-09
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/pb-article")
|
||||
public class PbArticleController {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.serliunx.blog.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 标签实体表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author <a href="mailto:root@serliunx.com">SerLiunx</a>
|
||||
* @since 2025-08-09
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/pb-tag")
|
||||
public class PbTagController {
|
||||
|
||||
}
|
||||
73
src/main/java/com/serliunx/blog/entity/PbArticle.java
Normal file
73
src/main/java/com/serliunx/blog/entity/PbArticle.java
Normal file
@@ -0,0 +1,73 @@
|
||||
package com.serliunx.blog.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 文章实体表
|
||||
* </p>
|
||||
*
|
||||
* @author <a href="mailto:root@serliunx.com">SerLiunx</a>
|
||||
* @since 2025-08-09
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@TableName("pb_article")
|
||||
public class PbArticle {
|
||||
|
||||
/**
|
||||
* 文章ID
|
||||
*/
|
||||
@TableId("id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 文章标题
|
||||
*/
|
||||
@TableField("title")
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 文章摘要
|
||||
*/
|
||||
@TableField("summary")
|
||||
private String summary;
|
||||
|
||||
/**
|
||||
* 封面图URL
|
||||
*/
|
||||
@TableField("cover_image")
|
||||
private String coverImage;
|
||||
|
||||
/**
|
||||
* 阅读量
|
||||
*/
|
||||
@TableField("view_count")
|
||||
private Long viewCount;
|
||||
|
||||
/**
|
||||
* 点赞量
|
||||
*/
|
||||
@TableField("like_count")
|
||||
private Long likeCount;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField("create_time")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 最后编辑时间
|
||||
*/
|
||||
@TableField("last_edit")
|
||||
private LocalDateTime lastEdit;
|
||||
}
|
||||
36
src/main/java/com/serliunx/blog/entity/PbArticleContent.java
Normal file
36
src/main/java/com/serliunx/blog/entity/PbArticleContent.java
Normal file
@@ -0,0 +1,36 @@
|
||||
package com.serliunx.blog.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 文章内容表
|
||||
* </p>
|
||||
*
|
||||
* @author <a href="mailto:root@serliunx.com">SerLiunx</a>
|
||||
* @since 2025-08-09
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@TableName("pb_article_content")
|
||||
public class PbArticleContent {
|
||||
|
||||
/**
|
||||
* 所属文章ID
|
||||
*/
|
||||
@TableId("article_id")
|
||||
private Long articleId;
|
||||
|
||||
/**
|
||||
* 内容
|
||||
*/
|
||||
@TableField("content")
|
||||
private String content;
|
||||
}
|
||||
42
src/main/java/com/serliunx/blog/entity/PbArticleTag.java
Normal file
42
src/main/java/com/serliunx/blog/entity/PbArticleTag.java
Normal file
@@ -0,0 +1,42 @@
|
||||
package com.serliunx.blog.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 文章-标签绑定关系
|
||||
* </p>
|
||||
*
|
||||
* @author <a href="mailto:root@serliunx.com">SerLiunx</a>
|
||||
* @since 2025-08-09
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@TableName("pb_article_tag")
|
||||
public class PbArticleTag {
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@TableId("id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 文章ID
|
||||
*/
|
||||
@TableField("article_id")
|
||||
private Long articleId;
|
||||
|
||||
/**
|
||||
* 标签ID
|
||||
*/
|
||||
@TableField("tag_id")
|
||||
private Long tagId;
|
||||
}
|
||||
36
src/main/java/com/serliunx/blog/entity/PbTag.java
Normal file
36
src/main/java/com/serliunx/blog/entity/PbTag.java
Normal file
@@ -0,0 +1,36 @@
|
||||
package com.serliunx.blog.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 标签实体表
|
||||
* </p>
|
||||
*
|
||||
* @author <a href="mailto:root@serliunx.com">SerLiunx</a>
|
||||
* @since 2025-08-09
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@TableName("pb_tag")
|
||||
public class PbTag {
|
||||
|
||||
/**
|
||||
* 标签ID
|
||||
*/
|
||||
@TableId("id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 标签名称
|
||||
*/
|
||||
@TableField("name")
|
||||
private String name;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.serliunx.blog.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.serliunx.blog.entity.PbArticleContent;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 文章内容表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author <a href="mailto:root@serliunx.com">SerLiunx</a>
|
||||
* @since 2025-08-09
|
||||
*/
|
||||
public interface PbArticleContentMapper extends BaseMapper<PbArticleContent> {
|
||||
|
||||
}
|
||||
16
src/main/java/com/serliunx/blog/mapper/PbArticleMapper.java
Normal file
16
src/main/java/com/serliunx/blog/mapper/PbArticleMapper.java
Normal file
@@ -0,0 +1,16 @@
|
||||
package com.serliunx.blog.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.serliunx.blog.entity.PbArticle;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 文章实体表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author <a href="mailto:root@serliunx.com">SerLiunx</a>
|
||||
* @since 2025-08-09
|
||||
*/
|
||||
public interface PbArticleMapper extends BaseMapper<PbArticle> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.serliunx.blog.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.serliunx.blog.entity.PbArticleTag;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 文章-标签绑定关系 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author <a href="mailto:root@serliunx.com">SerLiunx</a>
|
||||
* @since 2025-08-09
|
||||
*/
|
||||
public interface PbArticleTagMapper extends BaseMapper<PbArticleTag> {
|
||||
|
||||
}
|
||||
16
src/main/java/com/serliunx/blog/mapper/PbTagMapper.java
Normal file
16
src/main/java/com/serliunx/blog/mapper/PbTagMapper.java
Normal file
@@ -0,0 +1,16 @@
|
||||
package com.serliunx.blog.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.serliunx.blog.entity.PbTag;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 标签实体表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author <a href="mailto:root@serliunx.com">SerLiunx</a>
|
||||
* @since 2025-08-09
|
||||
*/
|
||||
public interface PbTagMapper extends BaseMapper<PbTag> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.serliunx.blog.service;
|
||||
|
||||
import com.serliunx.blog.entity.PbArticleContent;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 文章内容表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author <a href="mailto:root@serliunx.com">SerLiunx</a>
|
||||
* @since 2025-08-09
|
||||
*/
|
||||
public interface PbArticleContentService extends IService<PbArticleContent> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.serliunx.blog.service;
|
||||
|
||||
import com.serliunx.blog.entity.PbArticle;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 文章实体表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author <a href="mailto:root@serliunx.com">SerLiunx</a>
|
||||
* @since 2025-08-09
|
||||
*/
|
||||
public interface PbArticleService extends IService<PbArticle> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.serliunx.blog.service;
|
||||
|
||||
import com.serliunx.blog.entity.PbArticleTag;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 文章-标签绑定关系 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author <a href="mailto:root@serliunx.com">SerLiunx</a>
|
||||
* @since 2025-08-09
|
||||
*/
|
||||
public interface PbArticleTagService extends IService<PbArticleTag> {
|
||||
|
||||
}
|
||||
16
src/main/java/com/serliunx/blog/service/PbTagService.java
Normal file
16
src/main/java/com/serliunx/blog/service/PbTagService.java
Normal file
@@ -0,0 +1,16 @@
|
||||
package com.serliunx.blog.service;
|
||||
|
||||
import com.serliunx.blog.entity.PbTag;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 标签实体表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author <a href="mailto:root@serliunx.com">SerLiunx</a>
|
||||
* @since 2025-08-09
|
||||
*/
|
||||
public interface PbTagService extends IService<PbTag> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.serliunx.blog.service.impl;
|
||||
|
||||
import com.serliunx.blog.entity.PbArticleContent;
|
||||
import com.serliunx.blog.mapper.PbArticleContentMapper;
|
||||
import com.serliunx.blog.service.PbArticleContentService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 文章内容表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author <a href="mailto:root@serliunx.com">SerLiunx</a>
|
||||
* @since 2025-08-09
|
||||
*/
|
||||
@Service
|
||||
public class PbArticleContentServiceImpl extends ServiceImpl<PbArticleContentMapper, PbArticleContent> implements PbArticleContentService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.serliunx.blog.service.impl;
|
||||
|
||||
import com.serliunx.blog.entity.PbArticle;
|
||||
import com.serliunx.blog.mapper.PbArticleMapper;
|
||||
import com.serliunx.blog.service.PbArticleService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 文章实体表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author <a href="mailto:root@serliunx.com">SerLiunx</a>
|
||||
* @since 2025-08-09
|
||||
*/
|
||||
@Service
|
||||
public class PbArticleServiceImpl extends ServiceImpl<PbArticleMapper, PbArticle> implements PbArticleService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.serliunx.blog.service.impl;
|
||||
|
||||
import com.serliunx.blog.entity.PbArticleTag;
|
||||
import com.serliunx.blog.mapper.PbArticleTagMapper;
|
||||
import com.serliunx.blog.service.PbArticleTagService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 文章-标签绑定关系 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author <a href="mailto:root@serliunx.com">SerLiunx</a>
|
||||
* @since 2025-08-09
|
||||
*/
|
||||
@Service
|
||||
public class PbArticleTagServiceImpl extends ServiceImpl<PbArticleTagMapper, PbArticleTag> implements PbArticleTagService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.serliunx.blog.service.impl;
|
||||
|
||||
import com.serliunx.blog.entity.PbTag;
|
||||
import com.serliunx.blog.mapper.PbTagMapper;
|
||||
import com.serliunx.blog.service.PbTagService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 标签实体表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author <a href="mailto:root@serliunx.com">SerLiunx</a>
|
||||
* @since 2025-08-09
|
||||
*/
|
||||
@Service
|
||||
public class PbTagServiceImpl extends ServiceImpl<PbTagMapper, PbTag> implements PbTagService {
|
||||
|
||||
}
|
||||
@@ -39,7 +39,7 @@ public class SCloudCodeGenerator {
|
||||
.pathInfo(Collections.singletonMap(OutputFile.xml, outputPath)) // 设置mapperXml生成路径
|
||||
)
|
||||
.strategyConfig(builder ->
|
||||
builder.addInclude("pb_article", "pb_tag", "pb_article_tag") // 设置需要生成的表名
|
||||
builder.addInclude("pb_article", "pb_tag", "pb_article_content", "pb_article_tag") // 设置需要生成的表名
|
||||
.entityBuilder()
|
||||
.enableLombok()
|
||||
.disableSerialVersionUID()
|
||||
|
||||
Reference in New Issue
Block a user