Commit bd7b8ede authored by clone's avatar clone

办公楼统计

parent 91e0ac56
...@@ -9,7 +9,7 @@ use think\Db; ...@@ -9,7 +9,7 @@ use think\Db;
class OfficeGRoom extends BaseModel class OfficeGRoom extends BaseModel
{ {
protected $table = 'office_g_room'; protected $table = 'office_g_room';
private $db_; private $db_;
public function __construct($data = []) public function __construct($data = [])
{ {
...@@ -29,7 +29,7 @@ class OfficeGRoom extends BaseModel ...@@ -29,7 +29,7 @@ class OfficeGRoom extends BaseModel
if (empty($room_id)) { if (empty($room_id)) {
return false; return false;
} }
return $this->editData(['is_rent'=>$is_rent], $room_id); return $this->editData(['is_rent' => $is_rent], $room_id);
} }
/** /**
...@@ -210,8 +210,8 @@ class OfficeGRoom extends BaseModel ...@@ -210,8 +210,8 @@ class OfficeGRoom extends BaseModel
if (empty($data['id'])) { if (empty($data['id'])) {
$save_data['operation_id'] = $agent_id; //上传人 $save_data['operation_id'] = $agent_id; //上传人
$save_data['create_time'] = date('Y-m-d H:i:s'); $save_data['create_time'] = date('Y-m-d H:i:s');
$room_id = $this->db_->insertGetId($save_data); $room_id = $this->db_->insertGetId($save_data);
} else { } else {
try { try {
$save_data['update_time'] = date('Y-m-d H:i:s'); $save_data['update_time'] = date('Y-m-d H:i:s');
...@@ -256,8 +256,8 @@ class OfficeGRoom extends BaseModel ...@@ -256,8 +256,8 @@ class OfficeGRoom extends BaseModel
{ {
$result = $this->field($field) $result = $this->field($field)
->alias("a") ->alias("a")
->join('office_g_building b', 'a.building_id=b.id','left') ->join('office_g_building b', 'a.building_id=b.id', 'left')
->join('g_business_district c', 'b.business_district_id=c.id','left') ->join('g_business_district c', 'b.business_district_id=c.id', 'left')
->where($params) ->where($params)
->find(); ->find();
// dump($this->getLastSql()); // dump($this->getLastSql());
...@@ -285,7 +285,7 @@ class OfficeGRoom extends BaseModel ...@@ -285,7 +285,7 @@ class OfficeGRoom extends BaseModel
* @param string $order_ * @param string $order_
* @return false|\PDOStatement|string|\think\Collection * @return false|\PDOStatement|string|\think\Collection
*/ */
public function getMyBuildingRoom($field, $params,$pageSize,$pageNo,$order_='a.id desc') public function getMyBuildingRoom($field, $params, $pageSize, $pageNo, $order_ = 'a.id desc')
{ {
$result = Db::table($this->table) $result = Db::table($this->table)
->field($field) ->field($field)
...@@ -293,7 +293,6 @@ class OfficeGRoom extends BaseModel ...@@ -293,7 +293,6 @@ class OfficeGRoom extends BaseModel
->join('office_g_building b', 'a.building_id = b.id', 'left') ->join('office_g_building b', 'a.building_id = b.id', 'left')
->join('office_g_room_to_agent c', 'a.id = c.house_id', 'left') ->join('office_g_room_to_agent c', 'a.id = c.house_id', 'left')
->join('g_business_district d', 'b.business_district_id = d.id', 'left') ->join('g_business_district d', 'b.business_district_id = d.id', 'left')
->where($params) ->where($params)
->order($order_) ->order($order_)
->limit($pageSize) ->limit($pageSize)
...@@ -423,7 +422,8 @@ class OfficeGRoom extends BaseModel ...@@ -423,7 +422,8 @@ class OfficeGRoom extends BaseModel
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException * @throws \think\exception\DbException
*/ */
public function getRoomBuilding($pageNo = 1, $pageSize = 15, $order_ = 'a.id desc', $field = '', $params = '') { public function getRoomBuilding($pageNo = 1, $pageSize = 15, $order_ = 'a.id desc', $field = '', $params = '')
{
$params['b.is_del'] = 0; $params['b.is_del'] = 0;
return $this->field($field) return $this->field($field)
->alias('a') ->alias('a')
...@@ -449,7 +449,7 @@ class OfficeGRoom extends BaseModel ...@@ -449,7 +449,7 @@ class OfficeGRoom extends BaseModel
return $data = $this return $data = $this
->field($field) ->field($field)
->alias("a") ->alias("a")
->join("office_g_building b","a.building_id=b.id","left") ->join("office_g_building b", "a.building_id=b.id", "left")
->where($params) ->where($params)
->find(); ->find();
} }
...@@ -469,7 +469,7 @@ class OfficeGRoom extends BaseModel ...@@ -469,7 +469,7 @@ class OfficeGRoom extends BaseModel
{ {
return $data = $this->field($field) return $data = $this->field($field)
->alias("a") ->alias("a")
->join("office_g_building b","a.building_id=b.id","left") ->join("office_g_building b", "a.building_id=b.id", "left")
->where($params) ->where($params)
->order($order) ->order($order)
->limit($pageSize) ->limit($pageSize)
...@@ -490,10 +490,10 @@ class OfficeGRoom extends BaseModel ...@@ -490,10 +490,10 @@ class OfficeGRoom extends BaseModel
$result = Db::table($this->table) $result = Db::table($this->table)
->field($field) ->field($field)
->alias("a") ->alias("a")
->join("office_g_building b","a.building_id=b.id","left") ->join("office_g_building b", "a.building_id=b.id", "left")
->where($params) ->where($params)
->select(); ->select();
// echo $this->getLastSql(); // echo $this->getLastSql();
return $result; return $result;
} }
...@@ -504,7 +504,8 @@ class OfficeGRoom extends BaseModel ...@@ -504,7 +504,8 @@ class OfficeGRoom extends BaseModel
* @throws \think\Exception * @throws \think\Exception
* @throws \think\exception\PDOException * @throws \think\exception\PDOException
*/ */
public function updateData($data, $where) { public function updateData($data, $where)
{
return $this->db_->where($where)->update($data); return $this->db_->where($where)->update($data);
} }
...@@ -516,9 +517,37 @@ class OfficeGRoom extends BaseModel ...@@ -516,9 +517,37 @@ class OfficeGRoom extends BaseModel
public function getHouseColumn($field, $params) public function getHouseColumn($field, $params)
{ {
return $this->db_->alias("a") return $this->db_->alias("a")
->join("office_g_building b","a.building_id=b.id","left") ->join("office_g_building b", "a.building_id=b.id", "left")
->where($params) ->where($params)
->column($field); ->column($field);
} }
/**
* 获取添加的办公楼的每天数量
* @param $params
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getAddHouseNumGroupTimeNew($params)
{
$field = "count(1) as num";
$where_ = [];
$where_["status"] = array('neq', 3);
if (isset($params["agent_id"])) {
$where_["operation_id"] = $params["agent_id"];
}
if (isset($params["create_time"])) {
$where_["create_time"] = $params["create_time"];
}
$result = $this->db_
->field($field)
->where($where_)
->select();
//echo $this->getLastSql();
return $result;
}
} }
...@@ -584,8 +584,8 @@ class OfficeOBargainModel extends Model ...@@ -584,8 +584,8 @@ class OfficeOBargainModel extends Model
return Db::table($this->table) return Db::table($this->table)
->field($field) ->field($field)
->alias("a") ->alias("a")
->join("o_partial_commission b", "a.id=b.bargain_id", "right") ->join("office_o_partial_commission b", "a.id=b.bargain_id", "right")
->join('o_real_income c', 'b.real_income_id = c.id', 'left') ->join('office_o_real_income c', 'b.real_income_id = c.id', 'left')
->where($where_) ->where($where_)
->select(); ->select();
} }
......
...@@ -240,10 +240,6 @@ class ResultsSummaryNewTask ...@@ -240,10 +240,6 @@ class ResultsSummaryNewTask
} }
}
private function save(){
} }
/* public function test() /* public function test()
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment