Storereopen.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <?php
  2. namespace app\common\model;
  3. use think\facade\Db;
  4. /**
  5. *
  6. *
  7. * ----------------------------------------------------------------------------
  8. *
  9. * 数据层模型
  10. */
  11. class Storereopen extends BaseModel
  12. {
  13. public $page_info;
  14. /**
  15. * 取得列表
  16. * @access public
  17. * @author csdeshang
  18. * @param array $condition 条件
  19. * @param int $pagesize 分页
  20. * @param string $order 排序
  21. * @return array
  22. */
  23. public function getStorereopenList($condition = array(), $pagesize = '', $order = 'storereopen_id desc')
  24. {
  25. if ($pagesize) {
  26. $result = Db::name('storereopen')->where($condition)->order($order)->paginate(['list_rows' => $pagesize, 'query' => request()->param()], false);
  27. $this->page_info = $result;
  28. return $result->items();
  29. } else {
  30. return Db::name('storereopen')->where($condition)->order($order)->select()->toArray();
  31. }
  32. }
  33. /**
  34. * 增加新记录
  35. * @access public
  36. * @author csdeshang
  37. * @param arrat $data 参数内容
  38. * @return bool
  39. */
  40. public function addStorereopen($data)
  41. {
  42. return Db::name('storereopen')->insertGetId($data);
  43. }
  44. /**
  45. * 取单条信息
  46. * @access public
  47. * @author csdeshang
  48. * @param type $condition 条件
  49. * @return type
  50. */
  51. public function getStorereopenInfo($condition)
  52. {
  53. return Db::name('storereopen')->where($condition)->find();
  54. }
  55. /**更新记录
  56. * @access public
  57. * @author csdeshang
  58. * @param type $data 更新数据
  59. * @param type $condition 条件
  60. * @return type
  61. */
  62. public function editStorereopen($data, $condition)
  63. {
  64. return Db::name('storereopen')->where($condition)->update($data);
  65. }
  66. /**
  67. * 取得数量
  68. * @access public
  69. * @author csdeshang
  70. * @param array $condition 条件
  71. * @return int
  72. */
  73. public function getStorereopenCount($condition)
  74. {
  75. return Db::name('storereopen')->where($condition)->count();
  76. }
  77. /**
  78. * 删除记录
  79. * @access public
  80. * @author csdeshang
  81. * @param array $condition 条件
  82. * @return bool
  83. */
  84. public function delStorereopen($condition)
  85. {
  86. return Db::name('storereopen')->where($condition)->delete();
  87. }
  88. }