You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

SpLuGetUserPermission.php 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. /**
  3. * AUTO GENERATED BY LUTICATE GENERATOR
  4. * ANY CHANGES WILL BE OVERWRITTEN
  5. */
  6. namespace Luticate\Auth\DataAccess\SP;
  7. use Luticate\Utils\LuSpDbo;
  8. use Luticate\Utils\LuMultipleDbo;
  9. use Luticate\Utils\LuStringUtils;
  10. use Illuminate\Support\Facades\DB;
  11. class SpLuGetUserPermission extends LuSpDbo {
  12. /**
  13. * @param $dam
  14. * @return \Luticate\Auth\DataAccess\SP\SpLuGetUserPermission|null
  15. */
  16. protected static function damToDbo($dam)
  17. {
  18. if (is_null($dam))
  19. return null;
  20. $dbo = new SpLuGetUserPermission();
  21. $dbo->setVal(LuStringUtils::convertJsonString($dam->val));
  22. return $dbo;
  23. }
  24. /**
  25. * @param $_user_id integer
  26. * @param $_permisson_name string
  27. * @return \Luticate\Auth\DataAccess\SP\SpLuGetUserPermission;
  28. */
  29. public static function execute($_user_id, $_permisson_name)
  30. {
  31. $values = DB::select('SELECT to_json(data.val) AS val FROM sp_lu_get_user_permission(:_user_id, :_permisson_name) data', array(":_user_id" => $_user_id, ":_permisson_name" => $_permisson_name));
  32. return self::damToDbo($values[0]);
  33. }
  34. public function jsonSerialize()
  35. {
  36. return array(
  37. "Val" => $this->_val
  38. );
  39. }
  40. public static function jsonDeserialize($json)
  41. {
  42. $dbo = new SpLuGetUserPermission();
  43. if (isset($json["Val"])) {
  44. $dbo->setVal($json["Val"]);
  45. }
  46. return $dbo;
  47. }
  48. public static function generateSample()
  49. {
  50. $dbo = new SpLuGetUserPermission();
  51. $dbo->setVal(true);
  52. return $dbo;
  53. }
  54. /**
  55. * @var boolean
  56. */
  57. protected $_val;
  58. public function getVal()
  59. {
  60. return $this->_val;
  61. }
  62. public function setVal($value)
  63. {
  64. $this->_val = $value;
  65. }
  66. }