authen
.public
Tables
(current)
Columns
Constraints
Relationships
Orphan Tables
Anomalies
Routines
sp_get_property_by_prop_group_id
Parameters
Name
Type
Mode
ugt
text
IN
pid
integer
IN
prop_group_id
integer
IN (DEFAULT NULL)
Definition
declare v_result json; begin if upper(ugt) = 'S' then return( select json_agg( json_build_object( 'id', p.id , 'code', p.code, 'name', p.name, 'active', p.enabled ) ) from property p ); end if; if prop_group_id is not null then return ( select json_agg( json_build_object( 'id', p.id , 'code', p.code, 'name', p.name, 'active', p.enabled ) ) from property p where p.prop_group_id = $3 ); end if; return ( select json_agg( json_build_object( 'id', p.id , 'code', p.code, 'name', p.name, 'active', p.enabled ) ) from property p where p.id = $2 ); -- if mode_check = 'null' then -- null -- return ( -- select -- json_agg( -- json_build_object( -- 'id', p.id , -- 'code', p.code, -- 'name', p.name, -- 'active', p.enabled -- ) -- ) -- from property p -- where p.id = $2 and p.enabled = true -- ); -- end if; -- -- if mode_check = 'all' then -- all -- return ( -- select -- json_agg( -- json_build_object( -- 'id', p.id , -- 'code', p.code, -- 'name', p.name, -- 'active', p.enabled -- ) -- ) -- from property p -- where p.prop_group_id = $2 -- ) ; -- -- end if; -- -- return ( -- select -- json_agg( -- json_build_object( -- 'id', p.id , -- 'code', p.code, -- 'name', p.name, -- 'active', p.enabled -- ) -- ) -- from property p -- where p.prop_group_id = $2 -- and p.enabled = true -- ); END;