|  | @@ -8,6 +8,8 @@
 | 
		
	
		
			
			| 8 | 8 |  namespace {{ sp_namespace.as_it }};
 | 
		
	
		
			
			| 9 | 9 |  
 | 
		
	
		
			
			| 10 | 10 |  use Luticate\Utils\LuSpModel;
 | 
		
	
		
			
			|  | 11 | +use Luticate\Utils\LuMultipleDbo;
 | 
		
	
		
			
			|  | 12 | +use Luticate\Utils\LuStringUtils;
 | 
		
	
		
			
			| 11 | 13 |  use Illuminate\Support\Facades\DB;
 | 
		
	
		
			
			| 12 | 14 |  
 | 
		
	
		
			
			| 13 | 15 |  class {{ sp.sp_name.camel_upper }} extends LuSpModel {
 | 
		
	
	
		
			
			|  | @@ -25,9 +27,12 @@ class {{ sp.sp_name.camel_upper }} extends LuSpModel {
 | 
		
	
		
			
			| 25 | 27 |          return $dbo;
 | 
		
	
		
			
			| 26 | 28 |      }
 | 
		
	
		
			
			| 27 | 29 |  
 | 
		
	
		
			
			|  | 30 | +{% set spcall %}{{ sp.sp_name.as_it }}({% for arg in args.in %}:{{ arg.name.as_it }}{{ loop.last ? "" : ", " }}{% endfor %}){% endset %}
 | 
		
	
		
			
			|  | 31 | +{% set argsarray %}{% for arg in args.in %}":{{ arg.name.as_it }}" => ${{ arg.name.as_it }}{{ loop.last ? "" : ", " }}{% endfor %}{% endset %}
 | 
		
	
		
			
			|  | 32 | +
 | 
		
	
		
			
			| 28 | 33 |      public static function execute({% for arg in args.in %}${{ arg.name.as_it }}{{ loop.last ? "" : ", " }}{% endfor %})
 | 
		
	
		
			
			| 29 | 34 |      {
 | 
		
	
		
			
			| 30 |  | -        $values = DB::select('SELECT * FROM {{ sp.sp_name.as_it }}({% for arg in args.in %}?{{ loop.last ? "" : ", " }}{% endfor %})', array({% for arg in args.in %}${{ arg.name.as_it }}{{ loop.last ? "" : ", " }}{% endfor %}));
 | 
		
	
		
			
			|  | 35 | +        $values = DB::select('SELECT * FROM {{ spcall }}', array({{ argsarray }}));
 | 
		
	
		
			
			| 31 | 36 |  {% if sp.proretset %}
 | 
		
	
		
			
			| 32 | 37 |          $dboValues = array();
 | 
		
	
		
			
			| 33 | 38 |          foreach ($values as $value)
 | 
		
	
	
		
			
			|  | @@ -37,6 +42,18 @@ class {{ sp.sp_name.camel_upper }} extends LuSpModel {
 | 
		
	
		
			
			| 37 | 42 |          return self::damToDbo($values[0]);
 | 
		
	
		
			
			| 38 | 43 |  {% endif %}
 | 
		
	
		
			
			| 39 | 44 |      }
 | 
		
	
		
			
			|  | 45 | +
 | 
		
	
		
			
			|  | 46 | +{% if sp.proretset %}
 | 
		
	
		
			
			|  | 47 | +    public static function getMultipleJson({% for arg in args.in %}${{ arg.name.as_it }}, {% endfor %}$page, $perPage)
 | 
		
	
		
			
			|  | 48 | +    {
 | 
		
	
		
			
			|  | 49 | +        $values = DB::select('SELECT (SELECT count(*) FROM {{ spcall }}) as count, (SELECT json_agg(q) FROM (SELECT * FROM {{ spcall }} OFFSET (:page::int * :perPage::int) LIMIT :perPage) q) as data',
 | 
		
	
		
			
			|  | 50 | +            array({{ argsarray }}, ":page" => $page, ":perPage" => $perPage));
 | 
		
	
		
			
			|  | 51 | +        $value = $values[0];
 | 
		
	
		
			
			|  | 52 | +        $data = LuStringUtils::convertJsonString($value->data);
 | 
		
	
		
			
			|  | 53 | +        return new LuMultipleDbo($value->count, $data);
 | 
		
	
		
			
			|  | 54 | +    }
 | 
		
	
		
			
			|  | 55 | +{% endif %}
 | 
		
	
		
			
			|  | 56 | +
 | 
		
	
		
			
			| 40 | 57 |  {% for arg in args.out %}
 | 
		
	
		
			
			| 41 | 58 |  
 | 
		
	
		
			
			| 42 | 59 |      /**
 |