Storenavigation.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <?php
  2. namespace app\common\model;
  3. use think\facade\Db;
  4. /**
  5. *
  6. *
  7. * ----------------------------------------------------------------------------
  8. *
  9. * 数据层模型
  10. */
  11. class Storenavigation extends BaseModel
  12. {
  13. protected static function init()
  14. {
  15. parent::init(); // TODO: Change the autogenerated stub
  16. }
  17. /**
  18. * 读取列表
  19. * @access public
  20. * @author csdeshang
  21. * @param type $condition 条件
  22. * @param type $field 字段
  23. * @return type
  24. */
  25. public function getStorenavigationList($condition, $field = '*')
  26. {
  27. $result = Db::name('storenavigation')->field($field)->where($condition)->order('storenav_sort asc')->select()->toArray();
  28. return $result;
  29. }
  30. /**
  31. * 读取单条记录
  32. * @access public
  33. * @author csdeshang
  34. * @param array $condition
  35. * @return array
  36. */
  37. public function getStorenavigationInfo($condition)
  38. {
  39. $result = Db::name('storenavigation')->where($condition)->find();
  40. return $result;
  41. }
  42. /**
  43. * 增加
  44. * @access public
  45. * @author csdeshang
  46. * @param array $data 参数内容
  47. * @return bool
  48. */
  49. public function addStorenavigation($data)
  50. {
  51. return Db::name('storenavigation')->insertGetId($data);
  52. }
  53. /**
  54. * 更新
  55. * @access public
  56. * @author csdeshang
  57. * @param array $update 更新数据
  58. * @param array $condition 条件
  59. * @return bool
  60. */
  61. public function editStorenavigation($update, $condition)
  62. {
  63. return Db::name('storenavigation')->where($condition)->update($update);
  64. }
  65. /**
  66. * 删除
  67. * @access public
  68. * @author csdeshang
  69. * @param array $condition 条件
  70. * @return bool
  71. */
  72. public function delStorenavigation($condition)
  73. {
  74. return Db::name('storenavigation')->where($condition)->delete();
  75. }
  76. }