<?php
/**
 * OrganizationMst Entity
 * $Id: OrganizationMst.inc,v 1.1 2016/9/21 12:59:25 AIMS Exp $
 * @author wanggb
 * @package jp.fishow.entity
 * @access public
 */
class OrganizationMst extends CompassDynamicData
{
	var $organization_no;
	var $title;
	var $legal_person;
	var $contact;
	var $id_card;
	var $legal_person_imgage1;
	var $legal_person_imgage2;
	var $licensen_imgage;
	var $other_imgage;
	var $status;
	var $submit_date;	
	var $delete_flg;
	

	/**
	 * 
	 * 
	 * @access public
	 * @param mixed organization_mst
	 */
	function constructor($record)
	{
		parent::constructor($record);

		$this->organization_no      = $record["organization_no"];
		$this->title   = $record["title"];
		$this->legal_person      = $record["legal_person"];
		$this->contact   = $record["contact"];
		$this->id_card   = $record["id_card"];
		$this->legal_person_imgage1      = $record["legal_person_imgage1"];
		$this->legal_person_imgage2   = $record["legal_person_imgage2"];
		$this->licensen_imgage      = $record["licensen_imgage"];
		$this->other_imgage      = $record["other_imgage"];
		$this->status   = $record["status"];
		$this->submit_date   = $record["submit_date"];		
		$this->delete_flg = $record["delete_flg"];
	}

	/**
	 * 
	 * @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("OrganizationMst", "organization_mst", $w_param, $orderkey, $direction, $offset, $limit);
	}

	/**
	 * 
	 * @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("organization_mst", $w_param, null, null, null, null, "count(*) as count");

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

	/**
	 * 
	 */
	public static function getById($id)
	{
		// delete_flg
		$param = array();
		$param["delete_flg"] = false;

		return CompassDBHandler::getById("OrganizationMst", "organization_mst", $id, $param);
	}

	
	/**
	 * 
	 * DynamicData
	 * @access public
	 * @return int 
	 */
	public function save()
	{
		$v_param = array();

		ParamUtil::copyObj2Array($v_param, $this, "organization_no");
		ParamUtil::copyObj2Array($v_param, $this, "title");
		ParamUtil::copyObj2Array($v_param, $this, "legal_person");
		ParamUtil::copyObj2Array($v_param, $this, "contact");
		ParamUtil::copyObj2Array($v_param, $this, "id_card");
		ParamUtil::copyObj2Array($v_param, $this, "legal_person_imgage1");
		ParamUtil::copyObj2Array($v_param, $this, "legal_person_imgage2");
		ParamUtil::copyObj2Array($v_param, $this, "licensen_imgage");
		ParamUtil::copyObj2Array($v_param, $this, "other_imgage");
		ParamUtil::copyObj2Array($v_param, $this, "status");
		ParamUtil::copyObj2Array($v_param, $this, "submit_date");
		ParamUtil::copyObj2Array($v_param, $this, "delete_flg");

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