<?php
/**
 *
 * @author：llbjj
 * @DateTime：2022/5/6 10:57
 * @Description：
 *
 */

namespace Application\Service\DB\Item;

use Application\Service\DB\Dictionary\FormGroup;
use Application\Service\Extension\ErrorHandler;
use Application\Service\Extension\Helper\ArrayHelper;
use Interop\Container\ContainerInterface;

class PatientFormLock extends \Application\Service\DB\AbstractDb
{
    public function __construct($dbAdapter, ContainerInterface $container)
    {
        if (!$this->tableName) {
            $this->tableName = 'yikeen_item_patient_form_lock';
        }

        parent::__construct($dbAdapter, $container);
    }


    public function getIsLock(array $condition = []): bool
    {
        return (bool)$this->fetchOne([
            'columns' => ['id'],
            'where' => $condition
        ]);
    }

    public function setUnLock(int $contentId, int $isAe = 0)
    {
        $this->update(['is_del' => 1], ['content_id' => $contentId, 'is_ae' => $isAe]);
    }
}
