GAE 数据存储中的视图

发布于 2024-12-07 06:58:44 字数 946 浏览 1 评论 0原文

该应用程序是一个简单的任务管理系统,其中一个员工可以有多个任务,一个任务可以分配给多个员工。因此,第一个模型是 Employee,它具有以下属性:

Class Employee {
 Long id; //primary key
 String name;
 String employeeCode;
 String position;
}

任务模型如下:

class Task {
 Long id //primary key
 String name;
 String description
}

并且将员工分配给具有以下关系的任务:

Class EmployeeTasks {
 Long id // primary key
 Long employeeId;
 Long TaskId;
 Date assignedDate;
 Long assignedBy; //employee ID
}

我有两个用于员工模块的列表视图(通过 AJAX) -

第一个列表有以下列,它是供系统管理员使用的:

Employee code | Name | Position | Date Created

第二个列表有以下列,是供经理使用的:

Employee Code| Name | Position| No of Tasks assigned | Date of last assignment

我知道在 GAE 中,我们在设计数据库模型时需要考虑查询(视图)。所以我的问题是上述模型是否适合我的要求?

该应用程序正在GAE+Spring+JDO+Jackson+YUI 中开发。坚持使用这个模型并使用 Jackson ObjectMapper 来更改视图是否有意义?或者为视图编写非持久对象是一个好习惯吗?

The application is a simple task management system in which an employee can have multiple tasks and a task can be assigned to multiple employees. So the first Model is Employee, which has the following attributes:

Class Employee {
 Long id; //primary key
 String name;
 String employeeCode;
 String position;
}

The task Model is as follows:

class Task {
 Long id //primary key
 String name;
 String description
}

and an employee is assigned to tasks in the following relation:

Class EmployeeTasks {
 Long id // primary key
 Long employeeId;
 Long TaskId;
 Date assignedDate;
 Long assignedBy; //employee ID
}

I have two list views(through AJAX) for the employee module -

The first list has the following columns and it is intended for System Administrators:

Employee code | Name | Position | Date Created

The second list has the following columns and is for the Managers:

Employee Code| Name | Position| No of Tasks assigned | Date of last assignment

I know that in GAE we need to consider the queries(views) while designing the database model. So my question is whether the above model is ideal for my requirements?

The application is being developed in GAE+Spring+JDO+Jackson+YUI. Does it makes sense to stick on with this model and use Jackson ObjectMapper to change the views? Or is it a good practice to write non-persistent objects for the views?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文