<?php
/**
 * AccountMst Entity
 * $Id: AccountMst.inc,v 1.1 2016/9/21 12:59:25 AIMS Exp $
 * @author wanggb
 * @package jp.fishow.entity
 * @access public
 */
class AccountMst extends CompassDynamicData
{
	var $login;
	var $password;
	var $name;
	var $contact;
	var $role;
	var $user_id;
	var $school_id;
	var $government_id;
	var $modules;
	var $comment;
	var $delete_flg;
	/**
	 * 
	 * 
	 * @access public
	 * @param mixed account_mst
	 */
	function constructor($record)
	{
		parent::constructor($record);

		$this->login          = $record["login"];
		$this->password       = $record["password"];
		$this->name           = $record["name"];
		$this->contact        = $record["contact"];
		$this->role           = $record["role"];
		$this->user_id        = $record["user_id"];
		$this->school_id      = $record["school_id"];
		$this->government_id  = $record["government_id"];
		$this->modules        = $record["modules"];
		$this->delete_flg     = $record["delete_flg"];
		$this->comment        = $record["comment"];
	}

	/**
	 * 
	 * @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("AccountMst", "account_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("account_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("AccountMst", "account_mst", $id, $param);
	}

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

		ParamUtil::copyObj2Array($v_param, $this, "login");
		ParamUtil::copyObj2Array($v_param, $this, "password");
		ParamUtil::copyObj2Array($v_param, $this, "name");
		ParamUtil::copyObj2ArrayNullField($v_param, $this, "contact");
		ParamUtil::copyObj2Array($v_param, $this, "role");
		ParamUtil::copyObj2Array($v_param, $this, "user_id");
		ParamUtil::copyObj2Array($v_param, $this, "school_id");
		ParamUtil::copyObj2Array($v_param, $this, "government_id");
		ParamUtil::copyObj2Array($v_param, $this, "modules");
		ParamUtil::copyObj2Array($v_param, $this, "delete_flg");
		ParamUtil::copyObj2ArrayNullField($v_param, $this, "comment");

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