Przeglądaj źródła

rewrite article api

tsurumure 5 miesięcy temu
rodzic
commit
7dd69e9e7f

+ 6 - 6
db/cms_page_translations.sql

@@ -2,16 +2,16 @@ DROP TABLE IF EXISTS `cms_page_translations`;
 CREATE TABLE `cms_page_translations` (
     PRIMARY KEY (`id`),
     `id` BIGINT AUTO_INCREMENT COMMENT 'ID',
-    `page_id` BIGINT NOT NULL COMMENT '内容ID',
+    `page_sign` VARCHAR(255) NOT NULL COMMENT '内容标识',
     `language` VARCHAR(10) NOT NULL COMMENT '语种',
     `title` VARCHAR(255) NOT NULL COMMENT '内容标题',
     `description` VARCHAR(500) COMMENT '内容描述',
     `content` TEXT NOT NULL COMMENT '内容详情'
 ) ENGINE=INNODB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='内容翻译表';
 
-INSERT INTO cms_page_translations(page_id, language, title, description, content) VALUES
-    (1, 'zh', '关于我们', '一家致力于为用户提供智能生活解决方案的科技公司', '是一家致力于为用户提供智能生活解决方案的科技公司。我们的使命是利用最先进的人工智能技术,使每个人都能享受更智能、更便捷的生活体验。无论是通过我们的智能助手或者其他创新产品,我们都致力于为大家提供优质的服务和技术。'),
-    (1, 'en', 'About us', 'A technology company dedicated to providing intelligent lifestyle solutions for users', 'WeTab is a technology company dedicated to providing intelligent lifestyle solutions for users. Our mission is to leverage cutting-edge artificial intelligence technology to enable everyone to enjoy a smarter and more convenient life experience. Whether through our smart assistant or other innovative products, we are committed to providing high-quality service and technology.'),
-    (2, 'zh', '联系我们', '', '<p>联系电话:+1234567890</p><p>邮箱地址:info@WeTab.com</p><p>企业地址:XXXX街道,XX城市,XX国家</p>'),
-    (2, 'en', 'Contact us', '', '<p>Phone:+1234567890</p><p>Email:info@WeTab.com</p><p>Address: XXXX Street, XX City, XX Country</p>')
+INSERT INTO cms_page_translations(page_sign, language, title, description, content) VALUES
+    ('about', 'zh', '关于我们', '一家致力于为用户提供智能生活解决方案的科技公司', '是一家致力于为用户提供智能生活解决方案的科技公司。我们的使命是利用最先进的人工智能技术,使每个人都能享受更智能、更便捷的生活体验。无论是通过我们的智能助手或者其他创新产品,我们都致力于为大家提供优质的服务和技术。'),
+    ('about', 'en', 'About us', 'A technology company dedicated to providing intelligent lifestyle solutions for users', 'WeTab is a technology company dedicated to providing intelligent lifestyle solutions for users. Our mission is to leverage cutting-edge artificial intelligence technology to enable everyone to enjoy a smarter and more convenient life experience. Whether through our smart assistant or other innovative products, we are committed to providing high-quality service and technology.'),
+    ('contact', 'zh', '联系我们', '', '<p>联系电话:+1234567890</p><p>邮箱地址:info@WeTab.com</p><p>企业地址:XXXX街道,XX城市,XX国家</p>'),
+    ('contact', 'en', 'Contact us', '', '<p>Phone:+1234567890</p><p>Email:info@WeTab.com</p><p>Address: XXXX Street, XX City, XX Country</p>')
 ;

+ 5 - 5
src/main/java/com/backendsys/modules/cms/article/controller/ArticleCategoryController.java

@@ -21,14 +21,14 @@ public class ArticleCategoryController {
 
     @Operation(summary = "获取资讯分类列表")
     @PreAuthorize("@sr.hasPermission('10')")
-    @GetMapping("/api/v2/cms/article/getArticleCategory")
+    @GetMapping("/api/cms/article/getArticleCategory")
     public Result getArticleCategory(@Validated ArticleCategory articleCategory) {
         return Result.success().put("data", articleCategoryService.selectArticleCategoryList(articleCategory));
     }
 
     @Operation(summary = "获取资讯分类详情")
     @PreAuthorize("@sr.hasPermission('10.2.1')")
-    @GetMapping("/api/v2/cms/article/getArticleCategoryDetail")
+    @GetMapping("/api/cms/article/getArticleCategoryDetail")
     public Result getArticleCategoryDetail(@Validated(ArticleCategory.Detail.class) ArticleCategory articleCategory) {
         return Result.success().put("data", articleCategoryService.selectArticleCategoryDetail(articleCategory));
     }
@@ -36,7 +36,7 @@ public class ArticleCategoryController {
     @SysLog("创建资讯分类")
     @Operation(summary = "创建资讯分类")
     @PreAuthorize("@sr.hasPermission('10.2.2')")
-    @PostMapping("/api/v2/cms/article/createArticleCategory")
+    @PostMapping("/api/cms/article/createArticleCategory")
     public Result createArticleCategory(@Validated(ArticleCategory.Create.class) @RequestBody ArticleCategory articleCategory) {
         return Result.success().put("data", articleCategoryService.insertArticleCategory(articleCategory));
     }
@@ -44,7 +44,7 @@ public class ArticleCategoryController {
     @SysLog("编辑资讯分类")
     @Operation(summary = "编辑资讯分类")
     @PreAuthorize("@sr.hasPermission('10.2.3')")
-    @PutMapping("/api/v2/cms/article/updateArticleCategory")
+    @PutMapping("/api/cms/article/updateArticleCategory")
     public Result updateArticleCategory(@Validated(ArticleCategory.Update.class) @RequestBody ArticleCategory articleCategory) {
         return Result.success().put("data", articleCategoryService.updateArticleCategory(articleCategory));
     }
@@ -52,7 +52,7 @@ public class ArticleCategoryController {
     @SysLog("删除资讯分类")
     @Operation(summary = "删除资讯分类")
     @PreAuthorize("@sr.hasPermission('10.2.4')")
-    @DeleteMapping("/api/v2/cms/article/deleteArticleCategory")
+    @DeleteMapping("/api/cms/article/deleteArticleCategory")
     public Result deleteArticleCategory(@Validated(ArticleCategory.Delete.class) @RequestBody ArticleCategory articleCategory) {
         return Result.success().put("data", articleCategoryService.deleteArticleCategory(articleCategory));
     }

+ 6 - 6
src/main/java/com/backendsys/modules/cms/article/controller/ArticleController.java

@@ -21,14 +21,14 @@ public class ArticleController {
 
     @Operation(summary = "获取资讯列表")
     @PreAuthorize("@sr.hasPermission('10.3')")
-    @GetMapping("/api/v2/cms/article/getArticle")
+    @GetMapping("/api/cms/article/getArticle")
     public Result getArticle(@Validated Article article) {
         return Result.success().put("data", articleService.selectArticleList(article));
     }
 
     @Operation(summary = "获取资讯详情")
     @PreAuthorize("@sr.hasPermission('10.3.1')")
-    @GetMapping("/api/v2/cms/article/getArticleDetail")
+    @GetMapping("/api/cms/article/getArticleDetail")
     public Result getArticleDetail(@Validated(Article.Detail.class) Article article) {
         return Result.success().put("data", articleService.selectArticleDetail(article));
     }
@@ -36,7 +36,7 @@ public class ArticleController {
     @SysLog("创建资讯")
     @Operation(summary = "创建资讯")
     @PreAuthorize("@sr.hasPermission('10.3.2')")
-    @PostMapping("/api/v2/cms/article/createArticle")
+    @PostMapping("/api/cms/article/createArticle")
     public Result createArticle(@Validated(Article.Create.class) @RequestBody Article article) {
         return Result.success().put("data", articleService.insertArticle(article));
     }
@@ -44,7 +44,7 @@ public class ArticleController {
     @SysLog("编辑资讯")
     @Operation(summary = "编辑资讯")
     @PreAuthorize("@sr.hasPermission('10.3.3')")
-    @PutMapping("/api/v2/cms/article/updateArticle")
+    @PutMapping("/api/cms/article/updateArticle")
     public Result updateArticle(@Validated(Article.Update.class) @RequestBody Article article) {
         return Result.success().put("data", articleService.updateArticle(article));
     }
@@ -52,7 +52,7 @@ public class ArticleController {
     @SysLog("删除资讯")
     @Operation(summary = "删除资讯")
     @PreAuthorize("@sr.hasPermission('10.3.4')")
-    @DeleteMapping("/api/v2/cms/article/deleteArticle")
+    @DeleteMapping("/api/cms/article/deleteArticle")
     public Result deleteArticle(@Validated(Article.Delete.class) @RequestBody Article article) {
         return Result.success().put("data", articleService.deleteArticle(article));
     }
@@ -60,7 +60,7 @@ public class ArticleController {
     @SysLog("删除资讯 (批量)")
     @Operation(summary = "删除资讯 (批量)")
     @PreAuthorize("@sr.hasPermission('10.3.4')")
-    @DeleteMapping("/api/v2/cms/article/deleteArticleBatch")
+    @DeleteMapping("/api/cms/article/deleteArticleBatch")
     public Result deleteArticleBatch(@Validated(Article.DeleteBatch.class) @RequestBody Article article) {
         return Result.success().put("data", articleService.deleteArticleBatch(article));
     }