ShippingTemplateUndeliveryDao.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\common\dao\store\shipping;
  12. use app\common\dao\BaseDao;
  13. use app\common\model\store\shipping\ShippingTemplateUndelivery as model;
  14. class ShippingTemplateUndeliveryDao extends BaseDao
  15. {
  16. /**
  17. * @Author:Qinii
  18. * @Date: 2020/5/8
  19. * @return string
  20. */
  21. protected function getModel(): string
  22. {
  23. return model::class;
  24. }
  25. /**
  26. * @Author:Qinii
  27. * @Date: 2020/5/8
  28. * @param $field
  29. * @param $value
  30. * @param null $except
  31. * @return bool
  32. */
  33. public function merFieldExists($field, $value, $except = null)
  34. {
  35. return ($this->getModel())::getDB()->when($except, function ($query, $except) use ($field) {
  36. $query->where($field, '<>', $except);
  37. })->where($field, $value)->count() > 0;
  38. }
  39. /**
  40. * 批量删除
  41. * @Author:Qinii
  42. * @Date: 2020/5/8
  43. * @param array $id
  44. * @param array $temp_id
  45. */
  46. public function batchRemove(array $id,array $temp_id)
  47. {
  48. if($id)
  49. ($this->getModel())::getDB()->where($this->getPk(),'in',$id)->delete();
  50. if($temp_id)
  51. ($this->getModel())::getDB()->where('temp_id','in',$temp_id)->delete();
  52. }
  53. }