mongo数据库中一条记录中某个属性是数组情形时 数据结构的定义
package entity;
import java.util.Date;
import com.mongodb.BasicDBList;
import com.mongodb.DBObject;
public class CommonEditEntity {
/** 数据库中查询记录结果 */
private DBObject record;
/** 数据库默认id */
private String _id;
/** 项目id */
private String project_id;
/** 项目名称 */
private String project_name;
/** 项目创建时间 */
private Date start_time;
/** 下一个项目激活时间 */
private Date end_time;
/** 项目激活的状态 */
private String status;
/** 标题内容 */
private ProContent[] proContent;
/**
* @return the record
*/
public DBObject getRecord() {
return record;
}
/**
* @param record the record to set
*/
public void setRecord(DBObject record) {
this.record = record;
}
/**
* 设置 数据库默认id
* @return the _id
*/
public String get_id() {
if (this._id == null && record.get("_id") != null) {
this._id = record.get("_id").toString();
}
return _id;
}
/**
* 返回 数据库默认id
* @param _id the _id to set
*/
public void set_id(String _id) {
this._id = _id;
}
/**
* 返回 项目id
* @return the project_id
*/
public String getProject_id() {
if (this.project_id == null && record.get("project_id") != null) {
this.project_id = record.get("project_id").toString();
}
return project_id;
}
/**
* 设置 项目id
* @param project_id the project_id to set
*/
public void setProject_id(String project_id) {
this.project_id = project_id;
}
/**
* 返回 项目名称
* @return the project_name 项目名称
*/
public String getProject_name() {
if (this.project_name == null && record.get("project_name") != null) {
this.project_name = record.get("project_name").toString();
}
return project_name;
}
/**
* 设置 项目名称
* @param project_name the project_name to set 项目名称
*/
public void setProject_name(String project_name) {
this.project_name = project_name;
}
/**
* 返回 项目创建时间
* @return the start_time 项目创建时间
*/
public Date getStart_time() {
if (this.start_time == null && record.get("start_time") != null) {
this.start_time = new Date(Long.parseLong(record.get("start_time").toString()));
}
return start_time;
}
/**
* 设置 项目创建时间
* @param start_time the start_time to set 项目创建时间
*/
public void setStart_time(Date start_time) {
this.start_time = start_time;
}
/**
* 返回 下一个项目激活时间
* @return the end_time 下一个项目激活时间
*/
public Date getEnd_time() {
if (this.end_time == null && record.get("end_time") != null) {
this.end_time = new Date(Long.parseLong(record.get("end_time").toString()));
}
return end_time;
}
/**
* 设置 下一个项目激活时间
* @param end_time the end_time to set 下一个项目激活时间
*/
public void setEnd_time(Date end_time) {
this.end_time = end_time;
}
/**
* 返回 项目激活的状态
* @return the status 项目激活的状态
*/
public String getStatus() {
if (this.status == null && record.get("status") != null) {
this.status = record.get("status").toString();
}
return status;
}
/**
* 设置 项目激活的状态
* @param status the status to set 项目激活的状态
*/
public void setStatus(String status) {
this.status = status;
}
/**
* 返回 标题内容
* @return the proContent 标题内容
*/
public ProContent[] getProContent() {
if (this.proContent == null && record.get("title_content") != null) {
BasicDBList itemList = (BasicDBList)record.get("title_content");
this.proContent = new ProContent[itemList.size()];
for (int i = 0; i < itemList.size(); i++) {
this.proContent[i] = new ProContent();
this.proContent[i].record = (DBObject)itemList.get(i);
}
}
return proContent;
}
/**
* 设置 标题内容
* @param proContent the proContent to set 标题内容
*/
public void setProContent(ProContent[] proContent) {
this.proContent = proContent;
}
class ProContent{
/** 数据库中查询记录结果 */
private DBObject record;
/** 标题 */
private String title;
/** 内容 */
private String content;
/**
* 返回 数据库中查询记录结果
* @return 数据库中查询记录结果
*/
public DBObject getRecord() {
return record;
}
/**
* 设置 数据库中查询记录结果
* @param record 数据库中查询记录结果
*/
public void setRecord(DBObject record) {
this.record = record;
}
/**
* 返回 标题
* @return the title
*/
public String getTitle() {
if (this.title == null && record.get("title") != null) {
this.title = record.get("title").toString();
}
return title;
}
/**
* 设置 标题
* @param title the title to set
*/
public void setTitle(String title) {
this.title = title;
}
/**
* 返回 内容
* @return the content
*/
public String getContent() {
if (this.content == null && record.get("content") != null) {
this.content = record.get("content").toString();
}
return content;
}
/**
* 设置 内容
* @param content the content to set
*/
public void setContent(String content) {
this.content = content;
}
}
}
mongo数据库中一条记录中某个属性是数组情形时 数据结构的定义的更多相关文章
- 错误:违反并发性: DeleteCommand 影响了预期 1 条记录中的 0 条
在access的mdb数据库动态更新的过程中,遇到了DeleteCommand出现DBConcurrencyException异常,错误:违反并发性: DeleteCommand 影响了预期 1 条记 ...
- 违反并发性: UpdateCommand影响了预期 1 条记录中的 0 条 解决办法
本文转载:http://www.cnblogs.com/litianfei/archive/2007/08/16/858866.html UpdateCommand和DeleteCommand出现DB ...
- FPC报价模块配置 UpdateCommand影响了预期 1 条记录中的 0 条 解决办法
今天在增加P4厂 FPC报价模块配置,增加刚挠信息节点,在保存时报错:UpdateCommand影响了预期 1 条记录中的 0 保存时使用:SqlDataAdapter批量更新DataTable,怎么 ...
- SQL 从100万条记录中的到 成绩最高的记录
从100万条记录中的到 成绩最高的记录 问题分析:要从一张表中找到成绩最高的记录并不难,有很多种办法,最简单的就是利用TOP 1 select top 1 * from student order b ...
- jquery实现对象数组 筛选出每条记录中的特定属性字段 及根据某个属性值筛选出指定的元素
jquery实现对象数组 筛选出每条记录中的特定属性字段 直接上图: 源码: /** * 对后端返回的数据,筛选出符合报表的列项,多余的列项去除 */ function filterParams(da ...
- 【原创】如何找到Oracle中哪条记录被锁
通常有这种情况,某个表或者准确的说是表的某条记录被锁(TX锁),在业务层面排查之余,一般都会想知道是哪条记录被锁,每次被锁的是否是同一条记录?还是每次都不同?通过记录可以找到这条记录可以在哪个模块.哪 ...
- SQL 父子表,显示表中每条记录所在层级
1.sqlserer 中有一张父子关系表,表结构如下: CREATE TABLE [dbo].[testparent]( [ID] [int] IDENTITY(1,1) NOT NULL, [nam ...
- 七种数据库中Select Top的使用方法 (只显示数据库的几条记录)
七种数据库中Select Top的使用方法 1. Oracle数据库 SELECT * FROM TABLENAME WHERE ROWNUM <= N 2. Infomix数据库 SELE ...
- 15. "wm_concat"_数据库中将查询出来的多条记录中的某个字段用","拼接起来
例子: select wm_concat(roleid) from lbmember where userid = ? 值的形式:1,2,3 下面是把1,2,3转换为1;2;3select repla ...
随机推荐
- Codeforces 586D Phillip and Trains(DP)
题目链接 Phillip and Trains 考虑相对位移. 每一轮人向右移动一格,再在竖直方向上移动0~1格,列车再向左移动两格. 这个过程相当于每一轮人向右移动一格,再在竖直方向上移动0~1格, ...
- 初探ggplot2 geom__制作面积图
大家大概都对如下信息图并不陌生,该图用100%堆积面积图的方式来表现不同时期不同国家人数所占的比例.这是一种很有意思的表达方式,而面积图也是很常用的数据图表,现在让我们一起来看看如何在R里用g ...
- jcraft--SFTP demo
import java.awt.Container; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import ...
- SecureCRT设置和Xshell一样的快速命令集(使用快捷键输入命令和密码)
编辑想要的命令 提示:想要回车直接输入[\r]
- 【2019】问题记录一:后端获取URL参数的值内加号“+”变成空格“ ”
问题:URL参数中加号“+”变成空格“ ” 一.现象 URL如:http://example.****.com/controller/action?param=rice+cook+panda ...
- iOS UI Element Usage
Bars The Status Bar
- centos 编译 安装php
安装phpcd /usr/local/srctar -zvxf php-5.3.10.tar.gzcd php-5.3.10mkdir -p /usr/local/php5 #建立php安装目录. ...
- 好工具MyEclise2016 CI下载
地址:http://pan.baidu.com/s/1gfBw9Ab 安装后,点开crack目录,按步骤走. 下面是我安装成功的画面.
- AutoCAD如何又快又好标注直径
如下图所示,想要标注一条直径.先选择快速标注 鼠标单击左右两侧线条(变成虚线),然后按回车,就可以往下拖了.拖完了就是一条直径的标注. 如果想要修改为自己的尺寸,则在文字替换中加上前缀%%c即 ...
- binary-tree-zigzag-level-order-traversal——二叉树分层输出
Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to ...