<?php
/**
 * VolunteerEventMemberDat Entity
 * $Id: VolunteerEventMemberDat.inc,v 1.1 2020/2/27 14:40:01 Exp $
 * @author zb
 * @package jp.compass.entity
 * @access public
 */
class VolunteerEventMemberDat extends CompassDynamicData
{
	var $volunteer_event_id;
	var $index_no;
	var $user_id;
	var $circle_id;
	var $is_owner;
	var $mobile;
	var $comment;
	var $images;
	var $position;
	var $position_longitude;
	var $position_latitude;
	var $role;
	var $time_length;
	var $finish_time;
	var $status;
	var $delete_flg;

	/**
	 * 构造实现。volunteer_event_member_dat创建实例。
	 * 
	 * @access public
	 * @param mixed volunteer_event_member_dat
	 */
	function constructor($record)
	{
		parent::constructor($record);

		$this->volunteer_event_id = $record["volunteer_event_id"];
		$this->index_no           = $record["index_no"];
		$this->user_id            = $record["user_id"];
		$this->circle_id          = $record["circle_id"];
		$this->is_owner           = $record["is_owner"];
		$this->mobile             = $record["mobile"];
		$this->comment            = $record["comment"];
		$this->images             = $record["images"];
		$this->position           = $record["position"];
		$this->position_longitude = $record["position_longitude"];
		$this->position_latitude  = $record["position_latitude"];
		$this->role               = $record["role"];
		$this->time_length        = $record["time_length"];
		$this->finish_time        = $record["finish_time"];
		$this->status             = $record["status"];
		$this->delete_flg         = $record["delete_flg"];
	}

	/**
	 * 根据条件,获取数据列表。
	 * 条件与DBManager的doSelect相同。
	 * @access public
	 * @static
	 * @param array 检索条件
	 * @return array Entity的队列
	 */
	public static function getList($w_param = null, $orderkey = null, $direction = "ASC", $offset = null, $limit = null)
	{
		if ($w_param == null) {
			$w_param = array();
			$w_param["delete_flg"] = "false";
		}

		return CompassDBHandler::getList("VolunteerEventMemberDat", "volunteer_event_member_dat", $w_param, $orderkey, $direction, $offset, $limit);
	}

	/**
	 * 根据条件，获取数据列表的件数。
	 * 条件与DBManager的doSelect相同。
	 * @access public
	 * @static
	 * @param array 检索条件
	 * @return array Entity的队列
	 */
	public static function getListCount($w_param = null)
	{
		if ($w_param == null) {
			$w_param = array();
			$w_param["delete_flg"] = "false";
		}
		$db = CompassDBManager::getInstance();
		$result = $db->doSelect("volunteer_event_member_dat", $w_param, null, null, null, null, "count(*) as count");

		return $result[0]["count"];
	}

	/**
	 * 获得此类指定ID的实例。
	 */
	public static function getById($id)
	{
		// delete_flg
		$param = array();
		$param["delete_flg"] = false;

		return CompassDBHandler::getById("VolunteerEventMemberDat", "volunteer_event_member_dat", $id, $param);
	}

	// -- 这里开始Dynamic ---
	/**
	 * 将此实例写入DB。
	 * DynamicData共用的保存方法。
	 * @access public
	 * @return int 写入实例的ID
	 */
	public function save()
	{
		$v_param = array();

		ParamUtil::copyObj2Array($v_param, $this, "volunteer_event_id");
		ParamUtil::copyObj2Array($v_param, $this, "index_no");
		ParamUtil::copyObj2Array($v_param, $this, "user_id");
		ParamUtil::copyObj2Array($v_param, $this, "circle_id");
		ParamUtil::copyObj2Array($v_param, $this, "is_owner");
		ParamUtil::copyObj2Array($v_param, $this, "mobile");
		ParamUtil::copyObj2ArrayNullField($v_param, $this, "comment");
		ParamUtil::copyObj2ArrayNullField($v_param, $this, "images");
		ParamUtil::copyObj2ArrayNullField($v_param, $this, "position");
		ParamUtil::copyObj2ArrayNullField($v_param, $this, "position_longitude");
		ParamUtil::copyObj2ArrayNullField($v_param, $this, "position_latitude");
		ParamUtil::copyObj2Array($v_param, $this, "role");
		ParamUtil::copyObj2Array($v_param, $this, "time_length");
		ParamUtil::copyObj2ArrayNullField($v_param, $this, "finish_time");
		ParamUtil::copyObj2Array($v_param, $this, "status");
		ParamUtil::copyObj2Array($v_param, $this, "delete_flg");

		// 保存
		parent::_save("volunteer_event_member_dat", $v_param);
	}
}