GuaranteeTemplateDao.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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;
  12. use app\common\dao\BaseDao;
  13. use app\common\model\store\GuaranteeTemplate;
  14. class GuaranteeTemplateDao extends BaseDao
  15. {
  16. protected function getModel(): string
  17. {
  18. return GuaranteeTemplate::class;
  19. }
  20. /**
  21. * 清除特定字段值对应的数据记录
  22. *
  23. * 本函数用于根据指定的字段值和该值对应的ID,从数据库中删除相应的记录。
  24. * 这是个通用函数,可以通过传入不同的字段名和ID值来删除不同表中的数据。
  25. *
  26. * @param mixed $id 需要删除的数据记录的ID值,可以是数字、字符串等
  27. * @param string $field 指定的字段名,用于查询和删除数据
  28. */
  29. public function clear($id,$field)
  30. {
  31. // 使用模型获取数据库实例,并构造删除语句,根据字段和ID删除数据
  32. $this->getModel()::getDB()->where($field, $id)->delete();
  33. }
  34. }