/*
 * Copyright (c) 2024 codvision.com All Rights Reserved.
 */

package com.codvision.basic.service.impl.patrol;

import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.codvision.basic.entity.patrol.PatrolClock;
import com.codvision.basic.entity.vo.patrol.PatrolClockVO;
import com.codvision.basic.mapper.patrol.PatrolClockMapper;
import com.codvision.basic.service.patrol.PatrolClockService;
import com.codvision.webcore.bean.QueryPage;
import com.codvision.webcore.util.QueryPageUtil;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * @author codvision
 */
@Service
public class PatrolClockServiceImpl extends ServiceImpl<PatrolClockMapper, PatrolClock> implements PatrolClockService {
    @Override
    public IPage<PatrolClockVO> getPageResult(QueryPage<Map<String, Object>> queryPage) {
        return getBaseMapper().getPageResult(queryPage.getPage(), QueryPageUtil.queryMap(queryPage));
    }

    @Override
    public void add(PatrolClock patrolclock) {
        patrolclock.setClockTime(DateUtil.now());
        getBaseMapper().insert(patrolclock);
    }
}
