package com.iailab.module.event.service.impl;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.iailab.framework.common.service.impl.BaseServiceImpl;
|
import com.iailab.framework.common.util.object.ConvertUtils;
|
import com.iailab.common.utils.DateUtils;
|
import com.iailab.module.event.dao.EventInfoDao;
|
import com.iailab.module.event.dto.EventInfoDTO;
|
import com.iailab.module.event.entity.EventInfoEntity;
|
import com.iailab.module.event.service.EventInfoService;
|
import lombok.extern.slf4j.Slf4j;
|
import org.apache.commons.lang3.StringUtils;
|
import org.springframework.stereotype.Service;
|
|
import java.util.Date;
|
|
/**
|
* @author PanZhibao
|
* @Description
|
* @createTime 2024年05月30日
|
*/
|
@Slf4j
|
@Service
|
public class EventInfoServiceImpl extends BaseServiceImpl<EventInfoDao, EventInfoEntity> implements EventInfoService {
|
|
@Override
|
public void save(EventInfoDTO dto) {
|
EventInfoEntity entity = ConvertUtils.sourceToTarget(dto, EventInfoEntity.class);
|
insert(entity);
|
}
|
|
@Override
|
public Long getCount(String eventName, Date startTime, Date endTime) {
|
Integer result = 0;
|
QueryWrapper<EventInfoEntity> wrapper = new QueryWrapper<>();
|
wrapper.like(StringUtils.isNotBlank(eventName), "event_name", eventName)
|
.gt("event_time", DateUtils.format(startTime,DateUtils.DATE_TIME_PATTERN ))
|
.lt("event_time", DateUtils.format(startTime,DateUtils.DATE_TIME_PATTERN ));
|
|
|
return baseDao.selectCount(wrapper);
|
}
|
}
|