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 ...
随机推荐
- (转)C++常用函数汇总
1.标准C++库字符串类std::string的用法 begin 得到指向字符串开头的Iterator end 得到指向字符串结尾的Iterator rbegin ...
- Codeforces 911F Tree Destruction(贪心 && 树的直径)
题目链接 Tree Destructi 题意 给定一棵树,每次可以选定树上的两个叶子,并删去其中的一个.答案每次加上两个选定的叶子之间的距离. 求最后答案的最大值. 首先求出树的某一条直径,令其端 ...
- iscroll 子表左右滚动同时保持页面整体上下滚动
if ( this.options.preventDefault && !utils.isBadAndroid && !utils.preventDefaultExce ...
- 国家商用password(五)基于SM2的软件授权码生成及校验
将公开密钥算法作为软件注冊算法的优点是Cracker非常难通过跟踪验证算法得到注冊机.以下.将介绍使用SM2国密算法进行软件注冊的方法. 生成授权码 选择SM2椭圆曲线參数(P,a,b,N,Gx,Gy ...
- freemarker中include与import的区别
在inc1.ftl与inc2.ftl中的内容分别是: <#assign username="刘德华">与<#assign username="张学友&q ...
- Activity入门(一)
生命周期 onCreate():activity进行创建,在该方法中应调用setContentView(),findViewById()以及获取要展示的数据的方法(如调用manager ...
- Mongodb性能调优
摘要 1. Mongodb 适用场景简介 2. Mongodb 性能监控与分析 3. Mongodb 性能优化建议 关于Mongodb的几个大事件 1.根据美国数据库知识大全官网发布的DB热度排行,M ...
- 用PHP调用证件识别接口识别本地图片
前置条件 在开始前,请作如下准备:1.学会用PHP输出“Hello World” 2.去聚合数据申请证件识别专用的KEY:https://www.juhe.cn/docs/api/id/153 操作步 ...
- 谷歌浏览器插件-html页面js事件查看器
谷歌浏览器插件-html页面js事件查看器 1.下载 下载地址:http://files.cnblogs.com/files/graceup/VisualEvent.zip 解压得到文件:Visual ...
- TCP/IP详解 卷一(第七、八章 Ping、Traceroute程序)
Ping程序 Ping程序由Mike Muuss编写,目的是为了测试另一台主机是否可达. 该程序发送一份ICMP回显请求报文给主机,并等待返回ICMP回显应答. ping程序还能测出到这台主机的往返时 ...