Quellcode durchsuchen

feat: 新增多个请求接口

YuJing vor 1 Monat
Ursprung
Commit
cdbf7b6692

+ 31 - 0
features/feature/src/main/ets/apis/ApiUrl.ets

@@ -0,0 +1,31 @@
+export class ApiUrl {
+  /**
+   * @description 搜索书单
+   * @method POST
+   */
+  static searchBookList = '/api/book/bookList/searchBookList';
+
+  /**
+   * @description 获取所有的书单分类集合
+   * @method GET
+   */
+  static getAllBookCategories = '/prod-book/api/book/bookListType/getAllBookListType';
+
+  /**
+   * @description 获取最热的10条搜索记录
+   * @method GET
+   */
+  static getHotSearchRecords = '/prod-book/api/book/bookListType/getAllBookListType';
+
+  /**
+   * @description 获取所有的主题分类集合
+   * @method GET
+   */
+  static getAllThemes = '/prod-book/api/book/bookListType/getAllBookListType';
+
+  /**
+   * @description 搜索图书
+   * @method POST
+   */
+  static searchBooks = '/api/book/information/searchBook';
+}

+ 47 - 0
features/feature/src/main/ets/apis/BookListApi.ets

@@ -0,0 +1,47 @@
+import { YTRequest } from "basic";
+import { BookItem, BookListItem, BookListTypeItem, BookListTypeList } from "../model/BookModelIndex";
+import { searchBookListQuery, searchBookQuery } from "../model/Query";
+import { PageResponse } from "../model/PageResponse";
+import { ApiUrl } from "./ApiUrl";
+
+export class BookListApi {
+  /**
+   * @description 搜索书单
+   * @method POST
+   */
+  searchBookList(params: searchBookListQuery): Promise<PageResponse<BookListItem>>{
+    return YTRequest.post<PageResponse<BookListItem>, searchBookListQuery>(ApiUrl.searchBookList, params)
+  }
+
+  /**
+   * @description 获取所有的书单分类集合
+   * @method GET
+   */
+  getAllBookCategories(): Promise<Array<BookListTypeItem>>{
+    return YTRequest.get<Array<BookListTypeItem>>(ApiUrl.getAllBookCategories)
+  }
+
+  /**
+   * @description 获取最热的10条搜索记录
+   * @method GET
+   */
+  getHotSearchRecords(): Promise<ESObject>{
+    return YTRequest.get<ESObject>(ApiUrl.getHotSearchRecords)
+  }
+
+  /**
+   * @description 获取所有的主题分类集合
+   * @method GET
+   */
+  getAllThemes(): Promise<Array<BookListTypeList>>{
+    return YTRequest.get<Array<BookListTypeList>>(ApiUrl.getAllThemes)
+  }
+
+  /**
+   * @description 搜索图书
+   * @method POST
+   */
+  searchBooks(params: searchBookQuery): Promise<PageResponse<BookItem>>{
+    return YTRequest.post<PageResponse<BookItem>, searchBookQuery>(ApiUrl.searchBooks, params)
+  }
+}

+ 137 - 0
features/feature/src/main/ets/model/BookModelIndex.ets

@@ -0,0 +1,137 @@
+/**
+ * 书本信息
+ */
+export class BookItem {
+  /** 书籍ID */
+  id?: string;
+  /** 书名 */
+  bookTitle?: string;
+  /** 副标题 */
+  bookSubtitle?: string;
+  /** ISBN编号 */
+  isbn?: string;
+  /** 封面图片URL */
+  coverUrl?: string;
+  /** 作者 */
+  author?: string;
+  /** 备注 */
+  remark?: string;
+  /** 语言 */
+  language?: string;
+  /** 出版社 */
+  publisher?: string;
+  /** 出版日期 */
+  publicationDate?: string;
+  /** 上架日期 */
+  saleDate?: string;
+  /** 页数 */
+  pageNumber?: string;
+  /** 作者介绍 */
+  authorIntroduction?: string;
+  /** 适读年龄范围 */
+  ageRange?: string;
+  /** 状态 */
+  state?: string;
+  /** 每日租金 */
+  rentPerDay?: string;
+  /** 重量(单位:kg) */
+  weight?: string;
+  /** 市场价格 */
+  marketPrice?: string;
+  /** 最小适读年龄 */
+  minAge?: string;
+  /** 最大适读年龄 */
+  maxAge?: string;
+  /** 书架位置 */
+  shelf?: string;
+  /** 阅读次数 */
+  readingNumber?: string;
+  /** 装订方式 */
+  binding?: string;
+  /** 创建人 */
+  createBy?: string;
+  /** 创建时间 */
+  createTime?: string;
+  /** 更新人 */
+  updateBy?: string;
+  /** 更新时间 */
+  updateTime?: string;
+  /** 分类名称 */
+  typeName?: string;
+}
+
+/**
+ * 书单信息
+ */
+export class BookListItem {
+  /** 书单ID */
+  id?: string;
+  /** 书单名称 */
+  bookListName?: string;
+  /** 封面图片URL */
+  coverUrl?: string;
+  /** 书单分类ID */
+  bookListTypeId?: string;
+  /** 书单分类名称 */
+  bookListTypeName?: string;
+  /** 作者 */
+  author?: string;
+  /** 简介 */
+  synopsis?: string;
+  /** 状态 */
+  state?: string;
+  /** 上架时间 */
+  listingTime?: string;
+  /** 排序 */
+  sort?: string;
+  /** 创建人 */
+  createBy?: string;
+  /** 创建时间 */
+  createTime?: string;
+  /** 更新人 */
+  updateBy?: string;
+  /** 更新时间 */
+  updateTime?: string;
+}
+
+
+/**
+ * 书单分类信息
+ */
+export class BookListTypeItem {
+  /** 书单分类ID */
+  id?: string;
+  /** 书单分类名称 */
+  bookListTypeName?: string;
+  /** 排序 */
+  sort?: string;
+  /** 创建人 */
+  createBy?: string;
+  /** 创建时间 */
+  createTime?: string;
+  /** 更新人 */
+  updateBy?: string;
+  /** 更新时间 */
+  updateTime?: string;
+}
+
+
+/**
+ * 主体分类集合
+ */
+export class BookListTypeList {
+  /** 分类ID */
+  id?: string;
+  /** 排序 */
+  sort?: string;
+  /** 分类名称 */
+  typeName?: string;
+  /** 创建人 */
+  createBy?: string;
+  /** 创建时间 */
+  createTime?: string;
+  /** 更新人 */
+  updateBy?: string;
+  /** 更新时间 */
+  updateTime?: string;
+}

+ 43 - 0
features/feature/src/main/ets/model/PageResponse.ets

@@ -0,0 +1,43 @@
+import { BookListItem } from "./BookModelIndex";
+
+/**
+ * 分页响应数据
+ */
+export class PageResponse<T> {
+  /** 总记录数 */
+  total?: string;
+  /** 数据列表 */
+  list?: Array<T>;
+  /** 当前页码 */
+  pageNum?: string;
+  /** 每页显示数量 */
+  pageSize?: string;
+  /** 当前页实际数据条数 */
+  size?: string;
+  /** 起始行号 */
+  startRow?: string;
+  /** 结束行号 */
+  endRow?: string;
+  /** 总页数 */
+  pages?: string;
+  /** 上一页页码 */
+  prePage?: string;
+  /** 下一页页码 */
+  nextPage?: string;
+  /** 是否为第一页 */
+  isFirstPage?: boolean;
+  /** 是否为最后一页 */
+  isLastPage?: boolean;
+  /** 是否有上一页 */
+  hasPreviousPage?: boolean;
+  /** 是否有下一页 */
+  hasNextPage?: boolean;
+  /** 导航页码数量 */
+  navigatePages?: string;
+  /** 导航页码数组 */
+  navigatepageNums?: Array<string>;
+  /** 第一个导航页码 */
+  navigateFirstPage?: string;
+  /** 最后一个导航页码 */
+  navigateLastPage?: string;
+}

+ 27 - 0
features/feature/src/main/ets/model/Query.ets

@@ -0,0 +1,27 @@
+abstract class Query{
+  pageNum: number = 1
+  pageSize: number = 15
+  total: number = 0
+}
+
+// 搜索书单
+export class searchBookListQuery extends Query{
+  /** 书单类型ID **/
+  bookListTypeId?: string
+  /** 书单名称 **/
+  key?: string
+}
+
+// 搜索书籍
+export class searchBookQuery extends Query {
+  /** 搜索关键词 */
+  key?: string;
+  /** 最大适读年龄 */
+  maxAge?: number;
+  /** 最小适读年龄 */
+  minAge?: number;
+  /** 排序方式 */
+  sort?: number;
+  /** 分类ID */
+  typeId?: number;
+}