ParameterProductDao.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2024 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\parameter;
  12. use app\common\dao\BaseDao;
  13. use app\common\model\store\parameter\ParameterProduct;
  14. class ParameterProductDao extends BaseDao
  15. {
  16. protected function getModel(): string
  17. {
  18. return ParameterProduct::class;
  19. }
  20. /**
  21. * 清除特定字段中具有指定ID的记录。
  22. *
  23. * 此方法通过提供的ID和字段名称,从数据库中删除符合条件的记录。
  24. * 它首先获取模型对应的数据库实例,然后使用提供的字段和ID构建删除条件,
  25. * 最后执行删除操作。
  26. *
  27. * @param int $id 主键ID,用于指定要删除的记录。
  28. * @param string $field 要用于删除条件的字段名称。
  29. */
  30. public function clear($id, string $field)
  31. {
  32. $this->getModel()::getDB()->whereIn($field, $id)->delete();
  33. }
  34. }