223 lines
8.3 KiB
PHP
Executable File
223 lines
8.3 KiB
PHP
Executable File
<?
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
class m_blind_limit extends CI_Model{
|
|
|
|
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
|
|
function __construct(){
|
|
parent::__construct();
|
|
|
|
$this->load->database();
|
|
$this->load->library('session');
|
|
}
|
|
|
|
#---------------------------------------------------------------------------
|
|
# PURPOSE : list
|
|
# CREATE : 2018-03-28
|
|
#---------------------------------------------------------------------------
|
|
function blind_limit_list($req_data){
|
|
# request
|
|
$offset = $req_data['offset'];
|
|
$limit = $req_data['limit'];
|
|
|
|
$search_type = $req_data['search_type'];
|
|
$search_keyword = $req_data['search_keyword'];
|
|
$search_limit_type = $req_data['search_limit_type'];
|
|
$search_status = $req_data['search_status'];
|
|
$search_is_today = $req_data['search_is_today'];
|
|
|
|
|
|
if($search_type!='' && $search_keyword!=''){
|
|
$this->db->where("(a.member_id LIKE '%".$search_keyword."%' OR a.member_name LIKE '%".$search_keyword."%')");
|
|
}
|
|
if($search_limit_type!='') $this->db->where('a.limit_type', $search_limit_type);
|
|
if($search_status!='') $this->db->where('a.limit_status', $search_status);
|
|
if($search_is_today=='Y') $this->db->where('a.reg_date >= ', date("Y-m-d")."00:00:00");
|
|
|
|
$this->db->select('a.*, (select count(*) from blind_limit where is_del="N" and member_id=a.member_id) as limit_sum_count');
|
|
$this->db->where('a.is_del', 'N');
|
|
$this->db->from('blind_limit as a');
|
|
$this->db->limit($limit, $offset);
|
|
$this->db->order_by('a.reg_date', 'desc');
|
|
$res = $this->db->get();
|
|
$row = $res->result_array();
|
|
|
|
return $row;
|
|
}
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
# PURPOSE : list - total count
|
|
# CREATE : 2018-03-30
|
|
#----------------------------------------------------------------------------
|
|
function blind_limit_list_total_count($req_data){
|
|
# request
|
|
$search_type = $req_data['search_type'];
|
|
$search_keyword = $req_data['search_keyword'];
|
|
$search_limit_type = $req_data['search_limit_type'];
|
|
$search_status = $req_data['search_status'];
|
|
$search_is_today = $req_data['search_is_today'];
|
|
|
|
if($search_type!='' && $search_keyword!=''){
|
|
$this->db->where("(member_id LIKE '%".$search_keyword."%' OR member_name LIKE '%".$search_keyword."%')");
|
|
|
|
}
|
|
if($search_limit_type!='') $this->db->where('limit_type', $search_limit_type);
|
|
if($search_status!='') $this->db->where('limit_status', $search_status);
|
|
if($search_is_today=='Y') $this->db->where('reg_date >= ', date("Y-m-d")."00:00:00");
|
|
|
|
$this->db->where('is_del', 'N');
|
|
$this->db->from('blind_limit');
|
|
$row = $this->db->count_all_results();
|
|
|
|
return $row;
|
|
}
|
|
|
|
#---------------------------------------------------------------------------
|
|
# PURPOSE : new count
|
|
# CREATE : 2018-03-30
|
|
#---------------------------------------------------------------------------
|
|
function blind_limit_new_count($req_data){
|
|
# request
|
|
$search_type = $req_data['search_type'];
|
|
$search_keyword = $req_data['search_keyword'];
|
|
$search_limit_type = $req_data['search_limit_type'];
|
|
$search_status = $req_data['search_status'];
|
|
|
|
$now_date = date("Y-m-d")." 00:00:00";
|
|
|
|
if($search_type!='' && $search_keyword!=''){
|
|
$this->db->where("(member_id LIKE '%".$search_keyword."%' OR member_name LIKE '%".$search_keyword."%')");
|
|
|
|
}
|
|
if($search_limit_type!='') $this->db->where('limit_type', $search_limit_type);
|
|
if($search_status!='') $this->db->where('limit_status', $search_status);
|
|
|
|
$this->db->where('is_del', 'N');
|
|
$this->db->where('reg_date >=', $now_date);
|
|
$this->db->from('blind_limit');
|
|
$row = $this->db->count_all_results();
|
|
|
|
return $row;
|
|
}
|
|
|
|
#---------------------------------------------------------------------------
|
|
# PURPOSE : status group by count
|
|
# CREATE : 2018-03-30
|
|
#---------------------------------------------------------------------------
|
|
function blind_limit_status_group_by_count($req_data){
|
|
# request
|
|
$search_type = $req_data['search_type'];
|
|
$search_keyword = $req_data['search_keyword'];
|
|
$search_limit_type = $req_data['search_limit_type'];
|
|
$search_status = $req_data['search_status'];
|
|
$search_is_today = $req_data['search_is_today'];
|
|
|
|
if($search_type!='' && $search_keyword!=''){
|
|
$this->db->where("(member_id LIKE '%".$search_keyword."%' OR member_name LIKE '%".$search_keyword."%')");
|
|
|
|
}
|
|
if($search_limit_type!='') $this->db->where('limit_type', $search_limit_type);
|
|
if($search_status!='') $this->db->where('limit_status', $search_status);
|
|
if($search_is_today=='Y') $this->db->where('reg_date >= ', date("Y-m-d")."00:00:00");
|
|
|
|
$this->db->select('limit_status, count(limit_status) as cnt');
|
|
$this->db->where('is_del', 'N');
|
|
$this->db->group_by("limit_status");
|
|
$this->db->from('blind_limit');
|
|
$res = $this->db->get();
|
|
$row = $res->result_array();
|
|
|
|
return $row;
|
|
}
|
|
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
# PURPOSE : insert
|
|
# CREATE : 2018-03-30
|
|
#---------------------------------------------------------------------------
|
|
function blind_limit_insert($req_data){
|
|
|
|
$user_id = $this->session->userdata('Adm_Id');
|
|
if($user_id=='') $user_id = $req_data['reg_id'];
|
|
$now_date = date("Y-m-d H:i:s");
|
|
|
|
$req_data['reg_id'] = $user_id;
|
|
$req_data['reg_date'] = $now_date;
|
|
$req_data['update_id'] = $user_id;
|
|
$req_data['update_date']= $now_date;
|
|
$row = $this->db->insert('blind_limit', $req_data);
|
|
|
|
return $row;
|
|
|
|
|
|
}
|
|
|
|
#---------------------------------------------------------------------------
|
|
# PURPOSE : select
|
|
# CREATE : 2018-03-30
|
|
#---------------------------------------------------------------------------
|
|
function blind_limit_select($req_data){
|
|
# request
|
|
$idx = $req_data;
|
|
|
|
$this->db->where('idx', $idx);
|
|
$this->db->where('is_del', 'N');
|
|
$this->db->from('blind_limit');
|
|
$res = $this->db->get();
|
|
$row = $res->result_array();
|
|
|
|
return $row;
|
|
}
|
|
|
|
#---------------------------------------------------------------------------
|
|
# PURPOSE : update
|
|
# CREATE : 2018-03-30
|
|
#---------------------------------------------------------------------------
|
|
function blind_limit_update($req_data){
|
|
# request
|
|
$idx = $req_data['idx'];
|
|
unset($req_data['idx']);
|
|
|
|
$user_id = $this->session->userdata('Adm_Id');
|
|
$now_date = date("Y-m-d H:i:s");
|
|
|
|
$req_data['update_id'] = $user_id;
|
|
$req_data['update_date'] = $now_date;
|
|
|
|
$this->db->where('idx', $idx);
|
|
$row = $this->db->update('blind_limit', $req_data);
|
|
|
|
return $row;
|
|
|
|
}
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
# PURPOSE : is_del update
|
|
# CREATE : 2018-03-30
|
|
#---------------------------------------------------------------------------
|
|
function blind_limit_is_del_update($req_data){
|
|
# request
|
|
$idx = $req_data;
|
|
|
|
$user_id = $this->session->userdata('Adm_Id');
|
|
$now_date = date("Y-m-d H:i:s");
|
|
|
|
$update_data = array('is_del' => 'Y',
|
|
'update_id' => $user_id,
|
|
'update_date' => $now_date
|
|
);
|
|
$this->db->where('idx', $idx);
|
|
$row = $this->db->update('blind_limit', $update_data);
|
|
|
|
return $row;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
?>
|