118 lines
3.7 KiB
PHP
118 lines
3.7 KiB
PHP
<?php
|
||
|
||
namespace app\model;
|
||
use think\Db;
|
||
use think\db\Where;
|
||
|
||
/**
|
||
* 楼盘-物业字典
|
||
*/
|
||
class LpdictPropertySZ extends Base {
|
||
|
||
public const CONNECTION_NAME = 'lp_db';
|
||
protected $lpDb;
|
||
|
||
public function __construct() {
|
||
// 连接 lp_db 数据库
|
||
$this->lpDb = Db::connect( $this->getConfig(LpdictPropertySZ::CONNECTION_NAME) );
|
||
}
|
||
|
||
/**
|
||
* 获取与指定楼盘地址模糊匹配的物业信息。
|
||
*
|
||
* @param string $estate_address 楼盘地址的关键字,用于模糊查询。
|
||
* 该参数将用于匹配 dict_loupan_sz 表中的 loupan_name 字段。
|
||
*
|
||
* @return array 返回一个包含匹配物业信息的数组。
|
||
* 每个元素是从 dict_property_sz 表中查询到的 full_estate_name 相关信息。
|
||
* 如果没有匹配结果,则返回空数组。
|
||
*/
|
||
public function getEstateListByName($name,$limit=10) {
|
||
|
||
// 模糊查询 dict_loupan_sz 表中的 loupan_name
|
||
$r = $this->lpDb->table('dict_loupan_sz')
|
||
->field('lp_id,loupan_name')
|
||
->where("loupan_name like '%" . $name . "%'")
|
||
->limit($limit)
|
||
->select();
|
||
|
||
return $r;
|
||
}
|
||
|
||
/**
|
||
* 根据楼盘ID获取建筑物列表
|
||
*
|
||
* @param int $lp_id 楼盘ID,用于查询特定楼盘的建筑物信息
|
||
* @param int $limit 结果限制数量,默认为10,用于分页或限制返回结果的数量
|
||
*
|
||
* @return array 返回一个包含建筑物信息的数组,每个元素代表一个建筑物
|
||
*/
|
||
public function getBuildingListByLpid( $lp_id ,$limit=10)
|
||
{
|
||
$r = $this->lpDb->table('dict_building_sz')
|
||
->field('lp_id,building_name,b_id')
|
||
->where('lp_id', $lp_id)
|
||
->limit($limit)
|
||
->select();
|
||
|
||
return $r;
|
||
}
|
||
|
||
/**
|
||
* 根据栋号模糊查询栋号全称列表
|
||
*
|
||
* @param string $BName 楼盘ID,用于查询特定楼盘的建筑物信息
|
||
* @param int $limit 结果限制数量,默认为10,用于分页或限制返回结果的数量
|
||
*
|
||
* @return array 返回一个包含栋号信息的数组
|
||
*/
|
||
public function getBuildingListByBName( $lpid, $BName ,$limit=10)
|
||
{
|
||
$r = $this->lpDb->table('dict_building_sz')
|
||
->field('lp_id,building_name,b_id')
|
||
->where('lp_id', $lpid)
|
||
->where("building_name like '%" . $BName . "%'")
|
||
->limit($limit)
|
||
->select();
|
||
|
||
return $r;
|
||
}
|
||
|
||
/**
|
||
* 根据首字母获取楼盘列表
|
||
*
|
||
* @param string $first_letter 首字母
|
||
* @param int $limit 限制返回的数量,默认为10
|
||
* @return array 楼盘列表数组
|
||
*/
|
||
public function getEstateListByFristLetter($first_letter,$limit=10) {
|
||
|
||
$r = $this->lpDb->table('dict_loupan_sz')
|
||
->field('lp_id,loupan_name')
|
||
->where('first_letter', $first_letter )
|
||
->limit($limit)
|
||
->select();
|
||
|
||
return $r;
|
||
}
|
||
|
||
/**
|
||
* 根据楼盘ID获取建筑物列表
|
||
*
|
||
* @param int $lp_id 楼盘ID,用于查询特定楼盘的建筑物信息
|
||
* @param int $limit 结果限制数量,默认为10,用于分页或限制返回结果的数量
|
||
*
|
||
* @return array 返回一个包含建筑物信息的数组,每个元素代表一个建筑物
|
||
*/
|
||
public function getPropertyListByBid($b_id,$h_no, $limit=10){
|
||
$r = $this->lpDb->table('dict_property_sz')
|
||
->field('h_id,b_id,lp_id,full_estate_name,house_number')
|
||
->where('b_id', $b_id)
|
||
->where("house_number like '%" . $h_no . "%'")
|
||
->limit($limit)
|
||
->select();
|
||
|
||
return $r;
|
||
}
|
||
|
||
} |