|
@@ -1529,10 +1529,25 @@ class PublicRpcService implements PublicRpcServiceInterface
|
|
|
*/
|
|
|
public function getSectorPlace(array $data): array
|
|
|
{
|
|
|
- $template = SectorPlace::where('sector_place.sector_num', $data['sector_num'])
|
|
|
- ->leftJoin('size','sector_place.size_id','=','size.id')
|
|
|
- ->select('sector_place.*','size.width','size.height')
|
|
|
- ->get()->all();
|
|
|
+ if(isset($data['sector_num']) && !empty($data['sector_num'])){
|
|
|
+ $where['t.sector_num'] = $data['sector_num'];
|
|
|
+ $template = DB::table(DB::raw('(
|
|
|
+ SELECT
|
|
|
+ sp.*,
|
|
|
+ s.width,
|
|
|
+ s.height,
|
|
|
+ ROW_NUMBER() OVER (PARTITION BY sp.type ORDER BY sp.id DESC) as rn
|
|
|
+ FROM sector_place sp
|
|
|
+ LEFT JOIN size s ON sp.size_id = s.id
|
|
|
+ ) as t'))
|
|
|
+ ->where('rn', 1)
|
|
|
+ ->where($where)
|
|
|
+ ->select('t.*')
|
|
|
+ ->get();
|
|
|
+ }
|
|
|
+ if(isset($data['type']) && !empty($data['type'])){
|
|
|
+ $template = SectorPlace::where('type', $data['type'])->get()->all();
|
|
|
+ }
|
|
|
if(empty($template)){
|
|
|
return Result::error('未查询到通栏位置相关模版!');
|
|
|
}
|