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 {FolderType, Delete} from './EnumData' 17import relationalStore from '@ohos.data.relationalStore'; 18 19/** 20 * 文件夹类 21 */ 22export default class FolderData { 23 id: number // 主键 24 name: string // 名称 25 uuid: string // 唯一标识 26 color: string // 图标颜色 27 folder_type: FolderType // 类型 28 is_deleted: Delete // 是否被删除 29 created_time: number // 创建时间 30 modified_time: number // 修改时间 31 32 constructor(id: number, name: string, uuid: string, color: string, folder_type: FolderType, 33 is_deleted: Delete, created_time: number, modified_time: number) { 34 this.id = id 35 this.name = name 36 this.uuid = uuid 37 this.color = color 38 this.folder_type = folder_type 39 this.is_deleted = is_deleted 40 this.created_time = created_time 41 this.modified_time = modified_time 42 } 43 44 /** 45 * 转化为folder_table表的valueBucket 46 */ 47 toFolderObject(): relationalStore.ValuesBucket { 48 return { 49 "name": this.name, 50 "uuid": this.uuid, 51 "color": this.color, 52 "folder_type": this.folder_type, 53 "is_deleted": this.is_deleted, 54 "created_time": this.created_time, 55 "modified_time": this.modified_time 56 } 57 } 58}