|
|
@@ -81,7 +81,7 @@ class RejectedAnalyzeOwner extends Model
|
|
|
}
|
|
|
|
|
|
// 拼接条件 zengjun
|
|
|
- public static function getCondition($array)
|
|
|
+ public static function getCondition($array, $owners)
|
|
|
{
|
|
|
if (isset($array['data'])){
|
|
|
$condition=RejectedAnalyzeOwner::getSqlToIDs($array['data']);
|
|
|
@@ -105,6 +105,9 @@ class RejectedAnalyzeOwner extends Model
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ if (count($owners) > 0){
|
|
|
+ $condition .= "AND id_owner IN (".implode(",",$owners).")";
|
|
|
+ }
|
|
|
$condition .= ' group by id_owner';
|
|
|
return $condition;
|
|
|
}
|
|
|
@@ -126,8 +129,9 @@ class RejectedAnalyzeOwner extends Model
|
|
|
}
|
|
|
|
|
|
// 返回sql zengjun
|
|
|
- public static function getQuerySQL($array= null){
|
|
|
- $condition = RejectedAnalyzeOwner::getCondition($array);// 条件
|
|
|
+ public static function getQuerySQL($array){
|
|
|
+ $owners = app("OwnerService")->getIdArr();
|
|
|
+ $condition = RejectedAnalyzeOwner::getCondition($array, $owners);// 条件
|
|
|
$sql = 'select distinct rao.id_owner,owners.name owner_name,sum(bounce_amount) bounce_amount,sum(check_amount) check_amount,sum(in_storage_count) in_storage_count,sum(not_in_storage_count) not_in_storage_count from';
|
|
|
$sql .= '(';
|
|
|
// 退件单数
|
|
|
@@ -147,8 +151,10 @@ class RejectedAnalyzeOwner extends Model
|
|
|
$sql .= $condition;
|
|
|
$sql .= ') rao ';
|
|
|
$sql .= ' left join owners on owners.id = rao.id_owner and owners.deleted_at is null ';
|
|
|
+ if (count($owners) == 0){
|
|
|
+ $sql .= " WHERE 0=1 ";
|
|
|
+ }
|
|
|
$sql .= ' group by rao.id_owner';
|
|
|
- $sql .= ' having owners.name is not null';
|
|
|
if(isset($array['uncheck_amount'])){
|
|
|
// 审核数为0
|
|
|
if($array['uncheck_amount'] == 0)$sql.=' and bounce_amount - check_amount in (0) ';
|