|
@@ -11,11 +11,16 @@ use app\admin\model\Enterprise;
|
|
class EnterpriseApi {
|
|
class EnterpriseApi {
|
|
|
|
|
|
public static function getOne($id) {
|
|
public static function getOne($id) {
|
|
- return Enterprise::findOrEmpty($id);
|
|
|
|
|
|
+ $ep = Enterprise::findOrEmpty($id);
|
|
|
|
+ if ($ep->delete == 1) {
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+ return $ep;
|
|
}
|
|
}
|
|
|
|
|
|
public static function getSimpleList() {
|
|
public static function getSimpleList() {
|
|
$where[] = ["active", "=", 1];
|
|
$where[] = ["active", "=", 1];
|
|
|
|
+ $where[] = ["delete", "=", 0];
|
|
return $list = Enterprise::where($where)->order("name", 'asc')->field("name,id")->select()->toArray();
|
|
return $list = Enterprise::where($where)->order("name", 'asc')->field("name,id")->select()->toArray();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -101,6 +106,7 @@ class EnterpriseApi {
|
|
$enterpriseTag = urldecode(trim($request->param("enterpriseTag")));
|
|
$enterpriseTag = urldecode(trim($request->param("enterpriseTag")));
|
|
$enterpriseType = urldecode(trim($request->param("enterpriseType")));
|
|
$enterpriseType = urldecode(trim($request->param("enterpriseType")));
|
|
|
|
|
|
|
|
+ $where[] = ["delete", "=", 0];
|
|
if ($name) {
|
|
if ($name) {
|
|
$where[] = ["name", "like", "%{$name}%"];
|
|
$where[] = ["name", "like", "%{$name}%"];
|
|
}
|
|
}
|
|
@@ -198,7 +204,7 @@ class EnterpriseApi {
|
|
$company_info = CompanyApi::getOne($companyId);
|
|
$company_info = CompanyApi::getOne($companyId);
|
|
$where = [];
|
|
$where = [];
|
|
$whereRaw = "";
|
|
$whereRaw = "";
|
|
- $where[] = ['type', '=', session('user')['type']];
|
|
|
|
|
|
+ $where[] = ['r.type', '=', session('user')['type']];
|
|
if ($company_info['code'] != 'super' && !self::chkUserInSuperusers()) {
|
|
if ($company_info['code'] != 'super' && !self::chkUserInSuperusers()) {
|
|
if (session('user')['type'] == 1) {
|
|
if (session('user')['type'] == 1) {
|
|
$whr[] = ["companyId", "=", $companyId];
|
|
$whr[] = ["companyId", "=", $companyId];
|
|
@@ -270,59 +276,60 @@ class EnterpriseApi {
|
|
$checkState = trim($request->param("checkState"));
|
|
$checkState = trim($request->param("checkState"));
|
|
|
|
|
|
if ($oldName) {
|
|
if ($oldName) {
|
|
- $where[] = ["oldName", "like", "%{$oldName}%"];
|
|
|
|
|
|
+ $where[] = ["r.oldName", "like", "%{$oldName}%"];
|
|
}
|
|
}
|
|
if ($oldIdCard) {
|
|
if ($oldIdCard) {
|
|
- $where[] = ["oldIdCard", "like", "%{$oldIdCard}%"];
|
|
|
|
|
|
+ $where[] = ["r.oldIdCard", "like", "%{$oldIdCard}%"];
|
|
}
|
|
}
|
|
if ($oldLegal) {
|
|
if ($oldLegal) {
|
|
- $where[] = ["oldLegal", "like", "%{$oldLegal}%"];
|
|
|
|
|
|
+ $where[] = ["r.oldLegal", "like", "%{$oldLegal}%"];
|
|
}
|
|
}
|
|
if ($oldStreet) {
|
|
if ($oldStreet) {
|
|
- $where[] = ["oldStreet", "=", "{$oldStreet}"];
|
|
|
|
|
|
+ $where[] = ["r.oldStreet", "=", "{$oldStreet}"];
|
|
}
|
|
}
|
|
if ($oldEnterpriseTag) {
|
|
if ($oldEnterpriseTag) {
|
|
- $where[] = ["oldEnterpriseTag", "=", "{$oldEnterpriseTag}"];
|
|
|
|
|
|
+ $where[] = ["r.oldEnterpriseTag", "=", "{$oldEnterpriseTag}"];
|
|
}
|
|
}
|
|
if ($oldIndustryFieldNew) {
|
|
if ($oldIndustryFieldNew) {
|
|
- $where[] = ["oldIndustryFieldNew", "=", "{$oldIndustryFieldNew}"];
|
|
|
|
|
|
+ $where[] = ["r.oldIndustryFieldNew", "=", "{$oldIndustryFieldNew}"];
|
|
}
|
|
}
|
|
if ($newName) {
|
|
if ($newName) {
|
|
- $where[] = ["newName", "like", "%{$newName}%"];
|
|
|
|
|
|
+ $where[] = ["r.newName", "like", "%{$newName}%"];
|
|
}
|
|
}
|
|
if ($newIdCard) {
|
|
if ($newIdCard) {
|
|
- $where[] = ["newIdCard", "like", "%{$newIdCard}%"];
|
|
|
|
|
|
+ $where[] = ["r.newIdCard", "like", "%{$newIdCard}%"];
|
|
}
|
|
}
|
|
if ($newAgentName) {
|
|
if ($newAgentName) {
|
|
- $where[] = ["newAgentName", "like", "%{$newAgentName}%"];
|
|
|
|
|
|
+ $where[] = ["r.newAgentName", "like", "%{$newAgentName}%"];
|
|
}
|
|
}
|
|
if ($checkState) {
|
|
if ($checkState) {
|
|
- $where[] = ["checkState", "=", "{$checkState}"];
|
|
|
|
|
|
+ $where[] = ["r.checkState", "=", "{$checkState}"];
|
|
} else {
|
|
} else {
|
|
- $where[] = ['checkState', '>', 1];
|
|
|
|
|
|
+ $where[] = ['r.checkState', '>', 1];
|
|
}
|
|
}
|
|
if ($newStreet) {
|
|
if ($newStreet) {
|
|
- $where[] = ["newStreet", "=", "{$newStreet}"];
|
|
|
|
|
|
+ $where[] = ["r.newStreet", "=", "{$newStreet}"];
|
|
}
|
|
}
|
|
if ($newEnterpriseTag) {
|
|
if ($newEnterpriseTag) {
|
|
- $where[] = ["newEnterpriseTag", "=", "{$newEnterpriseTag}"];
|
|
|
|
|
|
+ $where[] = ["r.newEnterpriseTag", "=", "{$newEnterpriseTag}"];
|
|
}
|
|
}
|
|
if ($newIndustryFieldNew) {
|
|
if ($newIndustryFieldNew) {
|
|
- $where[] = ["newIndustryFieldNew", "=", "{$newIndustryFieldNew}"];
|
|
|
|
|
|
+ $where[] = ["r.newIndustryFieldNew", "=", "{$newIndustryFieldNew}"];
|
|
}
|
|
}
|
|
|
|
+ $where[] = ["e.delete", "=", 0];
|
|
if ($whereRaw) {
|
|
if ($whereRaw) {
|
|
- $count = EnterpriseRecord::where($where)->whereRaw($whereRaw)->count();
|
|
|
|
|
|
+ $count = EnterpriseRecord::alias("r")->leftJoin("un_enterprise e", "e.id=r.mainId")->where($where)->whereRaw($whereRaw)->count();
|
|
} else {
|
|
} else {
|
|
- $count = EnterpriseRecord::where($where)->count();
|
|
|
|
|
|
+ $count = EnterpriseRecord::alias("r")->leftJoin("un_enterprise e", "e.id=r.mainId")->where($where)->count();
|
|
}
|
|
}
|
|
if ($count > 0) {
|
|
if ($count > 0) {
|
|
$talentTypeList = DictApi::selectByParentCode("enterprise_tag");
|
|
$talentTypeList = DictApi::selectByParentCode("enterprise_tag");
|
|
$industryFieldNewList = DictApi::selectByParentCode("industry_field");
|
|
$industryFieldNewList = DictApi::selectByParentCode("industry_field");
|
|
$streetList = DictApi::selectByParentCode("street");
|
|
$streetList = DictApi::selectByParentCode("street");
|
|
if ($whereRaw) {
|
|
if ($whereRaw) {
|
|
- $list = EnterpriseRecord::where($where)->whereRaw($whereRaw)->limit($offset, $limit)->order("createTime", 'desc')->select()->toArray();
|
|
|
|
|
|
+ $list = EnterpriseRecord::alias("r")->leftJoin("un_enterprise e", "e.id=r.mainId")->field("r.*")->where($where)->whereRaw($whereRaw)->limit($offset, $limit)->order("r.createTime", 'desc')->select()->toArray();
|
|
} else {
|
|
} else {
|
|
- $list = EnterpriseRecord::where($where)->limit($offset, $limit)->order("createTime", 'desc')->select()->toArray();
|
|
|
|
|
|
+ $list = EnterpriseRecord::alias("r")->leftJoin("un_enterprise e", "e.id=r.mainId")->field("r.*")->where($where)->limit($offset, $limit)->order("r.createTime", 'desc')->select()->toArray();
|
|
}
|
|
}
|
|
foreach ($list as $k => &$v) {
|
|
foreach ($list as $k => &$v) {
|
|
$v['oldStreetName'] = $streetList[$v['oldStreet']];
|
|
$v['oldStreetName'] = $streetList[$v['oldStreet']];
|
|
@@ -343,7 +350,7 @@ class EnterpriseApi {
|
|
$company_info = CompanyApi::getOne($companyId);
|
|
$company_info = CompanyApi::getOne($companyId);
|
|
$where = [];
|
|
$where = [];
|
|
$whereRaw = "";
|
|
$whereRaw = "";
|
|
- $where[] = ['type', '=', session('user')['type']];
|
|
|
|
|
|
+ $where[] = ['r.type', '=', session('user')['type']];
|
|
if ($company_info['code'] != 'super' && !self::chkUserInSuperusers()) {
|
|
if ($company_info['code'] != 'super' && !self::chkUserInSuperusers()) {
|
|
if (session('user')['type'] == 1) {
|
|
if (session('user')['type'] == 1) {
|
|
$whr[] = ["companyId", "=", $companyId];
|
|
$whr[] = ["companyId", "=", $companyId];
|
|
@@ -442,9 +449,9 @@ class EnterpriseApi {
|
|
$where[] = ["newAgentName", "like", "%{$newAgentName}%"];
|
|
$where[] = ["newAgentName", "like", "%{$newAgentName}%"];
|
|
}
|
|
}
|
|
if ($checkState) {
|
|
if ($checkState) {
|
|
- $where[] = ["checkState", "=", "{$checkState}"];
|
|
|
|
|
|
+ $where[] = ["r.checkState", "=", "{$checkState}"];
|
|
} else {
|
|
} else {
|
|
- $where[] = ['checkState', '>', 1];
|
|
|
|
|
|
+ $where[] = ['r.checkState', '>', 1];
|
|
}
|
|
}
|
|
if ($newStreet) {
|
|
if ($newStreet) {
|
|
$where[] = ["newStreet", "=", "{$newStreet}"];
|
|
$where[] = ["newStreet", "=", "{$newStreet}"];
|
|
@@ -455,10 +462,11 @@ class EnterpriseApi {
|
|
if ($newIndustryFieldNew) {
|
|
if ($newIndustryFieldNew) {
|
|
$where[] = ["newIndustryFieldNew", "=", "{$newIndustryFieldNew}"];
|
|
$where[] = ["newIndustryFieldNew", "=", "{$newIndustryFieldNew}"];
|
|
}
|
|
}
|
|
|
|
+ $where[] = ["e.delete", "=", 0];
|
|
if ($whereRaw) {
|
|
if ($whereRaw) {
|
|
- $count = EnterpriseRecord::where($where)->whereRaw($whereRaw)->count();
|
|
|
|
|
|
+ $count = EnterpriseRecord::alias("r")->leftJoin("un_enterprise e", "e.id=r.mainId")->where($where)->whereRaw($whereRaw)->count();
|
|
} else {
|
|
} else {
|
|
- $count = EnterpriseRecord::where($where)->count();
|
|
|
|
|
|
+ $count = EnterpriseRecord::alias("r")->leftJoin("un_enterprise e", "e.id=r.mainId")->where($where)->count();
|
|
}
|
|
}
|
|
if ($count > 0) {
|
|
if ($count > 0) {
|
|
$organizationTagList = DictApi::selectByParentCode("organization_tag");
|
|
$organizationTagList = DictApi::selectByParentCode("organization_tag");
|
|
@@ -469,9 +477,9 @@ class EnterpriseApi {
|
|
$streetList = DictApi::selectByParentCode("street");
|
|
$streetList = DictApi::selectByParentCode("street");
|
|
$agencyTypeList = DictApi::selectByParentCode("agency_type");
|
|
$agencyTypeList = DictApi::selectByParentCode("agency_type");
|
|
if ($whereRaw) {
|
|
if ($whereRaw) {
|
|
- $list = EnterpriseRecord::where($where)->whereRaw($whereRaw)->order("createTime", 'desc')->select()->toArray();
|
|
|
|
|
|
+ $list = EnterpriseRecord::alias("r")->leftJoin("un_enterprise e", "e.id=r.mainId")->field("r.*")->where($where)->whereRaw($whereRaw)->order("createTime", 'desc')->select()->toArray();
|
|
} else {
|
|
} else {
|
|
- $list = EnterpriseRecord::where($where)->order("createTime", 'desc')->select()->toArray();
|
|
|
|
|
|
+ $list = EnterpriseRecord::alias("r")->leftJoin("un_enterprise e", "e.id=r.mainId")->field("r.*")->where($where)->order("createTime", 'desc')->select()->toArray();
|
|
}
|
|
}
|
|
foreach ($list as $k => &$v) {
|
|
foreach ($list as $k => &$v) {
|
|
if ($v["special"] == 1) {
|
|
if ($v["special"] == 1) {
|