1/* 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16import { NoteType, Favorite, Delete, Top } from './EnumData' 17import relationalStore from '@ohos.data.relationalStore'; 18 19/** 20 * 笔记类 21 */ 22export default class NoteData { 23 id: number // 主键 24 title: string // 标题 25 uuid: string // 唯一标识 26 folder_uuid: string // 文件夹uuid 27 content_text: string // 文字内容 28 content_img: string // 图片路径 29 note_type: NoteType // 类型 30 is_top: Top // 是否置顶 31 is_favorite: Favorite // 是否被收藏 32 is_deleted: Delete // 是否被删除 33 created_time: number // 创建时间 34 modified_time: number // 修改时间 35 deleted_time: number // 删除时间 36 slider_value: number //字体进度条大小 37 38 constructor(id: number, title: string, uuid: string, folder_uuid: string, content_text: string, content_img: string, 39 note_type: NoteType, is_top: Top, is_favorite: Favorite, is_deleted: Delete, created_time: number, 40 modified_time: number, deleted_time: number, slider_value: number) { 41 this.id = id 42 this.title = title 43 this.uuid = uuid 44 this.folder_uuid = folder_uuid 45 this.content_text = content_text 46 this.content_img = content_img 47 this.note_type = note_type 48 this.is_top = is_top 49 this.is_favorite = is_favorite 50 this.is_deleted = is_deleted 51 this.created_time = created_time 52 this.modified_time = modified_time 53 this.deleted_time = deleted_time 54 this.slider_value = slider_value 55 } 56 57 /** 58 * 转化为note_table表的valueBucket 59 */ 60 toNoteObject(): relationalStore.ValuesBucket { 61 return { 62 "title": this.title, 63 "uuid": this.uuid, 64 "folder_uuid": this.folder_uuid, 65 "content_text": this.content_text, 66 "content_img": this.content_img, 67 "note_type": this.note_type, 68 "is_top": this.is_top, 69 "is_favorite": this.is_favorite, 70 "is_deleted": this.is_deleted, 71 "created_time": this.created_time, 72 "modified_time": this.modified_time, 73 "deleted_time": this.deleted_time, 74 "slider_value":this.slider_value 75 } 76 } 77}