<?php
/**
 * GovernmentMst Entity
 * $Id: GovernmentMst.inc,v 1.1 2020/1/03 12:59:25 AIMS Exp $
 * @author lixq
 * @package jp.fishow.entity
 * @access public
 */
class GovernmentMst extends CompassDynamicData
{
  var $province;
  var $city;
  var $district;
	var $title;
	var $delete_flg;
	

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

		$this->province     = $record["province"];
		$this->city         = $record["city"];
		$this->district     = $record["district"];
		$this->title        = $record["title"];
		$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("GovernmentMst", "government_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("government_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("GovernmentMst", "government_mst", $id, $param);
	}

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

		ParamUtil::copyObj2Array($v_param, $this, "province");
		ParamUtil::copyObj2ArrayNullField($v_param, $this, "city");
		ParamUtil::copyObj2ArrayNullField($v_param, $this, "district");
		ParamUtil::copyObj2Array($v_param, $this, "title");
		ParamUtil::copyObj2Array($v_param, $this, "delete_flg");

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