first commit
This commit is contained in:
52
pgserver/application/model/ZongdiInfo.php
Normal file
52
pgserver/application/model/ZongdiInfo.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace app\model;
|
||||
|
||||
use think\Db;
|
||||
use think\Log;
|
||||
|
||||
/**
|
||||
* Class 宗地表
|
||||
* @package app\model
|
||||
* @author: bordon
|
||||
*/
|
||||
class ZongdiInfo extends Base
|
||||
{
|
||||
|
||||
/**
|
||||
* 数据来源 0 正常;1 批量上传
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
public static $SRC_TYPE_NORMAL = 0; // 正常类
|
||||
public static $SRC_TYPE_BATCH = 1; // 批量上传类
|
||||
|
||||
/**
|
||||
* 保存宗地信息
|
||||
*
|
||||
* @param [type] $data 宗地表结构一致
|
||||
* @return void
|
||||
*/
|
||||
public function AddorUpdateByZdbh( $data )
|
||||
{
|
||||
// 构建查询条件
|
||||
//$map['id'] = $data['id'];
|
||||
$map['parcel_no'] = $data['parcel_no'];
|
||||
$zd_id = isset($data['zd_id'])?$data['zd_id']:null;
|
||||
|
||||
// 查询是否存在符合条件的记录
|
||||
$record = $this->where($map)->find();
|
||||
|
||||
$r = null;
|
||||
if ($record&&$zd_id != null ) {
|
||||
// 符合条件的记录已存在,做更新操作
|
||||
$r = $this->where($map)->update($data);
|
||||
} else {
|
||||
$r = $this->save($data);
|
||||
$zd_id = $this->id;
|
||||
}
|
||||
|
||||
return ['res'=>$r,'id'=>$zd_id];
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user